Make a purchase

Executes a purchase.

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

To preview the purchase before completing it, use the Purchase preview operation.

SecurityHTTP: CustomerJWT or API Key: PublishableApiKey
Request
Request Body schema: application/json
websiteId
required
string <= 50 characters
required
Array of objects non-empty
ContactObject (object) or null

Billing address details.

ContactObject (object) or null

Delivery address details.

shippingRateId
string (ResourceId) <= 50 characters

Unique resource ID.

required
Payment token (object) or Payment instrument (object) or Payment Methods (object) or Payment card (object) or Bank account (object)

Payment instruction for the purchase.

couponIds
Array of strings

List of coupons that are applied to the order.

password
string or null

Customer account password. If this value is set, it is used to create a customer account.

redirectUrl
string or null <uri>

URL to redirect the end-user when an offsite transaction is completed. If website.url is https://example.com, then the redirectUrl can be set to one the following:

  • https://example.com

  • https://example.com/some/path

  • https://example.com/some/path?and=query

  • https://example.com/some/path?and=query#and-fragment

This field defaults to the configured website URL. You may use {id} or {result} as placeholders in the URL. These placeholders are replaced with the transaction ID and result.

poNumber
string or null

Purchase order number that is displayed on the invoice.

post
/storefront/purchase
Request samples
application/json
{ "orderId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21", "websiteId": "web_0YV7DE4Z26DQSA1AC92FBJ7SEG", "items": [ ], "billingAddress": { "firstName": "Benjamin", "lastName": "Franklin", "organization": "Rebilly", "address": "36 Craven St", "address2": "string", "city": "Austin", "region": "Texas", "country": "GB", "postalCode": "WC2N 5NF", "dob": "1980-04-01", "jobTitle": "CEO" }, "deliveryAddress": { "firstName": "Benjamin", "lastName": "Franklin", "organization": "Rebilly", "address": "36 Craven St", "address2": "string", "city": "Austin", "region": "Texas", "country": "GB", "postalCode": "WC2N 5NF", "dob": "1980-04-01", "jobTitle": "CEO" }, "shippingRateId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21", "paymentInstruction": { "token": "string" }, "couponIds": [ "string" ], "password": "string", "redirectUrl": "http://example.com", "poNumber": "PO123456" }
Responses

201

Order created.

401

Unauthorized access. Invalid credentials used.

403

Access forbidden.

422

Invalid data sent.

Response samples
application/json
{ "orderId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21", "invoice": { "id": "in_0YVF9605RKC62BP14NE2R7V2XT", "websiteId": "web_0YV7DE4Z26DQSA1AC92FBJ7SEG", "invoiceNumber": 0, "orderId": "ord_01GYJPRKHBD6ZYHH897QCJMBS4", "subscriptionId": "sub_01HRF27SATGE4Z6PBJE6PD8328", "currency": "USD", "amount": 0.1, "amountDue": 0.1, "subtotalAmount": 0.1, "discountAmount": 0.1, "poNumber": "PO123456", "notes": "string", "autopayScheduledTime": "2019-08-24T14:15:22Z", "autopayRetryNumber": 0, "status": "draft", "delinquentCollectionPeriod": 0, "collectionPeriod": 0, "abandonedTime": "2019-08-24T14:15:22Z", "voidedTime": "2019-08-24T14:15:22Z", "paidTime": "2019-08-24T14:15:22Z", "dueTime": "2019-08-24T14:15:22Z", "issuedTime": "2019-08-24T14:15:22Z", "createdTime": "2019-08-24T14:15:22Z", "updatedTime": "2019-08-24T14:15:22Z", "paymentFormUrl": "string", }, "transaction": { "id": "txn_0YVDTQJ8YWDGQACV2N2N5SPWQ0", "websiteId": "web_0YV7DE4Z26DQSA1AC92FBJ7SEG", "type": "3ds-authentication", "status": "completed", "result": "abandoned", "amount": 0.1, "currency": "USD", "purchaseAmount": 0.1, "purchaseCurrency": "USD", "requestAmount": 0.1, "requestCurrency": "USD", "parentTransactionId": "txn_0YVDTQJ8YWDGQACV2N2N5SPWQ0", "isRebill": true, "rebillNumber": 0, "redirectUrl": "http://example.com", "retryNumber": 0, "isRetry": true, "billingDescriptor": "string", "description": "string", "requestId": "string", "hasAmountAdjustment": true, "gatewayName": "A1Gateway", "processedTime": "2019-08-24T14:15:22Z", "createdTime": "2019-08-24T14:15:22Z", "updatedTime": "2019-08-24T14:15:22Z", "approvalUrl": "http://example.com", "token": "string", "depositRequestId": "dep_req_0YVJ65BSGYC3EAT58SEX8KY6J7", }, "token": "string", "billingAddress": { "firstName": "Benjamin", "lastName": "Franklin", "organization": "Rebilly", "address": "36 Craven St", "address2": "string", "city": "Austin", "region": "Texas", "country": "GB", "postalCode": "WC2N 5NF", "dob": "1980-04-01", "jobTitle": "CEO", "hash": "056ae6d97c788b9e98b049ebafd7b229bf852221" }, "deliveryAddress": { "firstName": "Benjamin", "lastName": "Franklin", "organization": "Rebilly", "address": "36 Craven St", "address2": "string", "city": "Austin", "region": "Texas", "country": "GB", "postalCode": "WC2N 5NF", "dob": "1980-04-01", "jobTitle": "CEO", "hash": "056ae6d97c788b9e98b049ebafd7b229bf852221" }, "shippingRateId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21", "poNumber": "PO123456" }