Update Items
On this page you will find all necessary information about How to Update items. Make sure you check Embed Checkout article, before continuing reading this article.
When updating items in the cart, the merchant should:
- Send updated cart to Checkout
- Refresh app to show the updated price
1. Send updated cart to Checkout
In order to send updated cart to Checkout application, merchant has to send a PUT request with "Partner access token" as authorization with JSON data to /api/partner/payments/{purchaseid}/items. "Purchase ID" has to be included in the URL.
More information about generating a "Partner access token" here: Obtain partner access token for the purchase
More information about getting a "Purchase ID" for a current session here: Initialize payment
| Property | Data type | Description |
|---|---|---|
items | [] | List Item |
Item:
| Property | Data type | Description |
|---|---|---|
| Description | string | Name of item |
| Notes | string | Optional notes |
| Amount | decimal | Item cost |
| TaxCode | string | Tax code |
| TaxAmount | decimal | Tax amount |
| Quantity | decimal | Quantity |
Example
2. Refresh app to show the updated price
This ensures that the form will be reloaded with the actual price.
(Optional) - Refreshing the form when you are using Partner Shipping
In case you are also using Partner Shipping,
consider adding reason for calling refreshForm as an additional parameter when calling refreshForm.
This will allow us to know that shopping cart has been updated externally and trigger additional logic for Partner Shipping widget to keep all modules in sync.
Read more about reason for calling refreshForm under refreshForm additional options.
PHP integration example
Check the PHP demo example of Checkout 3.0 integration in our public repository on GitHub: https://github.com/avarda-ab/checkout3-phpdemo (opens in a new tab)