- 🇫🇷France Toki Caen, Normandy
Hi, I have the same problem here, for two customers who tried to pay with a credit card.
Would you please explain how you fixed it? - Status changed to Active
over 1 year ago 2:58pm 13 April 2023
Hello;
Using Drupal 8.8.5, both Commerce and this module on dev version and a Paypal payment gateway on Live, with correct credentials that has been working for months.
Today, a customer notified that he couldntt use the paypal buttons. I digged into the issue and found that we were receiving a 422 error after
return $this->client->post('/v2/checkout/orders', ['json' => $event->getRequestBody()]);
was called on web/modules/contrib/commerce_paypal/src/CheckoutSdk.php::createOrder()
The message I am receiving back is this one. Sadly, it's truncated:
"Client error: `POST https://api.paypal.com/v2/checkout/orders` resulted in a `422 Unprocessable Entity` response:
{"name":"UNPROCESSABLE_ENTITY","details":[{"field":"/purchase_units/@reference_id=='default'/payee","location":"body","i (truncated...)
"
Nevertheless, I checked the request body being sent from there and the info seems to be all correct.
This is the result of running JSON::encode() on $event->getRequestBody()
. I checked Paypal's API reference and it seems to be OK.
{
"intent":"CAPTURE",
"purchase_units":[
{
"reference_id":"default",
"custom_id":"599",
"invoice_id":"599-1588613509",
"amount":{
"currency_code":"EUR",
"value":"6",
"breakdown":{
"item_total":{
"currency_code":"EUR",
"value":"6"
}
}
},
"items":[
{
"name":"MY PRODUCT NAME",
"unit_amount":{
"currency_code":"EUR",
"value":"6"
},
"quantity":1
}
]
}
],
"application_context":{
"brand_name":"MY STORE",
"shipping_preference":"NO_SHIPPING"
},
"payer":{
"email_address":"asddsafdasffads@as.es",
"address":{
"address_line_1":"asdf",
"address_line_2":"dsaf",
"admin_area_2":"Madrid",
"admin_area_1":"Madrid",
"postal_code":"28045",
"country_code":"ES"
},
"name":{
"given_name":"asdf",
"surname":"asdf"
}
}
}
Am I missing something? Is this happening to somebody else?
Active
1.0
PayPal Checkout
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Hi, I have the same problem here, for two customers who tried to pay with a credit card.
Would you please explain how you fixed it?