Preview a purchase

Previews a purchase.

Use this operation to preview a purchase before completing it.

A purchase can be completed both with and without authentication. Purchases that use a pre-created payment instrument must use authentication.

Warning: The shipping aspect of this API is experimental and may change to support multiple shipping methods.

SecurityCustomerJWT or PublishableApiKey
Request
Request Body schema: application/json
websiteId
required
string <= 50 characters

ID of the website. A website is where an organization obtains a customer. For more information, see Obtain an organization ID and website ID.

required
Array of objects non-empty

Items details.

Array (non-empty)
planId
required
string <= 50 characters

ID of the plan.

quantity
integer

Number of product units in the specified plan.

object or null

Billing address details.

firstName
string or null <= 45 characters ^[\w\s\-\p{L},.']+$

Contact's first name.

lastName
string or null <= 45 characters ^[\w\s\-\p{L},.']+$

Contact's last name.

organization
string or null <= 255 characters ^[\w\s\-\p{L},.'&]+$

Contact's organization.

address
string or null <= 60 characters ^[\w\s\-\/\p{L},.#;:()'&]+$

First line of the contact's street address.

address2
string or null <= 60 characters ^[\w\s\-\/\p{L},.#;:()'&]+$

Second line of the contact's street address.

city
string or null <= 45 characters ^[\w\s\-\p{L},.']+$

Contact's city of residence.

region
string or null <= 45 characters ^[\w\s\-\/\p{L},.#;:()']+$

Contact's region of residence.

country
string or null <= 2 characters ^[A-Z]{2}$

Contact's country of residence in ISO 3166 alpha-2 country code. For examples, see ISO.org.

postalCode
string or null <= 10 characters ^[\w\s\-]+$

Contact's postal code.

Array of objects (ContactPhoneNumbers)

List of phone numbers associated with the contact.

Array
label
required
string <= 45 characters

Phone number label or name.

value
required
string <= 50 characters

Phone number value.

primary
boolean

Specifies if the phone number is the contact's primary phone number.

Array of objects (ContactEmails)

List of email addresses associated with the contact.

Array
label
required
string <= 45 characters

Email label or name.

value
required
string <email> <= 255 characters

Email address value.

primary
boolean

Specifies if the email address is the contact's primary email address.

dob
string or null <date>

Contact's date of birth in ISO-8601 YYYY-MM-DD format.

jobTitle
string or null <= 255 characters ^[\w\s\-\/\p{L},.#;:()']+$

Contact's job title.

object or null

Delivery address details.

firstName
string or null <= 45 characters ^[\w\s\-\p{L},.']+$

Contact's first name.

lastName
string or null <= 45 characters ^[\w\s\-\p{L},.']+$

Contact's last name.

organization
string or null <= 255 characters ^[\w\s\-\p{L},.'&]+$

Contact's organization.

address
string or null <= 60 characters ^[\w\s\-\/\p{L},.#;:()'&]+$

First line of the contact's street address.

address2
string or null <= 60 characters ^[\w\s\-\/\p{L},.#;:()'&]+$

Second line of the contact's street address.

city
string or null <= 45 characters ^[\w\s\-\p{L},.']+$

Contact's city of residence.

region
string or null <= 45 characters ^[\w\s\-\/\p{L},.#;:()']+$

Contact's region of residence.

country
string or null <= 2 characters ^[A-Z]{2}$

Contact's country of residence in ISO 3166 alpha-2 country code. For examples, see ISO.org.

postalCode
string or null <= 10 characters ^[\w\s\-]+$

Contact's postal code.

Array of objects (ContactPhoneNumbers)

List of phone numbers associated with the contact.

Array
label
required
string <= 45 characters

Phone number label or name.

value
required
string <= 50 characters

Phone number value.

primary
boolean

Specifies if the phone number is the contact's primary phone number.

Array of objects (ContactEmails)

List of email addresses associated with the contact.

Array
label
required
string <= 45 characters

Email label or name.

value
required
string <email> <= 255 characters

Email address value.

primary
boolean

Specifies if the email address is the contact's primary email address.

dob
string or null <date>

Contact's date of birth in ISO-8601 YYYY-MM-DD format.

jobTitle
string or null <= 255 characters ^[\w\s\-\/\p{L},.#;:()']+$

Contact's job title.

couponIds
Array of strings

List of coupons that are applied to the order.

shippingRateId
string <= 50 characters

ID of the shipping rate. If unset the cheapest applicable shipping rate is chosen.

Responses
200

Purchase preview retrieved.

Response Schema: application/json
currency
string = 3 characters

Currency code in ISO 4217 format.

Array of objects

List of purchase items.

Array
type
string

Type of transaction.

Enum: "debit" "credit"
description
string

Description of the purchase item.

unitPrice
number <double>

Unit price of the purchase item.

quantity
number <integer>

Total quantity of the purchase item.

price
number <double>

Total cost of the purchase item.

planId
string <= 50 characters

ID of the related plan.

productId
string <= 50 characters

ID of the related product.

Array of objects (ShippingOption)

Available shipping rates.

Array
name
required
string

Name of the shipping rate.

price
required
number <double>

Price of the shipping rate. If price is 0, shipping is free.

currency
required
string = 3 characters

Currency code in ISO 4217 format.

id
string <= 50 characters

ID of the shipping rate.

descriptions
string

Description of the shipping rate.

Array of objects

Taxes applied to the purchase.

Array
amount
number <double>

Amount of tax that is due.

description
string

Description of the tax.

Array of objects

Discounts applied to the purchase.

Array
couponId
string <= 50 characters

ID of a coupon that is associated with the purchase.

amount
number

Total amount of discount from the coupon.

description
string

Description of the discount.

subtotalAmount
number <double>

Subtotal amount of the purchase.

taxAmount
number <double>

Tax amount of the purchase.

shippingAmount
number <double>

Shipping amount of the purchase.

discountsAmount
number <double>

Total discount amount of the purchase.

total
number <double>

Total amount of the purchase.

401

Unauthorized access. Invalid credentials used.

403

Access forbidden.

422

Invalid data sent.

post/storefront/preview-purchase
Request samples
application/json
{
  • "websiteId": "web_0YV7DE4Z26DQSA1AC92FBJ7SEG",
  • "items": [
    ],
  • "billingAddress": {
    },
  • "deliveryAddress": {
    },
  • "couponIds": [
    ],
  • "shippingRateId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21"
}
Response samples
application/json
{
  • "currency": "USD",
  • "lineItems": [
    ],
  • "shippingRates": [
    ],
  • "taxes": [
    ],
  • "discounts": [
    ],
  • "subtotalAmount": 0,
  • "taxAmount": 0,
  • "shippingAmount": 0,
  • "discountsAmount": 0,
  • "total": 0
}