Some promotions might depend on the purchase history of customers. To model these scenarios in Voucherify, you can use the Order object. An order stores the cart structure (products and SKUs), the total amount of a transaction, and status:
FULFILLED. You can track orders in the Dashboard and with the API.
We designed the order entity so that it helps you map your e-commerce process. Go through these concepts to understand how you can integrate orders into your workflow:
- Similarly to the customer object, orders can be identified by your internal id; to do so, use
- An order can be created in two ways:
- By passing
orderas payload in redemption.
- With order endpoint. You can later link this order to a corresponding redemption with
source_id. In this case, it's not necessary to provide the payload again – if you do so, however, the object will be upserted.
- If you provide the status field in the redemption payload, it will override a linked order status.
- If a redemption request is successful, Voucherify will set a related order to
- Otherwise, the status will remain the same or will get the value from the request payload.
- A successful rollback operation will set the order to
- If this behavior is not expected, you should pass the status field (e.g.
PAID) in the request body of the rollback request.
Validation rules can work with orders twofold:
- Introduce thresholds on cart structure and a total amount.
- Count the number of purchases in a timeframe or total amount of these purchases.
See validation rules for more details.
Updated 5 days ago