Documentation
Feedback
Guides

Creating a regular order with the Checkout API

Learn how to use VTEX APIs to efficiently handle the placement, payment, and delivery aspects of a regular order.

This step-by-step guide will walk you through the process of using the Checkout API for handling the placement, payment, and delivery aspects of a regular order, with all responsibilities managed within the scope of a single account. This process is divided into the following steps:

  1. Assess cart requirements: The process begins with the simulation of a cart to assess available delivery and payment options. Additionally, since indicating an email address is necessary to place an order, this step also includes verifying if the provided email is already associated with an existing customer.
  2. Assemble the cart: After assessing the cart requirements, the next step is to assemble the cart, ensuring that all essential order information is organized according to the orderForm data structure.
  3. Handle the order: This step involves placing the order on the VTEX platform and sending the necessary payment data to resolve the order payment.
  4. Process and validate the order: The process ends by processing order details and conducting a verification procedure to confirm the successful placement of the order.

Before you begin

Before proceeding any further, ensure that you have a valid appKey and appToken granted with the necessary permissions to access the Checkout and Payments Gateway APIs. For more information, please refer to the Roles article.

Click the steps below to navigate through this article and explore specific topics. Relevant code will be highlighted and focused for your convenience on the right side of the screen.

Step 1 - Assessing cart requirements

In this step, we will verify if your store can fulfill the cart requirements and gather essential order information to ensure a smooth order placement process in the subsequent steps.

Simulating a cart

This step provides essential information regarding the available delivery and payment options for the specific combination of items in the cart.

  • Send a request to the Cart simulation API endpoint. Specify the SKU ID (items.id), the number of items in the cart (items.quantity), the Seller's ID (items.seller), and the shipping address country (country) in the request body. Also, provide the shipping address's postal code (postalCode) or the geo-coordinates (geoCoordinates).
  • Take note of the items, shippingData.logisticsInfo, and paymentData objects, as we will use this data in the following steps.
Shell
Python
Node.js

_10
curl --request post \
_10
--url 'https://{accountName}.{environment}.com.br/api/checkout/pub/orderForms/simulation?RnbBehavior=0' \
_10
--header 'Accept: application/json' \
_10
--header 'Content-Type: application/json' \
_10
--header 'X-VTEX-API-AppKey: {appKey}' \
_10
--header 'X-VTEX-API-AppToken: {appToken}' \
_10
--data '{"items":[{"id":"1","quantity":1,"seller":"1"}],"country":"BRA","postalCode":"12345-000","geoCoordinates":[-47.924747467041016]}'

Response

_32
{
_32
"allowManualPrice": boolean,
_32
"canEditData": boolean,
_32
"clientPreferencesData": {},
_32
"clientProfileData": {},
_32
"commercialConditionData": {},
_32
"customData": {},
_32
"giftRegistryData": {},
_32
"hooksData": {},
_32
"ignoreProfileData": boolean,
_32
"isCheckedIn": boolean,
_32
"itemMetadata": {},
_32
"items": [],
_32
"itemsOrdination": {},
_32
"loggedIn": boolean,
_32
"marketingData": {},
_32
"messages": [],
_32
"openTextField": {},
_32
"orderFormId": string,
_32
"paymentData": {},
_32
"ratesAndBenefitsData": {},
_32
"salesChannel": string,
_32
"selectableGifts": [],
_32
"sellers": {},
_32
"shippingData": {},
_32
"storeId": {},
_32
"storePreferencesData": {},
_32
"totalizers": {},
_32
"userProfileId": {},
_32
"userType": {},
_32
"value": number
_32
}

Checking for existing customer

Now, we will verify whether the email that will be used to place the order is already related to a customer in your database. This verification serves to not only enhance operational efficiency but also proactively prevent potential permission-related issues.

  • Send a request to the Get client by email endpoint to check for existing profiles associated with a specific email address. If the response to this request returns any content, it means the shopper’s information is in your database. In such cases, you can proceed using this data in subsequent steps, sparing the shopper from the need to provide their email again.
  • If applicable, take note of the availableAddresses and userProfile objects, as we will use this data in the following steps.
Shell
Python
Node.js

