PAYER_ACTION_REQUIRED when creating order using REST API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, I am integrating the Paypal Standard Checkout using Javascript SDK on the front end, with calls to the REST API on the backend; pretty standard stuff that's covered by the integration tutorials. I am using Paypal to receive donations to my site. I'm currently using the Sandbox environment. It's relevant that my site is a single-page-application.
I have successfully integrated the entire thing and it works great. The problem is that since I'm only collecting donations, there is absolutely no reason to collect my customer's shipping address. So, I added an "experience_context" to the order, and when I do, it ALWAYS returns with a status PAYER_ACTION_REQUIRED rather than CREATED. It does not seem to matter what's in the experience_context object. The mere presence of this object causes the PAYER_ACTION_REQUIRED status when POSTing to /v2/checkout/orders. The REST API documentation suggests that when that status is generated, it is required that you redirect the user to the "approve" link in the HATEOAS links in the returned object, but my site is a single-page-application, so I am definitely no up for redirecting the user anywhere to make an "approval".
Here is the content of my order:
{
"intent": "CAPTURE",
"payment_source": {
"paypal": {
"experience_context": {
"brand_name": "Redacted for this Post",
"landing_page": "NO_PREFERENCE",
"locale": "en-US",
"payment_method_preference": "IMMEDIATE_PAYMENT_REQUIRED",
"payment_method_selected": "PAYPAL",
"shipping_preference": "GET_FROM_FILE",
"user_action": "PAY_NOW"
}
}
},
"purchase_units": [
{
"amount": {
"currency_code": "USD",
"value": "5.00"
}
}
]
}
Any thoughts on what I might do to prevent this behavior ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @lwimble ,
Thank you for posting to the PayPal Community.
There is an option for a shipping_preference of no_shipping. This will redact the shipping address from the transaction.
https://developer.paypal.com/docs/api/orders/v2/#definition-experience_context_base
{
"brand_name": "string",
"shipping_preference": "NO_SHIPPING",
"locale": "string",
"return_url": "string",
"cancel_url": "string"
}
Thank you,
Jennifer
MTS
PayPal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm aware of that and I've tried it (and it does in fact redact the shipping info). That's not the problem. The problem is that merely providing an experience_context object produces a status of PAYER_ACTION_REQUIRED when trying to create the order. I need a status of CREATED.
Larry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have the same problem.
Without the block payment_source --> status created
Witht the block payment-source -->
"status" => "PAYER_ACTION_REQUIRED" "payment_source" => array:1 [▼ "paypal" => [] ]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Disputes Webhook does not works on Sandbox (23/04/24) in Sandbox Environment
- can we assign a unique detail to every subscription creation? in NVP/SOAP APIs
- Button in PayPal Payments Standard
- Receiving a PAYMENT.SALE.COMPLETED webhook notification - how can I trace the parent Subscription in REST APIs
- I need to create a Pay Now / Buy Now button that retrieves a price from a simple shopping cart. in PayPal Payments Standard