Order checkout (v4) - Fabric

Order checkout (v4)

cURL

curl --request POST \
  --url https://prod01-apigw.yourcompany.fabric.zone/api-order/checkout-v4 \
  --header 'Content-Type: application/json' \
  --data '
{
  "cartId": "5e4876e10cfe1d8902005d33",
  "customerEmail": "jsmith@example.com",
  "estimatedTax": {
    "itemsTaxes": [
      {
        "lineItemId": 2,
        "amount": 20
      }
    ],
    "shipToTaxes": [
      {
        "shipToId": "5ec35a857e6cac8d99a57d3b",
        "amount": 20
      }
    ]
  },
  "customerAccountId": "5e3598e3007c5e00080d2bb8",
  "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
    }
  ]
}
'

Python Example

import requests

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

payload = {
    "cartId": "5e4876e10cfe1d8902005d33",
    "customerEmail": "jsmith@example.com",
    "estimatedTax": {
        "itemsTaxes": [
            {
                "lineItemId": 2,
                "amount": 20
            }
        ],
        "shipToTaxes": [
            {
                "shipToId": "5ec35a857e6cac8d99a57d3b",
                "amount": 20
            }
        ]
    },
    "customerAccountId": "5e3598e3007c5e00080d2bb8",
    "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
        }
    ]
}
headers = {"Content-Type": "application/json"}

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

print(response.text)

JavaScript Example

const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    cartId: '5e4876e10cfe1d8902005d33',
    customerEmail: 'jsmith@example.com',
    estimatedTax: {
      itemsTaxes: [{lineItemId: 2, amount: 20}],
      shipToTaxes: [{shipToId: '5ec35a857e6cac8d99a57d3b', amount: 20}]
    },
    customerAccountId: '5e3598e3007c5e00080d2bb8',
    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
    }]
  })
};

fetch('https://prod01-apigw.yourcompany.fabric.zone/api-order/checkout-v4', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));