_10
curl --request get \
_10
--url 'https://{accountName}.{environment}.com.br/api/checkout/pub/profiles?email={emailAddress}' \
_10
--header 'Accept: application/json' \
_10
--header 'Content-Type: application/json' \
_10
--header 'X-VTEX-API-AppKey: {appKey}' \
_10
--header 'X-VTEX-API-AppToken: {appToken}'

Response

_41
{
_41
"userProfileId": string,
_41
"profileProvider": string,
_41
"availableAccounts": [],
_41
"availableAddresses": [
_41
{
_41
"addressType": string,
_41
"receiverName": string,
_41
"addressId": string,
_41
"isDisposable": boolean,
_41
"postalCode": string,
_41
"city": string,
_41
"state": string,
_41
"country": string,
_41
"street": string,
_41
"number": string,
_41
"neighborhood": string,
_41
"complement": null,
_41
"reference": null,
_41
"geoCoordinates": []
_41
}
_41
],
_41
"userProfile": {
_41
"email": string,
_41
"firstName": string,
_41
"lastName": string,
_41
"document": string,
_41
"documentType": string,
_41
"phone": string,
_41
"corporateName": null,
_41
"tradeName": null,
_41
"corporateDocument": null,
_41
"stateInscription": null,
_41
"corporatePhone": null,
_41
"isCorporate": boolean,
_41
"profileCompleteOnLoading": null,
_41
"profileErrorOnLoading": null,
_41
"customerClass": null
_41
},
_41
"isComplete": boolean
_41
}

Step 2 - Assembling the cart

In this step, we will arrange the order details into the specified data format, following the orderForm data structure. This formatted cart data will be used as the request body in the following steps.

Below, we will briefly examine the key elements that make up the orderForm, which include:

  • items
  • clientProfileData
  • shippingData.address
  • shippingData.logisticsInfo
  • paymentData

Note that while an orderForm can have multiple elements, a standard order typically consists of the ones mentioned above.

orderForm.json

_32
{
_32
"allowManualPrice": boolean,
_32
"canEditData": boolean,
_32
"clientPreferencesData": {},
_32
"clientProfileData": {},
_32
"commercialConditionData": {},
_32
"customData": {},
_32
"giftRegistryData": {},
_32
"hooksData": {},
_32
"ignoreProfileData": boolean,
_32
"isCheckedIn": boolean,
_32
"itemMetadata": {},
_32
"items": {},
_32
"itemsOrdination": {},
_32
"loggedIn": boolean,
_32
"marketingData": {},
_32
"messages": [],
_32
"openTextField": {},
_32
"orderFormId": string,
_32
"paymentData": {},
_32
"ratesAndBenefitsData": {},
_32
"salesChannel": "1",
_32
"selectableGifts": {},
_32
"sellers": {},
_32
"shippingData": {},
_32
"storeId": {},
_32
"storePreferencesData": {},
_32
"totalizers": {},
_32
"userProfileId": {},
_32
"userType": {},
_32
"value": number
_32
}

items

items is an array that contains all data pertinent to the SKUs being purchased. Build the items array using the items array obtained from the Simulating a cart step. For more complex examples, see the Place order API reference.

orderForm.json

_16
{
_16
"items": [
_16
{
_16
"id": "1",
_16
"quantity": 1,
_16
"seller": "1",
_16
"price": 10000
_16
}
_16
],
_16
"clientProfileData": {},
_16
"shippingData": {
_16
"address": {},
_16
"logisticsInfo": []
_16
},
_16
"paymentData": {}
_16
}

clientProfileData: New customers

clientProfileData is an object that contains information about the customer. If you noted the customer does not exist in your database during the Checking for existing customer step, build the clientProfileData object with the data of the new customer willing to place the order.

orderForm.json

_22
{
_22
"items": [],
_22
"clientProfileData": {
_22
"email": "email@domain.com",
_22
"firstName": "First name",
_22
"lastName": "Last name",
_22
"document": "078051120",
_22
"documentType": "ssn",
_22
"phone": "1234567890",
_22
"corporateName": null,
_22
"tradeName": null,
_22
"corporateDocument": null,
_22
"stateInscription": null,
_22
"corporatePhone": null,
_22
"isCorporate": false
_22
},
_22
"shippingData": {
_22
"address": {},
_22
"logisticsInfo": []
_22
},
_22
"paymentData": {}
_22
}

