- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Very strange issue, if I do this request through PHP, using:
$request = new \PayPalCheckoutSdk\Orders\OrdersCreateRequest();
$request->prefer('return=minimal');
$request->body = [
"intent" => "CAPTURE",
"purchase_units" => [
[
'description' => 'Example request',
'soft_descriptor' => 'Example',
'amount' => [
"currency_code" => "USD",
'value' => "3.00",
],
]
],
];
Like so: NOTICE: The total is NOT there!
However, if I do the same request in JavaScript, it goes as I expect:
return actions.order.create({
purchase_units: [
{
description: "Example request.",
amount: {
currency_code: "USD",
value: "3.00"
}
}
]
});
Notice; TOTAL is there, and clicking on it shows the description.
And if I specify the FULL message with items (but not nice) it also shows the amount.
$request = new \PayPalCheckoutSdk\Orders\OrdersCreateRequest();
$request->prefer('return=minimal');
$request->body = [
"intent" => "CAPTURE",
"purchase_units" => [
[
'description' => 'Example request',
'soft_descriptor' => 'Example',
'amount' => [
"currency_code" => "USD,
'value' => "3.00",
'breakdown' => [
'item_total' => [
"currency_code" => "USD,
'value' => "3.00",
],
],
],
'items' => [
[
'name' => "Item",
'description' => 'Example item',
'quantity' => 1,
'unit_amount' => [
"currency_code" => "USD,
'value' => "3.00",
],
]
],
]
],
];
But the result is not very nice (notice the multiple lines basically saying the same):
NOTICE: Total is there, but also with (unnecessary) item details.
I doubt this is intentional? Does anyone know why the total does NOT show with the minimal request?
Solved! Go to Solution.
- Labels:
-
Payments REST APIs
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This issue has to do with whether the user_action = PAY_NOW or CONTINUE
when you use a clients SDK (Payments SDK)- it defaults it to PAY_NOW hence anytime you use it with a JS - it shows up as a PAY_NOW in which case the amount is shown.
if you use it through an SDK directly the default is 'CONTINUE' and as such for that we do not show an amount (when no items are present) - this is a bug that we hope to resolve.
happy to answer any questions you guys may have but it's something we are looking to correct/improve.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Doing some effort myself, I think I found out when and how this happens.
If I take the token from the JS request and use it in the standard url: https://www.sandbox.paypal.com/checkoutnow?token=XXXX
The same issue occurs for the minimal JS request. I wonder if this is only an issue on test or also on Live.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This issue has to do with whether the user_action = PAY_NOW or CONTINUE
when you use a clients SDK (Payments SDK)- it defaults it to PAY_NOW hence anytime you use it with a JS - it shows up as a PAY_NOW in which case the amount is shown.
if you use it through an SDK directly the default is 'CONTINUE' and as such for that we do not show an amount (when no items are present) - this is a bug that we hope to resolve.
happy to answer any questions you guys may have but it's something we are looking to correct/improve.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much, this is indeed what it was.
Example of functional request that will show the total:
$request = new \PayPalCheckoutSdk\Orders\OrdersCreateRequest();
$request->prefer('return=minimal');
$request->body = [
"intent" => "CAPTURE",
"purchase_units" => [
[
'description' => 'Example description',
'soft_descriptor' => 'Soft description',
'amount' => [
"currency_code" => 'USD',
'value' => '1.23',
],
]
],
"application_context" => [
"cancel_url" => "URL",
"return_url" => "URL",
"shipping_preference" => "NO_SHIPPING",
"user_action" => "PAY_NOW",
],
];
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Issue with Empty store_info in Response Using /v1/reporting/transactions on Sandbox API in REST APIs
- Ensure that either `payee.merchant_id` or `payee.email_address` is specified. in REST APIs
- Is it Possible to Issue Refunds for Canceled Subscriptions Via REST API? in REST APIs
- PayPal no longer shows me custom requests from buyers in PayPal Payments Standard
- Specified resource ID does not exist. Please check the resource ID and try again in REST APIs