Mangopay / mangopay2-ruby-sdk

Ruby Gem for MANGOPAY
https://rubygems.org/gems/mangopay
MIT License
42 stars 38 forks source link

Error instead of payment form on api.sandbox.mangopay.com/Content/PaylineTemplateWidget #199

Closed JunnB closed 3 years ago

JunnB commented 3 years ago

Hi, I'm having an issue when implementing a Web payin process. The API call is OK as it return the correct templateUrl. When redirecting to this template URL, it displays the correct price but i'm having an error message instead of the payment form (see attached image).

Here is an example of the template url returned https://api.sandbox.mangopay.com/Content/PaylineTemplateWidget?rp=f36a3d1513af4b85b744fd41b0091491&transactionId=112038910

In the console, I can see a CORS error. It seems to come between api.sandbox.mangopay.com and homologation-payment.cdn.payline.com domain in order to get a font. Here is the error : Access to font at 'https://homologation-payment.cdn.payline.com/assets/fonts/AvenirLtSd/WOFF/AvenirLTStd-Heavy.woff' from origin 'https://api.sandbox.mangopay.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Capture d’écran 2021-06-25 à 11 46 16

Can you give me some feedback on how/when you will fix that issue ? or if I can do anything from my side ? Thanks

fredericdelordm commented 3 years ago

Hello @JunnB,

Our tech team will help you as soon as possible.

Have a nice day,

JunnB commented 3 years ago

Hi, I can add further informations : I tested in production environment with the same code and I've the same issue without the CORS error (no javascript error in the page). The font seems to load as expected but i'm still getting the unexpected error instead of the credit card form.

Capture d’écran 2021-07-09 à 13 18 04
JunnB commented 3 years ago

Moreover, that's one of my mangopay.log request/response which seems doc friendly

POST "https://api.sandbox.mangopay.com/v2.01/clientId/payins/card/web" Request body

{
   "Tag":"custom meta",
   "AuthorId":"113383273",
   "DebitedFunds":{
      "Currency":"EUR",
      "Amount":2000
   },
   "Fees":{
      "Currency":"EUR",
      "Amount":0
   },
   "ReturnURL":"https://mysite.com/donations/card/success",
   "CardType":"CB_VISA_MASTERCARD",
   "CreditedWalletId":"106715150",
   "Culture":"FR"
}

Response 200 OK

{
   "Id":"113385267",
   "Tag":"custom meta",
   "CreationDate":1625840114,
   "AuthorId":"113383273",
   "CreditedUserId":"106715148",
   "DebitedFunds":{
      "Currency":"EUR",
      "Amount":2000
   },
   "CreditedFunds":{
      "Currency":"EUR",
      "Amount":2000
   },
   "Fees":{
      "Currency":"EUR",
      "Amount":0
   },
   "Status":"CREATED",
   "ResultCode":null,
   "ResultMessage":null,
   "ExecutionDate":null,
   "Type":"PAYIN",
   "Nature":"REGULAR",
   "CreditedWalletId":"106715150",
   "DebitedWalletId":null,
   "PaymentType":"CARD",
   "ExecutionType":"WEB",
   "RedirectURL":"[FILTERED]",
   "ReturnURL":"https://mysite.com/donations/card/success?transactionId=113385267",
   "TemplateURL":"https://api.sandbox.mangopay.com/Content/PaylineTemplateWidget?rp=7a3580bc84614f38800ef9203930992b\u0026transactionId=113385267",
   "CardType":"CB_VISA_MASTERCARD",
   "Culture":"FR",
   "SecureMode":"DEFAULT",
   "Billing":{
      "FirstName":"Junior",
      "LastName":"Bernard",
      "Address":{
         "AddressLine1":null,
         "AddressLine2":null,
         "City":null,
         "Region":null,
         "PostalCode":null,
         "Country":null
      }
   },
   "Shipping":{
      "FirstName":"Junior",
      "LastName":"Bernard",
      "Address":{
         "AddressLine1":null,
         "AddressLine2":null,
         "City":null,
         "Region":null,
         "PostalCode":null,
         "Country":null
      }
   },
   "StatementDescriptor":null
}
fredericdelordm commented 3 years ago

Hello @JunnB,

Sorry for the late reply. You should update your implementation and use RedirectURL instead of TemplateURL.

Tell me if it's solve your issue.

JunnB commented 3 years ago

It worked :) Thanks a lot for this clarification