clientProfileData: Existing customers

If the customer already exists in your database, use the userProfile.email obtained in the Checking for existing customer step to build the clientProfileData object. The email address is enough to register the order to the shopper’s existing account.

orderForm.json

_11
{
_11
"items": [],
_11
"clientProfileData": {
_11
"email": "email@domain.com"
_11
},
_11
"shippingData": {
_11
"address": {},
_11
"logisticsInfo": []
_11
},
_11
"paymentData": {}
_11
}

shippingData.address: New customers

shippingData.address is an object that contains information about the shipping address. If you noted the customer does not exist in your database during the Checking for existing customer step, build the shippingData.address object with the data of the new customer willing to place the order.

orderForm.json

_21
{
_21
"items": [],
_21
"clientProfileData": {},
_21
"shippingData": {
_21
"address": {
_21
"addressType": "residential",
_21
"receiverName": "Testing VTEX",
_21
"postalCode": "33301",
_21
"city": "Fort Lauderdale",
_21
"state": "FL",
_21
"country": "USA",
_21
"street": "110 East Broward Blvd",
_21
"number": null,
_21
"neighborhood": null,
_21
"complement": "Suite 1700",
_21
"reference": null,
_21
"geoCoordinates": []
_21
}
_21
},
_21
"paymentData": {}
_21
}

shippingData.address: Existing customers

If the customer already exists in your database, use the desired availableAddresses[i].addressId obtained from the Checking for existing customer step to build the shippingData.address block.

orderForm.json

_10
{
_10
"items": [],
_10
"clientProfileData": {},
_10
"shippingAddress": {
_10
"address": {
_10
"addressId": "666c2e830bd9474ab6f6cc53fb6dd2d2"
_10
}
_10
},
_10
"paymentData": {}
_10
}

shippingData.logisticsInfo

logisticsInfo is an array that contains logistics information, such as the desired delivery option and freight cost for each item in the items array.

  • Create the logisticsInfo array with the same number of objects as in the items array. For each object within the logisticsInfo array, define the following elements:

    • itemIndex - index of the corresponding item in the items array. For example, the object referring to the first item in the items array has an itemIndex of 0.
    • selectedSla - desired delivery option. You can find the id value of the available options in the slas array obtained from the Simulating a cart step.
    • price - price of the item. You can retrieve this value from the Simulating a cart step.
    • (Optional) If the delivery method is pickup point, add the information "selectedDeliveryChannel": "pickup-in-point".
orderForm.json

_16
{
_16
"items": [],
_16
"clientProfileData": {},
_16
"shippingData": {
_16
"address": {},
_16
"logisticsInfo": [
_16
{
_16
"itemIndex": 0,
_16
"selectedSla": "Regular",
_16
"price": 100,
_16
"selectedDeliveryChannel": "pickup-in-point"
_16
}
_16
]
_16
},
_16
"paymentData": {}
_16
}

paymentData.payments

paymentData.payments is an array that contains information regarding the chosen payment method and installment preferences for the order. Build the paymentData.payments array considering the response obtained from the Simulating a cart step. For each payment option, define the following elements:

  • paymentSystem - ID of the desired payment system.
  • referenceValue - reference value used to calculate interest rates. If no interest applies to the order, the value and referenceValue should be the same.
  • value - total amount to be paid by the shopper.
  • installments - number of installments.

For more complex examples, see the Place order API reference.

orderForm.json

_18
{
_18
"items": [],
_18
"clientProfileData": {},
_18
"shippingData": {
_18
"address": {},
_18
"logisticsInfo": []
_18
},
_18
"paymentData": {
_18
"payments": [
_18
{
_18
"paymentSystem": "1",
_18
"referenceValue": 10100,
_18
"value": 10100,
_18
"installments": 1
_18
}
_18
]
_18
}
_18
}

Step 3 - Handling the order

In this step, we will use the orderForm we built in the previous steps to place an order on the VTEX platform.

