Skip to main content

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)

AttributeFormatRequiredDescription
merchantObjectContains merchant details.
modeObjectContains widget mode details (optional).
billingObjectContains billing details.
shippingObjectContains shipping details.
itemsArrayList of items in the order.
merchant_order_idStringUnique identifier for the order in merchant's system.
merchant_order_statusStringStatus of the order in the merchant's system.
cart_amountNumberTotal amount in the shopping cart excluding other fees (e.g. tax, shipping and discounts).
tax_amountNumberThe amount of tax charged for the order.
shipping_amountNumberThe amount of shipping charged for the order.
discount_amountNumberThe total discount amount applied to the order as positive number.
order_totalNumberOrder total including all applicable amounts. Therefore, order_total= cart_amount + tax_amount + shipping_amount - discount_amount

The Merchant Object

ParameterFormatRequiredDescription
public_api_keyStringPublic API key for the merchant provided by Backd.
nameStringCustomer-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.

ParameterFormatRequiredDescription
typeString ("modal"/"redirect")Customer flow of interacting with BNPL widget. modal (by default) or redirect for redirect flow.
order_success_urlStringURL that customer is navigated to when completing their order successfully.
order_close_urlStringURL 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

ParameterFormatRequiredDescription
nameObjectName object of the customer.
addressObjectAddress details object for customer.
phone_numberStringPhone number of the customer.
emailStringEmail 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

ParameterFormatRequiredDescription
firstStringFirst name of the customer.
lastStringLast name of the customer.
  name: {
first: "Joe",
last: "Doe",
}

The Address Object

ParameterFormatRequiredDescription
line1StringFirst address line of the customer.
line2StringSecond address line of the customer (optional).
cityStringCity of the customer.
stateStringState of the customer.
zipcodeStringZip code of the customer.
countryStringCountry of the customer.
  address: {
line1: "123 Main St",
line2: "Floor 1",
city: "Austin",
state: "TX",
zipcode: "78704",
country: "USA",
}

The Items Object

ParameterFormatRequiredDescription
display_nameStringDisplay name of the item.
skuStringSKU (Stock Keeping Unit) of the item.
unit_priceNumberUnit price of the item in cents.
qtyNumberQuantity of the item ordered.
item_image_urlStringURL of the item's image (optional).
item_urlStringURL 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",
},
];