Order Object
The order object is the payload that contains the details describing the customer's order. It is used to initialize the Backd BNPL Widget.
This table provides a detailed description of the order object structure, format, required fields, and a short description.
*Note: Any field with the format 'Number' can take integers or floats. If integer, it will be converted to float (e.g. 500 ➡️ 500.00)
| Attribute | Format | Required | Description |
|---|---|---|---|
| merchant | Object | ✅ | Contains merchant details. |
| mode | Object | Contains widget mode details (optional). | |
| billing | Object | ✅ | Contains billing details. |
| shipping | Object | Contains shipping details. | |
| items | Array | ✅ | List of items in the order. |
merchant_order_id | String | ✅ | Unique identifier for the order in merchant's system. |
merchant_order_status | String | Status of the order in the merchant's system. | |
cart_amount | Number | ✅ | Total amount in the shopping cart excluding other fees (e.g. tax, shipping and discounts). |
tax_amount | Number | The amount of tax charged for the order. | |
shipping_amount | Number | The amount of shipping charged for the order. | |
discount_amount | Number | The total discount amount applied to the order as positive number. | |
order_total | Number | ✅ | Order total including all applicable amounts. Therefore, order_total= cart_amount + tax_amount + shipping_amount - discount_amount |
The Merchant Object
| Parameter | Format | Required | Description |
|---|---|---|---|
public_api_key | String | ✅ | Public API key for the merchant provided by Backd. |
name | String | ✅ | Customer-facing name of the merchant. |
merchant: {
public_api_key: "518ce188-8295-422c-a4a2-8329ffd40341",
name: "Your Customer-Facing Merchant Name",
}
The Mode Object
For more information on the redirect flow please refer to the redirect flow page.
| Parameter | Format | Required | Description |
|---|---|---|---|
type | String ("modal"/"redirect") | ✅ | Customer flow of interacting with BNPL widget. modal (by default) or redirect for redirect flow. |
order_success_url | String | ✅ | URL that customer is navigated to when completing their order successfully. |
order_close_url | String | ✅ | URL that customer is navigated to when closing widget before completion. |
mode: {
type: "redirect", // or "modal"
order_success_url: "https://merchant.website.com/success", // required for "redirect" - ignored for "modal"
order_close_url: "https://merchant.website.com/cart", // required for "redirect" - ignored for "modal"
}
The Billing & Shipping Objects
| Parameter | Format | Required | Description |
|---|---|---|---|
| name | Object | ✅ | Name object of the customer. |
| address | Object | ✅ | Address details object for customer. |
phone_number | String | ✅ | Phone number of the customer. |
email | String | ✅ | Email address of the customer. |
billing: { // can be replaced with 'shipping'
name: {
first: "Joe",
last: "Doe",
},
address: {
line1: "123 Main St",
line2: "Floor 1",
city: "Austin",
state: "TX",
zipcode: "78704",
country: "USA",
},
phone_number: "4153334567",
email: "joedoe@123fakestreet.com",
}
The Name Object
| Parameter | Format | Required | Description |
|---|---|---|---|
first | String | ✅ | First name of the customer. |
last | String | ✅ | Last name of the customer. |
name: {
first: "Joe",
last: "Doe",
}
The Address Object
| Parameter | Format | Required | Description |
|---|---|---|---|
line1 | String | ✅ | First address line of the customer. |
line2 | String | Second address line of the customer (optional). | |
city | String | ✅ | City of the customer. |
state | String | ✅ | State of the customer. |
zipcode | String | ✅ | Zip code of the customer. |
country | String | ✅ | Country of the customer. |
address: {
line1: "123 Main St",
line2: "Floor 1",
city: "Austin",
state: "TX",
zipcode: "78704",
country: "USA",
}
The Items Object
| Parameter | Format | Required | Description |
|---|---|---|---|
display_name | String | ✅ | Display name of the item. |
sku | String | ✅ | SKU (Stock Keeping Unit) of the item. |
unit_price | Number | ✅ | Unit price of the item in cents. |
qty | Number | ✅ | Quantity of the item ordered. |
item_image_url | String | URL of the item's image (optional). | |
item_url | String | URL of the item's page (optional). |
[
{
display_name: "MacBook Pro",
sku: "ABC-123",
unit_price: 3000,
qty: 3,
item_image_url: "http://merchant.website.com/images/macbook-pro.jpg",
item_url: "http://merchant.website.com/products/macbook-pro.html",
},
];