New enterprise cart

POST /carts/enterprise/{enterpriseId}/merchants/{merchantId}

New enterprise cart

Path parameters

application/json

Body

Create new cart details

  • cancelUrl string Required

    URL to navigate to if user cancels checkout

  • cart object Required

    Enterprise cart

    Hide cart attributes Show cart attributes
    • user object
      Hide user attributes Show user attributes
      • Source platform globally unique user Id

      • payer object
        Hide payer attributes Show payer attributes
        • Globally unique China National Id

        • name string

          name

          Format should match the following pattern: ^[^\s][\u2E80-\u2FD5\u3190-\u319f\u3400-\u4DBF\u4E00-\u9FCC\uF900-\uFAAD ]*$.

        • Phone number

      • Shipping address

        Hide shippingAddress attributes Show shippingAddress attributes
        • receiver object

          Receiver details

          Hide receiver attributes Show receiver attributes
          • name string

            Fullname

            Format should match the following pattern: ^[^\s][\u2E80-\u2FD5\u3190-\u319f\u3400-\u4DBF\u4E00-\u9FCC\uF900-\uFAAD ]*$.

          • Phone number

        • Street Address

          Format should match the following pattern: ^[^\s][a-zA-Z0-9\u2E80-\u2FD5\u3190-\u319f\u3400-\u4DBF\u4E00-\u9FCC\uF900-\uFAAD ]*$.

        • district string

          District

          Format should match the following pattern: ^[^\s][\u2E80-\u2FD5\u3190-\u319f\u3400-\u4DBF\u4E00-\u9FCC\uF900-\uFAAD ]*$.

        • province string

          Province

          Format should match the following pattern: ^[^\s][\u2E80-\u2FD5\u3190-\u319f\u3400-\u4DBF\u4E00-\u9FCC\uF900-\uFAAD ]*$.

        • city string

          City

          Format should match the following pattern: ^[^\s][\u2E80-\u2FD5\u3190-\u319f\u3400-\u4DBF\u4E00-\u9FCC\uF900-\uFAAD ]*$.

        • country string

          Country

          Format should match the following pattern: ^[^\s][\u2E80-\u2FD5\u3190-\u319f\u3400-\u4DBF\u4E00-\u9FCC\uF900-\uFAAD ]*$.

        • postcode string

          Postcode

    • Values are alipay or wechatpay.

    • products array[object]

      Cart products

      Hide products attributes Show products attributes
    • Total price before shipping tax and discount. (Note: this is not allowed to be greater than 5,000 RMB by CBEC rules.)

    • currency string

      ISO-4217 code

      Values are CNY or GBP.

    • tax number

      China tax amount

    • shipping number

      Delivery charge

    • discount number

      Any non-product discounts

    • Total to pay

Responses

  • 200

    Cart created successfully

    Hide response attributes Show response attributes object
    • code integer(int32)

      HTTP status code

    • message string

      Message

    • data object

      API response data

      Hide data attributes Show data attributes
  • 400

    Invalid message

    Hide response attributes Show response attributes object
    • code integer(int32)

      HTTP status code

    • message string

      Message

    • data object

      API response data

      Hide data attributes Show data attributes
  • 500

    Cart creation failed

    Hide response attributes Show response attributes object
    • code integer(int32)

      HTTP status code

    • message string

      Message

    • data object

      API response data

      Hide data attributes Show data attributes
POST /carts/enterprise/{enterpriseId}/merchants/{merchantId}
curl \
 -X POST https://nomad.samarkand-global.cn/checkout/carts/enterprise/REC890/merchants/SMK474 \
 -H "x-ca-key: $API_KEY" \
 -H "Content-Type: application/json" \
 -d '{"cancelUrl":"https://smktestpartner.myshopify.com/cancel","cart":{"user":{"platformUserId":"12345","payer":{"nationalId":"120103198806018241","name":"王小明","phoneNumber":"13887342813"},"shippingAddress":{"receiver":{"name":"王小明","phoneNumber":"13887342813"},"streetAddress":"天钥桥路333号腾飞大厦3楼438室","district":"徐汇区","province":"上海市","city":"市辖区","country":"中国","postcode":"200030"}},"paymentType":"alipay","products":[{"productId":"123456","skuNumber":"SMK123","barcode":"1234567890","quantity":1,"priceBeforeTax":10,"discount":0,"taxRate":"9.1,","imageUrl":"https://mydomain.com/image.png"}],"totalPriceBeforeShippingTaxAndDiscount":10,"currency":"CNY","tax":0.91,"shipping":20.2,"discount":30.3,"totalToPay":9}}'
Request example
{
  "cancelUrl": "https://smktestpartner.myshopify.com/cancel",
  "cart": {
    "user": {
      "platformUserId": "12345",
      "payer": {
        "nationalId": "120103198806018241",
        "name": "王小明",
        "phoneNumber": "13887342813"
      },
      "shippingAddress": {
        "receiver": {
          "name": "王小明",
          "phoneNumber": "13887342813"
        },
        "streetAddress": "天钥桥路333号腾飞大厦3楼438室",
        "district": "徐汇区",
        "province": "上海市",
        "city": "市辖区",
        "country": "中国",
        "postcode": "200030"
      }
    },
    "paymentType": "alipay",
    "products": [
      {
        "productId": "123456",
        "skuNumber": "SMK123",
        "barcode": "1234567890",
        "quantity": 1,
        "priceBeforeTax": 10,
        "discount": 0,
        "taxRate": "9.1,",
        "imageUrl": "https://mydomain.com/image.png"
      }
    ],
    "totalPriceBeforeShippingTaxAndDiscount": 10,
    "currency": "CNY",
    "tax": 0.91,
    "shipping": 20.2,
    "discount": 30.3,
    "totalToPay": 9
  }
}
Response examples (200)
{
  "code": 42,
  "message": "Status of operation",
  "data": {
    "cartId": "SMK474-1Vzff80HMU0FqdotSN8T0mGjK",
    "exchangeRate": 9.1
  }
}
Response examples (400)
{
  "code": 42,
  "message": "Status of operation",
  "data": {
    "cartId": "SMK474-1Vzff80HMU0FqdotSN8T0mGjK",
    "exchangeRate": 9.1
  }
}
Response examples (500)
{
  "code": 42,
  "message": "Status of operation",
  "data": {
    "cartId": "SMK474-1Vzff80HMU0FqdotSN8T0mGjK",
    "exchangeRate": 9.1
  }
}