Reviewing the orderForm of a new customer

After building the orderForm for your order, ensure it adheres to a valid JSON format. For new customers, your orderForm should resemble this structure.

orderForm.json

_57
{
_57
"items": [
_57
{
_57
"id": "1",
_57
"quantity": 1,
_57
"seller": "1",
_57
"price": 10000
_57
}
_57
],
_57
"clientProfileData": {
_57
"email": "email@domain.com",
_57
"firstName": "Testing",
_57
"lastName": "VTEX",
_57
"document": "078051120",
_57
"documentType": "ssn",
_57
"phone": "1234567890",
_57
"corporateName": null,
_57
"tradeName": null,
_57
"corporateDocument": null,
_57
"stateInscription": null,
_57
"corporatePhone": null,
_57
"isCorporate": false
_57
},
_57
"shippingData": {
_57
"address": {
_57
"addressType": "residential",
_57
"receiverName": "Testing VTEX",
_57
"postalCode": "33301",
_57
"city": "Fort Lauderdale",
_57
"state": "FL",
_57
"country": "USA",
_57
"street": "110 East Broward Blvd",
_57
"number": null,
_57
"neighborhood": null,
_57
"complement": "Suite 1700",
_57
"reference": null,
_57
"geoCoordinates": []
_57
},
_57
"logisticsInfo": [
_57
{
_57
"itemIndex": 0,
_57
"selectedSla": "Regular",
_57
"price": 100
_57
}
_57
]
_57
},
_57
"paymentData": {
_57
"payments": [
_57
{
_57
"paymentSystem": "1",
_57
"referenceValue": 10100,
_57
"value": 10100,
_57
"installments": 1
_57
}
_57
]
_57
}
_57
}

Reviewing the orderForm of an existing customer

For returning customers, the orderForm for your order should resemble this structure.

orderForm.json

_35
{
_35
"items": [
_35
{
_35
"id": "1",
_35
"quantity": 1,
_35
"seller": "1",
_35
"price": 10000
_35
}
_35
],
_35
"clientProfileData": {
_35
"email": "email@domain.com"
_35
},
_35
"shippingData": {
_35
"address": {
_35
"addressId": "666c2e830bd9474ab6f6cc53fb6dd2d2"
_35
},
_35
"logisticsInfo": [
_35
{
_35
"itemIndex": 0,
_35
"selectedSla": "Regular",
_35
"price": 100
_35
}
_35
]
_35
},
_35
"paymentData": {
_35
"payments": [
_35
{
_35
"paymentSystem": "1",
_35
"referenceValue": 10100,
_35
"value": 10100,
_35
"installments": 1
_35
}
_35
]
_35
}
_35
}

Placing the order

Send a request to the Place order endpoint using the orderForm you built as the request body.

Upon receiving a 201 Created response, take note of these four pieces of information:

  • orderId - ID of the order within VTEX’s Order Management System (OMS). You can find the orderId within each object in the orders array.
  • transactionId - ID of the transaction, which can be found within the objects contained in the transactionData.merchantTransactions array.
  • addressId - ID of the customer address. If you plan to use the same address for both shipping and billing, get the addressId from the orders[].shippingData.address object.
  • Vtex_CHKO_Auth - authentication cookie provided in the response.

If you are using an email from an existing customer, ensure that the corresponding customer account is logged into your store. Otherwise, the process will fail.

Shell
Python
Node.js

_10
curl --request put \
_10
--url 'https://{accountName}.{environment}.com.br/api/checkout/pub/orders' \
_10
--header 'Accept: application/json' \
_10
--header 'Content-Type: application/json' \
_10
--header 'X-VTEX-API-AppKey: {appKey}' \
_10
--header 'X-VTEX-API-AppToken: {appToken}' \
_10
--data '{orderForm}'

Response

