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.
ID of the website. A website is where an organization obtains a customer. For more information, see Obtain an organization ID and website ID.
ID of the shipping rate. If this value is not set, the cheapest applicable shipping rate is chosen.
Payment instruction for the purchase.
Customer account password. If this value is set, it is used to create a customer account.
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.comhttps://example.com/some/pathhttps://example.com/some/path?and=queryhttps://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.
- Mock serverhttps://www.rebilly.com/_mock/catalog/all/storefront/purchase
- Sandbox serverhttps://api-sandbox.rebilly.com/organizations/{organizationId}/storefront/purchase
- Live serverhttps://api.rebilly.com/organizations/{organizationId}/storefront/purchase
curl -i -X POST \
https://www.rebilly.com/_mock/catalog/all/storefront/purchase \
-H 'Authorization: Bearer <YOUR_JWT_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"orderId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
"websiteId": "web_0YV7DE4Z26DQSA1AC92FBJ7SEG",
"items": [
{
"planId": "plan_0YV7DENSVGDBW9S71XZNNYYQ0X",
"quantity": 0
}
],
"billingAddress": {
"firstName": "Benjamin",
"lastName": "Franklin",
"organization": "Rebilly",
"address": "36 Craven St",
"address2": "string",
"city": "Austin",
"region": "Texas",
"country": "GB",
"postalCode": "WC2N 5NF",
"phoneNumbers": [
{
"label": "main",
"value": "1-512-777-0269",
"primary": true
}
],
"emails": [
{
"label": "main",
"value": "rebilly@example.com",
"primary": true
}
],
"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",
"phoneNumbers": [
{
"label": "main",
"value": "1-512-777-0269",
"primary": true
}
],
"emails": [
{
"label": "main",
"value": "rebilly@example.com",
"primary": true
}
],
"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",
"customFields": {
"customers": {
"foo": "bar"
},
"subscriptions": {
"foo": "bar"
},
"transactions": {
"foo": "bar"
}
}
}'Order created.
Total number of rate limit tokens for this request within a rate limit period. For more information, see Rate limits.
ID of the order.
Session token that is used for authentication. This token can be used to view the created order, invoice, and transaction.
{ "orderId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21", "invoice": { "id": "in_0YVF9605RKC62BP14NE2R7V2XT", "websiteId": "web_0YV7DE4Z26DQSA1AC92FBJ7SEG", "invoiceNumber": 0, "orderId": "ord_01HVKA5975PJBSQ1SX72G3MSZC", "subscriptionId": "sub_01HRF27SATGE4Z6PBJE6PD8328", "currency": "USD", "amount": 0.1, "amountDue": 0.1, "subtotalAmount": 0.1, "discountAmount": 0.1, "shipping": { … }, "tax": { … }, "billingAddress": { … }, "deliveryAddress": { … }, "poNumber": "PO123456", "notes": "string", "items": [ … ], "discounts": [ … ], "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": "http://example.com", "transactions": [ … ], "_links": [ … ] }, "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", "childTransactions": [ … ], "invoiceIds": [ … ], "orderIds": [ … ], "planIds": [ … ], "isRebill": true, "rebillNumber": 0, "billingAddress": { … }, "redirectUrl": "http://example.com", "retryNumber": 0, "isRetry": true, "billingDescriptor": "string", "description": "string", "requestId": "string", "hasAmountAdjustment": true, "gatewayName": "A1Gateway", "gateway": { … }, "customFields": { … }, "processedTime": "2019-08-24T14:15:22Z", "createdTime": "2019-08-24T14:15:22Z", "updatedTime": "2019-08-24T14:15:22Z", "paymentInstrument": { … }, "approvalUrl": "http://example.com", "hasDcc": true, "dcc": { … }, "token": "string", "depositRequestId": "dep_req_0YVJ65BSGYC3EAT58SEX8KY6J7", "_links": [ … ] }, "token": "string", "billingAddress": { "firstName": "Benjamin", "lastName": "Franklin", "organization": "Rebilly", "address": "36 Craven St", "address2": "string", "city": "Austin", "region": "Texas", "country": "GB", "postalCode": "WC2N 5NF", "phoneNumbers": [ … ], "emails": [ … ], "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", "phoneNumbers": [ … ], "emails": [ … ], "dob": "1980-04-01", "jobTitle": "CEO", "hash": "056ae6d97c788b9e98b049ebafd7b229bf852221" }, "shippingRateId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21", "poNumber": "PO123456" }