Capture or Cancel a Purchase Request
In-Store API
Give your shoppers the option to pay with Zip in-store with our point-of-sale API.
The capture and cancel API calls are only relevant to the Authorise and Capture flow.
Once you have determined that the customer order is ready to ship, you must capture the funds for the order. If there is an issue of any kind that prevents the order being fulfilled, the authorisation can instead be cancelled.
This flow also supports partial capture if:
- Only a part of the order can be fulfilled
- There are multiple items for the order that will be shipped at different times
Capture
This API call will contain:
- The amount to be captured
- A flag to express if the capture is intended to be partial
This /capture API call should be made from your server and not directly from the client front end.
Request
The charge Id returned in your original /purchaserequests API call will be passed in the capture API endpoint to identify the order being captured. For example:
https://merchantapi.sandbox.zipmoney.com.au/v1/purchaserequests/XXXXXXX/capture
Here is an example of how this information can be passed:
{
"amount": 300,
"is_partial": false
}
Partial capture
When capturing an order it is possible to capture for individual items independently, or to capture less than the authorised amount if an item is unable to be fulfilled.
If, for example, this charge was for an order with 2 items, each to be shipped at different times, this would be passed as individual API calls as each item is shipped to the customer:
Item 1:
{
"amount": 100,
"is_partial": true
}
Item 2:
{
"amount": 200
"is_partial": false
}
You may also have reason to capture less than the Authorised amount. This is generally relevant to 2 different scenarios:
- When only some items on the order are unable to be fulfilled
- When a quoted amount that was authorised comes in at a lesser amount
If an item is unable to be fulfilled for the customer, you must pass the "is_partial" flag as false when capturing the funds for the final item.
For example if Item 2 could not be delivered, the below would automatically cancel the remaining authorised funds and free them up on the customer account:
Item 1, when item 2 cannot be fulfilled:
{
"amount": 100,
"is_partial": false
}
The same is to be said for a quoted amount coming in at a lesser amount. For example, an order authorised for $150 that by the time of capture is actually only $120:
{
"amount": 120,
"is_partial": false
}
This will free up the remaining funds immediately to the customer account.
Cancel
If an order can not be fulfilled in its entirety, a cancel API call should be made to free up the customer funds.
This API call will contain no request body.
This /cancel API call should be made from your server and not directly from the client front end.
Request
The charge Id returned in your original /purchaserequests API call will be passed in the cancel API endpoint to identify the order being captured. For example:
https://merchantapi.sandbox.zipmoney.com.au/v1/purchaserequests/XXXXXXX/cancel
Updated about 4 years ago