Open Closed

Culture bug in payment module - paypal gateway #5340


User avatar
0
svote created
  • ABP Framework version: v7.2.2
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:

I created a simple new ABP Solution and added the payment module. I want to use the PayPal gateway and set it up as following:

  • added appsettings for Payment:Paypal (api credentials, env, etc.)
  • added the sample payment request from the docs

After trying it out I received an error from PayPal - invalid_request After some investigation I found out that there there seams to be a problem with the gateway depending on the UI Culture Because I am using the German ui culture - the format of the value from the testing method converted in a wrong way for PayPal (Paypal requires decimal point)

Request captured from Paypal: { "application_context": { "cancel_url": "https://localhost:44365", "locale": "de-DE", "return_url": "https://localhost:44365/Payment/PayPal/PostPayment" }, "intent": "CAPTURE", "purchase_units": [ { "amount": { "breakdown": { "item_total": { "currency_code": "EUR", "value": "41,20" } }, "currency_code": "EUR", "value": "41,20" } .... }

By using the parameter CultureInfo.InvariantCulture for the ToString method in the PayPalPaymentGateway it seams to work correctly. But at this point the package is not usable for me


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can replace it, remove and add yours MyPayPalPaymentGateway.

    Configure<PaymentOptions>(options =>
    {
        options.Gateways.Add(
            new PaymentGatewayConfiguration(
                PayPalConsts.GatewayName,
                new FixedLocalizableString("PayPal"),
                isSubscriptionSupported: false,
                typeof(PayPalPaymentGateway)
            )
        );
    });
    

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11