ShopfloDevelopers

API reference

Checkout API

Create a Shopflo checkout for a cart and send the shopper to it.

Available Brands and agencies with a custom storefront, app or backend

Use the Checkout API when your own storefront, app or backend holds the cart and you want Shopflo to run the checkout. You send the cart. Shopflo returns a link. You redirect the shopper to it.

Calls are made from your server with a channel API key.

Base URL: https://api.shopflo.co

Authentication: Merchant API key

A channel API key from your Shopflo dashboard, sent as the whole value of the Authorization header.

Read how this authentication works

Endpoints

Checkouts

POST

Create a checkout

/kratos/api/v2/token

Creates a checkout for a cart and returns a link to it. Redirect the shopper to checkout_url. Each call creates a new checkout.

Authentication: Merchant API key

Request body

  • itemsarrayRequired

    The cart. At least one item.

    • idstringRequired

      The Shopify variant id of the item.

    • quantityintegerRequired

      1 or more.

    • pricenumberOptional

      Price of one unit.

    • namestringOptional

      Display name of the line.

    • product_namestringOptional

      Product name.

    • variant_namestringOptional

      Variant name.

    • skustringOptional

      SKU.

    • product_idstringOptional

      Shopify product id.

    • imagestringOptional

      Image URL.

    • propertiesobjectOptional

      Line properties as text keys and text values.

  • cart_session_idstringOptional

    Identifies the shopper's cart. If you leave it out, Shopflo generates one.

  • discountsarrayOptional

    Discounts to apply when the checkout opens.

    • typestringRequired

      CODE applies an existing coupon code. CUSTOM_DISCOUNT applies a discount you define.

    • codestringOptional

      The coupon code for CODE, or the code you give a custom discount.

    • titlestringOptional

      Display title.

    • amountstringOptional

      A number written as text, for example 100.00. Used by CUSTOM_DISCOUNT.

    • is_stackablebooleanOptional

      Defaults to false.

    • is_removablebooleanOptional

      Defaults to false.

    • is_auto_appliedbooleanOptional

      Defaults to false.

  • tagsarray of stringOptional

    Tags to attach to the order.

  • notestringOptional

    Order note.

  • note_attributesarrayOptional

    Extra name and value pairs to attach to the order.

    • namestringRequired

      Attribute name.

    • valuestringRequired

      Attribute value.

  • payment_configobjectOptional

    Limits the payment modes the shopper can use.

    • allowed_modesarray of stringOptional

      Allowed payment modes. Leave it empty or include ALL for no limit. FREE is always allowed. Values: CARD, PAYTM, SNPM, NETBANKING, WALLET, UPI, UPI_INTENT, UPI_COLLECT, EMI, PAY_LATER, COD, ONLINE, SNAPMINT, SAVED_MODES, PREPAID, FREE, CASHFREE, RAZORPAY, PL, BHARATX, OFFLINE_PAYMENT, SPLIT_COD, REWARDS_WALLET, LOYALTY, GC, CRED, PAYPAL, SHOPFLO_GC, SHOPIFY_GC, REWARDS, SIMPL, SIMPL_PL, VELOCITY, ALL, CUSTOM_PAYMENT, GYFTR, GIFTCARD.

  • back_urlstringOptional

    Where to send the shopper if the checkout does not complete.

  • success_urlstringOptional

    Where to send the shopper after a completed checkout.

Response fields in data

  • token_idstringRequired

    Identifies the checkout session.

  • checkout_urlstringRequired

    Send the shopper here. Do not build the link yourself.

  • application_idstringRequired

    The channel that created the checkout.

Send Content-Type: application/json. Shopflo supports more fields for specific integrations. Contact [email protected] if you need one.

Errors

StatusCodeWhen
400GE_001items is empty (must not be empty), a quantity is below 1 (must be at least 1), or the body is not valid JSON.
401GE_003The Authorization header is missing or the key is not recognised.
POST/kratos/api/v2/token
curl -sS -X POST "https://api.shopflo.co/kratos/api/v2/token" \
  -H "Authorization: sfat-your_key" \
  -H "Content-Type: application/json" \
  -d '{
  "items": [
    {
      "id": "44123456789",
      "quantity": 2
    }
  ],
  "discounts": [
    {
      "type": "CODE",
      "code": "WELCOME10"
    }
  ],
  "success_url": "https://example.com/thanks"
}'
Response200 OK
{
  "success": true,
  "data": {
    "token_id": "7b0c1f4e-2d8a-4a7e-9c55-1f3e6a9d0b21",
    "checkout_url": "https://checkout.shopflo.co/stable/?tokenId=7b0c1f4e-2d8a-4a7e-9c55-1f3e6a9d0b21",
    "application_id": "your_channel_id"
  }
}
POST