_65
{
_65
"orderForm": null,
_65
"transactionData": {
_65
"merchantTransactions": [
_65
{
_65
"id": string,
_65
"transactionId": string,
_65
"merchantName": string,
_65
"payments": [],
_65
"transactionId": string,
_65
}
_65
],
_65
"receiverUri": string,
_65
"gatewayCallbackTemplatePath": string
_65
},
_65
"orders": [
_65
{
_65
"orderId": string,
_65
"orderGroup": string,
_65
"state": null,
_65
"isCheckedIn": boolean,
_65
"sellerOrderId": string,
_65
"storeId": null,
_65
"checkedInPickupPointId": null,
_65
"value": number,
_65
"items": [],
_65
"shippingData": {
_65
"address": {
_65
"addressId": string
_65
}
_65
},
_65
"paymentData": {},
_65
"clientPreferencesData": null,
_65
"commercialConditionData": null,
_65
"giftRegistryData": null,
_65
"marketingData": null,
_65
"storePreferencesData": {},
_65
"openTextField": {},
_65
"invoiceData": null,
_65
"itemMetadata": {},
_65
"taxData": null,
_65
"customData": null,
_65
"hooksData": null,
_65
"changeData": null,
_65
"subscriptionData": null,
_65
"salesChannel": string,
_65
"followUpEmail": string,
_65
"creationDate": string,
_65
"lastChange": string,
_65
"timeZoneCreationDate": string,
_65
"timeZoneLastChange": string,
_65
"isCompleted": boolean,
_65
"hostName": string,
_65
"merchantName": null,
_65
"userType": string,
_65
"roundingError": number,
_65
"allowEdition": boolean,
_65
"allowCancellation": boolean,
_65
"isUserDataVisible": boolean,
_65
"allowChangeSeller": boolean,
_65
"orderFormCreationDate": string,
_65
}
_65
],
_65
"salesAssociateData": {}
_65
}

Resolving the order payment

In this step, we will communicate the necessary payment data to VTEX for the finalization of the order's payment.

Starting from the moment the order is placed, you have a window of five minutes to complete the payment process. Failure to do so will result in automatic cancellation, and the order will be labeled as "incomplete."

  • Send a request to the Send payments information public endpoint, considering the following:

    • Use the orderId value obtained in the previous step as the orderId query-string parameter.
    • Use the transactionId value obtained in the previous step as a path parameter.
    • Ensure that the request body is based on the paymentData section of your orderForm.
    • In the fields object, use the addressId field to reference an existing address or introduce a new address object for an entirely new address.

If you intend to send saved credit card data, you can use the Send payments with saved credit card endpoint instead.

Shell
Python
Node.js

_10
curl --request post \
_10
--url 'https://{accountName}.vtexpayments.com.br/api/pub/transactions/{transactionId}/payments?orderId={orderId}' \
_10
--header 'Accept: application/json' \
_10
--header 'Content-Type: application/json' \
_10
--header 'X-VTEX-API-AppKey: {appKey}' \
_10
--header 'X-VTEX-API-AppToken: {appToken}' \
_10
--data '[{"paymentSystem":4,"installments":1,"currencyCode":"BRL","value":100,"installmentsInterestRate":0,"installmentsValue":100,"referenceValue":100,"fields":{"holderName":"UserTest","cardNumber":"5378244888889174","validationCode":"231","dueDate":"10/19","document":"8041734561","accountId":"","address":null,"callbackUrl":""},"transaction":{"id":"{{transactionId}}","merchantName":"{{accountName}}"}}]'

Response

_10
200 OK

Step 4 - Processing and validating the order

In this final step, we will process the order.

  • Send a request to the Process order endpoint. If the payment is processed without any issues, the order should be successfully placed. Otherwise, a status 500 error might occur.

Note that this process uses the gateway connectors configured in your VTEX environment. Be careful to prevent any unwanted charges or unexpected payment denials.

Shell
Python
Node.js

_10
curl --request post \
_10
--url 'https://{accountName}.{environment}.com.br/api/checkout/pub/gatewayCallback/{orderGroup}' \
_10
--header 'Accept: application/json' \
_10
--header 'Content-Type: application/json' \
_10
--header 'Cookie: {cookie}' \
_10
--header 'X-VTEX-API-AppKey: {appKey}' \
_10
--header 'X-VTEX-API-AppToken: {appToken}'

Response

_10
200 OK

Verifying the order placement

Finally, you can confirm if your order was correctly placed by checking the Order management in VTEX Admin. Alternatively, you can use the Get order and List orders endpoints for this purpose.

