Orders Object
Durianpay enables you to create Orders (or payment intents) and link them to actual payments. Orders are important as it helps you associate every payment with an order (and a customer), thus preventing multiple/duplicate payments easily as well as eases refund/partial refunds.
We recommend creating Order as soon as amount is known, such as when customer begins the checkout process, to help track your sales funnel. If the amount changes, you can update the amount as well. For example, if your customer backs out of the checkout process and adds new items to their cart, you may need to update the amount accordingly when they start the checkout process again.
If the checkout process is interrupted and resumes later, you should attempt to reuse the same Order instead of creating a new one. Each Order has a unique ID that you can use to retrieve it if you need it again. In your application’s data model, you can store the OrderID on the customer’s shopping cart or session in order to facilitate retrieval. The benefit of reusing the Order is that the object helps track any failed payment attempts for a given customer, cart or session.
Order Life Cycle
Status | Description |
---|---|
started | When you create an order, it is in started state. It stays in this state till any payment is attempted against it |
processing | An order moves to processing state when a payment is created/attempted on it. It remains in this state till one payment associated with this order (at least) is captured |
completed | After the successful capture of the payment, the order moves to the paid state. No further payment requests are permitted once the order moves to the paid state. The order stays in this state even if the payment associated with the order is refunded |
Order Entity
Field | Description |
---|---|
id | string The unique identifier of Order |
amount | string The amount for which the Order was created |
payment_option | string The type of payment option with which order is created. Can be of type full_payment and installment . Default value: full_payment . |
currency | string The currency associated with the Order's amount |
status | string The status of Order |
order_ref_id | string The unique identifier of Order from the merchant |
is_live | boolean Flag denoting if the order has been created in sandbox or live mode |
created_at | integer Indicates the Unix timestamp when this Order was created |
updated_at | integer Indicates the Unix timestamp when this Order was last updated |
customer | object Information about the customer who created the Order |
items | object Information about the products/items created against the Order |
payments | array Array of payment objects against the Order |
expiry_date | integer Indicates the Unix timestamp after which this Order will expire |
metadata | json object Key-Value pair that can be used to store additional information about the entity. e.g. note : Force is with this order |