Create a cart checkout

/kratos/api/v2/token/cart

Same request and response as Create a checkout, with two differences. The link opens on the cart step. If a checkout already exists for the same cart_session_id and has not been completed, that checkout is reused and updated instead of a new one being created.

Authentication: Merchant API key

Request body

  • itemsarrayRequired

    The cart. At least one item.

    • idstringRequired

      The Shopify variant id of the item.

    • quantityintegerRequired

      1 or more.

    • pricenumberOptional

      Price of one unit.

    • namestringOptional

      Display name of the line.

    • product_namestringOptional

      Product name.

    • variant_namestringOptional

      Variant name.

    • skustringOptional

      SKU.

    • product_idstringOptional

      Shopify product id.

    • imagestringOptional

      Image URL.

    • propertiesobjectOptional

      Line properties as text keys and text values.

  • cart_session_idstringOptional

    Identifies the shopper's cart. If you leave it out, Shopflo generates one.

  • discountsarrayOptional

    Discounts to apply when the checkout opens.

    • typestringRequired

      CODE applies an existing coupon code. CUSTOM_DISCOUNT applies a discount you define.

    • codestringOptional

      The coupon code for CODE, or the code you give a custom discount.

    • titlestringOptional

      Display title.

    • amountstringOptional

      A number written as text, for example 100.00. Used by CUSTOM_DISCOUNT.

    • is_stackablebooleanOptional

      Defaults to false.

    • is_removablebooleanOptional

      Defaults to false.

    • is_auto_appliedbooleanOptional

      Defaults to false.

  • tagsarray of stringOptional

    Tags to attach to the order.

  • notestringOptional

    Order note.

  • note_attributesarrayOptional

    Extra name and value pairs to attach to the order.

    • namestringRequired

      Attribute name.

    • valuestringRequired

      Attribute value.

  • payment_configobjectOptional

    Limits the payment modes the shopper can use.

    • allowed_modesarray of stringOptional

      Allowed payment modes. Leave it empty or include ALL for no limit. FREE is always allowed. Values: CARD, PAYTM, SNPM, NETBANKING, WALLET, UPI, UPI_INTENT, UPI_COLLECT, EMI, PAY_LATER, COD, ONLINE, SNAPMINT, SAVED_MODES, PREPAID, FREE, CASHFREE, RAZORPAY, PL, BHARATX, OFFLINE_PAYMENT, SPLIT_COD, REWARDS_WALLET, LOYALTY, GC, CRED, PAYPAL, SHOPFLO_GC, SHOPIFY_GC, REWARDS, SIMPL, SIMPL_PL, VELOCITY, ALL, CUSTOM_PAYMENT, GYFTR, GIFTCARD.

  • back_urlstringOptional

    Where to send the shopper if the checkout does not complete.

  • success_urlstringOptional

    Where to send the shopper after a completed checkout.

Response fields in data

  • token_idstringRequired

    Identifies the checkout session.

  • checkout_urlstringRequired

    Send the shopper here. Do not build the link yourself.

  • application_idstringRequired

    The channel that created the checkout.

Send the same cart_session_id each time the shopper's cart changes, so the same checkout is updated. Reuse only applies for a limited time after the checkout was created.

Shopflo supports more fields for specific integrations. Contact [email protected] if you need one.

Errors

StatusCodeWhen
400GE_001items is empty (must not be empty), a quantity is below 1 (must be at least 1), or the body is not valid JSON.
401GE_003The Authorization header is missing or the key is not recognised.
POST/kratos/api/v2/token/cart
curl -sS -X POST "https://api.shopflo.co/kratos/api/v2/token/cart" \
  -H "Authorization: sfat-your_key" \
  -H "Content-Type: application/json" \
  -d '{
  "cart_session_id": "cart-8841",
  "items": [
    {
      "id": "44123456789",
      "quantity": 2
    }
  ],
  "discounts": [
    {
      "type": "CODE",
      "code": "WELCOME10"
    }
  ],
  "success_url": "https://example.com/thanks"
}'
Response200 OK
{
  "success": true,
  "data": {
    "token_id": "7b0c1f4e-2d8a-4a7e-9c55-1f3e6a9d0b21",
    "checkout_url": "https://checkout.shopflo.co/stable/?tokenId=7b0c1f4e-2d8a-4a7e-9c55-1f3e6a9d0b21&page=cart",
    "application_id": "your_channel_id"
  }
}