Shell
Python
Node.js

_10
curl --request get \
_10
--url 'https://{accountName}.vtexcommercestable.com.br/api/oms/pvt/orders/{orderId}' \
_10
--header 'Accept: application/json' \
_10
--header 'Content-Type: application/json' \
_10
--header 'X-VTEX-API-AppKey: {appKey}' \
_10
--header 'X-VTEX-API-AppToken: {appToken}'

Response

_10
200 OK

Step 1 - Assessing cart requirements

In this step, we will verify if your store can fulfill the cart requirements and gather essential order information to ensure a smooth order placement process in the subsequent steps.

Simulating a cart

This step provides essential information regarding the available delivery and payment options for the specific combination of items in the cart.

  • Send a request to the Cart simulation API endpoint. Specify the SKU ID (items.id), the number of items in the cart (items.quantity), the Seller's ID (items.seller), and the shipping address country (country) in the request body. Also, provide the shipping address's postal code (postalCode) or the geo-coordinates (geoCoordinates).
  • Take note of the items, shippingData.logisticsInfo, and paymentData objects, as we will use this data in the following steps.

Checking for existing customer

Now, we will verify whether the email that will be used to place the order is already related to a customer in your database. This verification serves to not only enhance operational efficiency but also proactively prevent potential permission-related issues.

  • Send a request to the Get client by email endpoint to check for existing profiles associated with a specific email address. If the response to this request returns any content, it means the shopper’s information is in your database. In such cases, you can proceed using this data in subsequent steps, sparing the shopper from the need to provide their email again.
  • If applicable, take note of the availableAddresses and userProfile objects, as we will use this data in the following steps.

Step 2 - Assembling the cart

In this step, we will arrange the order details into the specified data format, following the orderForm data structure. This formatted cart data will be used as the request body in the following steps.

Below, we will briefly examine the key elements that make up the orderForm, which include:

  • items
  • clientProfileData
  • shippingData.address
  • shippingData.logisticsInfo
  • paymentData

Note that while an orderForm can have multiple elements, a standard order typically consists of the ones mentioned above.

items

items is an array that contains all data pertinent to the SKUs being purchased. Build the items array using the items array obtained from the Simulating a cart step. For more complex examples, see the Place order API reference.

clientProfileData: New customers

clientProfileData is an object that contains information about the customer. If you noted the customer does not exist in your database during the Checking for existing customer step, build the clientProfileData object with the data of the new customer willing to place the order.

clientProfileData: Existing customers

If the customer already exists in your database, use the userProfile.email obtained in the Checking for existing customer step to build the clientProfileData object. The email address is enough to register the order to the shopper’s existing account.

shippingData.address: New customers

shippingData.address is an object that contains information about the shipping address. If you noted the customer does not exist in your database during the Checking for existing customer step, build the shippingData.address object with the data of the new customer willing to place the order.

shippingData.address: Existing customers

If the customer already exists in your database, use the desired availableAddresses[i].addressId obtained from the Checking for existing customer step to build the shippingData.address block.

shippingData.logisticsInfo

logisticsInfo is an array that contains logistics information, such as the desired delivery option and freight cost for each item in the items array.

  • Create the logisticsInfo array with the same number of objects as in the items array. For each object within the logisticsInfo array, define the following elements:

    • itemIndex - index of the corresponding item in the items array. For example, the object referring to the first item in the items array has an itemIndex of 0.
    • selectedSla - desired delivery option. You can find the id value of the available options in the slas array obtained from the Simulating a cart step.
    • price - price of the item. You can retrieve this value from the Simulating a cart step.
    • (Optional) If the delivery method is pickup point, add the information "selectedDeliveryChannel": "pickup-in-point".

paymentData.payments

paymentData.payments is an array that contains information regarding the chosen payment method and installment preferences for the order. Build the paymentData.payments array considering the response obtained from the Simulating a cart step. For each payment option, define the following elements:

  • paymentSystem - ID of the desired payment system.
  • referenceValue - reference value used to calculate interest rates. If no interest applies to the order, the value and referenceValue should be the same.
  • value - total amount to be paid by the shopper.
  • installments - number of installments.

