Order checkout - Fabric

Order Checkout

cURL

curl --request POST \
  --url https://prod01-apigw.yourcompany.fabric.zone/api-order/checkout \
  --header 'Content-Type: application/json' \
  --data '
{
  "cartId": "5e4876e10cfe1d8902005d33",
  "customerEmail": "jsmith@example.com",
  "paymentDetails": [
    {
      "transactionDetails": {
        "paymentType": "CARD",
        "tokenizedPaymentMethod": "12fyg3fv4dbb56bbd7dfb890123456",
        "cardNumber": "1234567890123456",
        "expDate": "0220",
        "cvv": "123",
        "cardHolderFullName": "Mr John Smith",
        "metadata": {}
      },
      "paymentMethod": "Visa",
      "paymentKind": "<string>",
      "amount": 533.33,
      "currency": "USD",
      "billToAddress": {
        "name": {
          "first": "John",
          "last": "Smith",
          "middle": "Paul"
        },
        "email": "johnsmith@fabric.inc",
        "street1": "10400 NE 4th St",
        "city": "Bellevue",
        "state": "WA",
        "country": "USA",
        "zipCode": "98004",
        "street2": "Suite 500",
        "kind": "Bill to address"
      },
      "billToId": 1000001,
      "shipToId": [
        1000001,
        1000002
      ],
      "conversion": 1.12
    }
  ],
  "estimatedTax": {
    "itemsTaxes": [
      {
        "lineItemId": 2,
        "amount": 20
      }
    ],
    "shipToTaxes": [
      {
        "shipToId": "5ec35a857e6cac8d99a57d3b",
        "amount": 20
      }
    ]
  },
  "customerAccountId": "5e3598e3007c5e00080d2bb8"
}
'

Example Python Code

import requests

url = "https://prod01-apigw.yourcompany.fabric.zone/api-order/checkout"

payload = {
    "cartId": "5e4876e10cfe1d8902005d33",
    "customerEmail": "jsmith@example.com",
    "paymentDetails": [
        {
            "transactionDetails": {
                "paymentType": "CARD",
                "tokenizedPaymentMethod": "12fyg3fv4dbb56bbd7dfb890123456",
                "cardNumber": "1234567890123456",
                "expDate": "0220",
                "cvv": "123",
                "cardHolderFullName": "Mr John Smith",
                "metadata": {}
            },
            "paymentMethod": "Visa",
            "paymentKind": "<string>",
            "amount": 533.33,
            "currency": "USD",
            "billToAddress": {
                "name": {
                    "first": "John",
                    "last": "Smith",
                    "middle": "Paul"
                },
                "email": "johnsmith@fabric.inc",
                "street1": "10400 NE 4th St",
                "city": "Bellevue",
                "state": "WA",
                "country": "USA",
                "zipCode": "98004",
                "street2": "Suite 500",
                "kind": "Bill to address"
            },
            "billToId": 1000001,
            "shipToId": [1000001, 1000002],
            "conversion": 1.12
        }
    ],
    "estimatedTax": {
        "itemsTaxes": [
            {
                "lineItemId": 2,
                "amount": 20
            }
        ],
        "shipToTaxes": [
            {
                "shipToId": "5ec35a857e6cac8d99a57d3b",
                "amount": 20
            }
        ]
    },
    "customerAccountId": "5e3598e3007c5e00080d2bb8"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)

Expected Response

{
  "checkoutComplete": true,
  "orderId": "9376-1544-24209"
}
{
  "code": "CART_SHIP_TO_ERROR",
  "message": "Cart item ship to are missing."
}