Update order details
Last updated: Sept 17th, 4:58pm
Update order details to provide a unique buyer experience.
Know before you code
- These capabilities modify an existing checkout integration.
- Complete the steps in Get started to get the following sandbox account information from the Developer Dashboard:
- Your sandbox account login information
- Your access token
- These client-side and server-side integration capabilities use the following:
- PayPal JavaScript SDK
- Orders REST API — Create order and Update order
Update order details
This procedure applies to standard and advanced integrations.
For increased flexibility when obtaining payments from buyers, you can update the transaction after it has been set up. This allows you to:
- Determine additional amounts, including shipping and tax.
- Capture a different total amount without needing the buyer to re-approve the transaction.
- Update fields, such as shipping address, after collecting them from the buyer.
To update order details, complete the following steps:
If you are updating the final amount of the transaction after the buyer approves the payment, or if you are updating other amount fields, such as shipping or tax, add
commit=false
in the script tag as shown in the following example:1<script src="https://www.paypal.com/sdk/js?client-id=CLIENT_ID&commit=false">2</script>Passing
commit=false
shows a Continue button during the buyer checkout experience rather than a Pay Now button, indicating to the buyer that the amount or other details might change before they complete the transaction.Before you capture the money from the transaction, call the PayPal Orders API on your server with the order ID. You can pass in a different
amount
,invoice_id
, andcustom_id
. See the following code sample.1curl -v -X PATCH https://api-m.sandbox.paypal.com/v2/checkout/orders/5O190127TN364715T \2-H "Content-Type: application/json" \3-H "Authorization: Bearer Access-Token" \4-d '[5 {6"op": "add",7"path": "/purchase_units/@reference_id=='PUHF'/invoice_id",8"value": {9 "integration_artifact": "INV-HighFashions"10}11 }12]'