For more complex examples, see the Place order API reference.

Step 3 - Handling the order

In this step, we will use the orderForm we built in the previous steps to place an order on the VTEX platform.

Reviewing the orderForm of a new customer

After building the orderForm for your order, ensure it adheres to a valid JSON format. For new customers, your orderForm should resemble this structure.

Reviewing the orderForm of an existing customer

For returning customers, the orderForm for your order should resemble this structure.

Placing the order

Send a request to the Place order endpoint using the orderForm you built as the request body.

Upon receiving a 201 Created response, take note of these four pieces of information:

  • orderId - ID of the order within VTEX’s Order Management System (OMS). You can find the orderId within each object in the orders array.
  • transactionId - ID of the transaction, which can be found within the objects contained in the transactionData.merchantTransactions array.
  • addressId - ID of the customer address. If you plan to use the same address for both shipping and billing, get the addressId from the orders[].shippingData.address object.
  • Vtex_CHKO_Auth - authentication cookie provided in the response.

If you are using an email from an existing customer, ensure that the corresponding customer account is logged into your store. Otherwise, the process will fail.

Resolving the order payment

In this step, we will communicate the necessary payment data to VTEX for the finalization of the order's payment.

Starting from the moment the order is placed, you have a window of five minutes to complete the payment process. Failure to do so will result in automatic cancellation, and the order will be labeled as "incomplete."

  • Send a request to the Send payments information public endpoint, considering the following:

    • Use the orderId value obtained in the previous step as the orderId query-string parameter.
    • Use the transactionId value obtained in the previous step as a path parameter.
    • Ensure that the request body is based on the paymentData section of your orderForm.
    • In the fields object, use the addressId field to reference an existing address or introduce a new address object for an entirely new address.

If you intend to send saved credit card data, you can use the Send payments with saved credit card endpoint instead.

Step 4 - Processing and validating the order

In this final step, we will process the order.

  • Send a request to the Process order endpoint. If the payment is processed without any issues, the order should be successfully placed. Otherwise, a status 500 error might occur.

Note that this process uses the gateway connectors configured in your VTEX environment. Be careful to prevent any unwanted charges or unexpected payment denials.

Verifying the order placement

Finally, you can confirm if your order was correctly placed by checking the Order management in VTEX Admin. Alternatively, you can use the Get order and List orders endpoints for this purpose.

Shell
Python
Node.js

_10
curl --request post \
_10
--url 'https://{accountName}.{environment}.com.br/api/checkout/pub/orderForms/simulation?RnbBehavior=0' \
_10
--header 'Accept: application/json' \
_10
--header 'Content-Type: application/json' \
_10
--header 'X-VTEX-API-AppKey: {appKey}' \
_10
--header 'X-VTEX-API-AppToken: {appToken}' \
_10
--data '{"items":[{"id":"1","quantity":1,"seller":"1"}],"country":"BRA","postalCode":"12345-000","geoCoordinates":[-47.924747467041016]}'

Response

_32
{
_32
"allowManualPrice": boolean,
_32
"canEditData": boolean,
_32
"clientPreferencesData": {},
_32
"clientProfileData": {},
_32
"commercialConditionData": {},
_32
"customData": {},
_32
"giftRegistryData": {},
_32
"hooksData": {},
_32
"ignoreProfileData": boolean,
_32
"isCheckedIn": boolean,
_32
"itemMetadata": {},
_32
"items": [],
_32
"itemsOrdination": {},
_32
"loggedIn": boolean,
_32
"marketingData": {},
_32
"messages": [],
_32
"openTextField": {},
_32
"orderFormId": string,
_32
"paymentData": {},
_32
"ratesAndBenefitsData": {},
_32
"salesChannel": string,
_32
"selectableGifts": [],
_32
"sellers": {},
_32
"shippingData": {},
_32
"storeId": {},
_32
"storePreferencesData": {},
_32
"totalizers": {},
_32
"userProfileId": {},
_32
"userType": {},
_32
"value": number
_32
}

Contributors
1
Photo of the contributor
+ 1 contributors
Was this helpful?
Yes
No
Suggest edits (Github)
On this page