Update order details

DOCSCurrent

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:

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:

  1. 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.

    1. 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, and custom_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]'

      If you accept cookies, we’ll use them to improve and customize your experience and enable our partners to show you personalized PayPal ads when you visit other sites. Manage cookies and learn more