- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am having an issue when following the HATEOAS link to approve an order after successfully creating the order. The issue is that I am continually redirected back to the same page and my order is never approved
Environment:
- Paypal sandbox environment
- Spring boot application to which I make creation and capture request
- Using paypal checkout sdk (https://mvnrepository.com/artifact/com.paypal.sdk/checkout-sdk)
- Postman to make requests to springboot service
Scenario:
- I create an order and receive the following object with HATEAOS links:
{
"id": "59H23879RL605900S",
"status": "CREATED",
"links": [
{
"href": "https://api.sandbox.paypal.com/v2/checkout/orders/59H23879RL605900S",
"rel": "self",
"method": "GET"
},
{
"href": "https://www.sandbox.paypal.com/checkoutnow?token=59H23879RL605900S",
"rel": "approve",
"method": "GET"
},
{
"href": "https://api.sandbox.paypal.com/v2/checkout/orders/59H23879RL605900S",
"rel": "update",
"method": "PATCH"
},
{
"href": "https://api.sandbox.paypal.com/v2/checkout/orders/59H23879RL605900S/capture",
"rel": "capture",
"method": "POST"
}
]
}
I then follow the approval link which brings me to this page:
I hit continue and it says "Processing" followed by: "We're sending you back to Test Store to complete this purchase."
I'm then redirected back to the same page as in my first screenshot.
When I then make a call to my spring boot back-end to capture the payment with the order ID, The following log is printed in my terminal:
{"name":"UNPROCESSABLE_ENTITY","details":[{"issue":"ORDER_NOT_APPROVED","description":"Payer has not yet approved the Order for payment. Please redirect the payer to the 'rel':'approve' url returned as part of the HATEOAS links within the Create Order call or provide a valid payment_source in the request."}],"message":"The requested action could not be performed, semantically incorrect, or failed business validation.","debug_id":"c980b3c23bf4b","links":[{"href":"https://developer.paypal.com/docs/api/orders/v2/#error-ORDER_NOT_APPROVED","rel":"information_link","method":"GET"}]}
So clearly the approval was not completed by following the HATEOAS link that was provided.
Am I missing some sort of configuration step that needs to happen in order for the approval to succeed?
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You never shared the order creation request you submitted, which is the most important part as it contains all the information on how you want the transaction setup.
Below is the request I can see for this order :
{
"intent": "CAPTURE",
"purchase_units": [
{
"amount": {
"currency_code": "USD",
"value": "0.1"
}
}
]
}
You're missing the "redirect_urls" and values which are required for redirection to successfully occur.
"application_context": {
"return_url": "https://yourdomain.com/return",
"cancel_url": "https://yourdomain.com/cancel",
They must be included within the "application_context" object : https://developer.paypal.com/docs/api/orders/v2/#definition-order_application_context
Thanks !
Was my post helpful? If so, please give me a kudos!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You never shared the order creation request you submitted, which is the most important part as it contains all the information on how you want the transaction setup.
Below is the request I can see for this order :
{
"intent": "CAPTURE",
"purchase_units": [
{
"amount": {
"currency_code": "USD",
"value": "0.1"
}
}
]
}
You're missing the "redirect_urls" and values which are required for redirection to successfully occur.
"application_context": {
"return_url": "https://yourdomain.com/return",
"cancel_url": "https://yourdomain.com/cancel",
They must be included within the "application_context" object : https://developer.paypal.com/docs/api/orders/v2/#definition-order_application_context
Thanks !
Was my post helpful? If so, please give me a kudos!
- 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.
- Paypal express checkout, payment they error "Sorry, something went wrong. Please try again." in PayPal Payments Standard
- Add Others data in SDKs
- Change the button from Sandbox to Production in REST APIs
- Issue with Rendering Trustly Payment Button via PayPal JavaScript SDK in SDKs
- Platform Marketplace integration approval in Sandbox Environment