Hi @vnvs ,
Thank you for contributing to this post. Most of the reason why this happens in sandbox is because the payment_source and experience_context is missing the return_url. Without these details the buyer is sent in a loop staying on the PayPal account, and never approving the payment. When this happens, if you attempt to capture the order, you will receive the error Payer Action Required.
Here is the documentation:
https://developer.paypal.com/docs/api/orders/v2/#orders_create
As you can see from the example below the payment_source includes experience_context and a return_url. You can update the return URL.
{
"intent": "CAPTURE",
"purchase_units": [
{
"amount": {
"currency_code": "USD",
"value": "100.00"
},
"shipping": {
"name": {
"full_name": "John Doe"
},
"address": {
"address_line_1": "123 N First Street",
"address_line_2": "Building 17",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95131",
"country_code": "US"
}
}
}
],
"payment_source" : {
"paypal" : {
"experience_context" : {
"return_url" : "http://www.myreturnurl.com",
"cancel_url" : "http://my_cancel_url.com",
"error_url" : "http://errorurl.com",
"locale" : "en-US",
"user_action": "PAY_NOW",
"shipping_preference" : "SET_PROVIDED_ADDRESS"
}
}
}
}
Thank you,
Jennifer
MTS
PayPal
... View more