Order API Best Practices

Order API Best Practices

Heres a few tips to ensure you are working with the Button Order API as efficiently as possible

Understanding the finalization_date field:

The finalization_date is a field set by your organization to reflect your Brand’s cancel/return policy, and should not be used when sending new orders to the Button Orders API. As orders are reported to Button, they enter a pending state which is persisted until the finalization_date is reached.

Once the finalization_date has been reached, the order will move to a validated status and begin the commissioning process. If you choose to adjust or cancel the order, you may do so before the finalization_date.

If a finalization_date is specified when reporting a new order to the Button Orders API, this will override your Brand’s default policy and is not recommended.

Ensuring Accurate Reporting:

The format in which the Button Attribution Token is passed to your Checkout API depends on the contract between your mobile clients and your Checkout API. We recommend using a key of btn_ref to pass this value for consistency.

When testing your integration and sending dummy Attribution Tokens to Button, send in the format of ^fakesrctok-[a-f0-9]{16}$ (e.g. "btn_ref": "fakesrctok-abcdef0123456789"). For more information on this, see our Testing Section.

When updating orders, there is no need to include the Button Attribution token (btn_ref) as we already have it associated with the unique order identifier reported to Button.

Differences between order updates and cancellations:

Cancellations only occur if an entire order for every line item has been cancelled. If only some of an order’s line-items have been cancelled, then it is considered an update.