NAV
shell javascript

Overview

The idea behind Splitcart Checkout is to allow customers to split the cost with other people such as friends and family when purchasing an item online. The Splitcart Checkout service makes group purchases effortless. No longer are there issues that people have when one person must buy the item and then later track down the others for their portion of the cost. Everything can now be done through our new Splitcart Checkout service.

Getting Started

Authentication

Authentication to the API is performed via a field in the header of the request. All requests that require an API are to be made over HTTPS. Any call that doesn't include the correct header field with the API, or is over HTTP, will fail.

Any where you see {{api-key}} replace it with the api key that we provided.

You should keep your API key secure. Make sure not to make it available publicly in areas such as public Github/BitBucket repos, client-side code and so on.

If you do not have an API key and would like to integrate with our service please contact us at sales@splitcart.com

curl --request POST "https://api.checkout.splitcart.com/v1/splitcart"
  --header "Content-Type: application/json"
  --header "x-api-key: {{api-key}}"
var options = {
  method: 'POST',
  headers: {
    'x-api-key': '{{api-key}}',
    'Content-Type': 'application/json'
  },
  body: body
};

fetch("https://api.checkout.splitcart.com/v1/splitcart", options)

Rate Limits

Splitcart Checkout limits the number of calls that can be made using your provided API Key during a given time period. The Burst Limit is the maximum request limit over a time ranging from one to a few seconds. The Rate Limit is the steady-state rate limit (average requests per second over an extended period of time). Those limits are as follows:

Calls Per Month Burst Limit Rate Limit
50,000 5 10

Checkout Buttons

On your payment/checkout page you need to show our checkout button. We provide various versions of the button so that it is able to match the style of your website. A zip file that contains all variations can be found here.

Splitcarts

Create Pending Splitcart

curl --request POST "https://api.checkout.splitcart.com/v1/splitcart"
  --header "Content-Type: application/json"
  --header "x-api-key: {{api-key}}"
  --data-raw "{
      "order": {
        "id": "12345"
      },
      "companyId": "12345",
      "products": [
          {
              "id": "1",
              "title": "title",
              "description": "description",
              "images": [
                  "first image"
              ],
              "quantity": 1,
              "price": 50.0,
              "url": ""
          }
      ],
      "additionalPriceInfo": {
          "subtotal": 50.0,
          "shipping": 0,
          "tax": 0
      },
      "shipping": {
          "firstName": "John",
          "lastName": "Doe",
          "addressLine1": "123 Main St",
          "addressLine2": "",
          "city": "Des Moines",
          "state": "IA",
          "zipCode": "12345",
          "country": "United States"
      }
  }"
var raw = JSON.stringify({
  "order": {
    "id": "12345"
  },
  "companyId": "12345",
  "products": [
    {
      "id": "1",
      "title": "title",
      "description": "description",
      "images": [
        "first image"
      ],
      "quantity": 1,
      "price": 50,
      "url": ""
    }
  ],
  "additionalPriceInfo": {
    "subtotal": 50,
    "shipping": 0,
    "tax": 0
  },
  "shipping": {
    "firstName": "John",
    "lastName": "Doe",
    "addressLine1": "123 Main St",
    "addressLine2": "",
    "city": "Des Moines",
    "state": "IA",
    "zipCode": "12345",
    "country": "United States"
  }
});

var options = {
  method: 'POST',
  headers: {
    'x-api-key': '{{api-key}}',
    'Content-Type': 'application/json'
  },
  body: raw
};

// Then and Catch
fetch("https://api.checkout.splitcart.com/v1/splitcart", options)
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
  "status": "successful",
  "statusCode": 200,
  "id": "12345",
  "link": "https://web.checkout.splitcart.com/Details/12345"
}

This endpoint stores the required information in our database and returns a link for the retailer to redirect to.

HTTPS Request

POST https://api.checkout.splitcart.com/v1/splitcart

Attribute Required Description
order.id true The id of the order this splitcart is going to be associated with.
companyId true Your company id
products[].id true The id of the product.
products[].title true The title of the product.
products[].description true The description of the product.
products[].images true An array of images for the product.
products[].quantity false The default is 1. The quantity for this product.
products[].price true The price for this product.
products[].url true The url to this product.
additionalPriceInfo.tax false The default is 0. The total tax for the order.
additionalPriceInfo.shipping false The default is 0. The total shipping cost for the order.
additionalPriceInfo.subtotal true The subtotal of all the items included in the order.
shipping.firstName true The first name of the person the item is being shipped to.
shipping.lastName true The last name of the person the item is being shipped to.
shipping.addressLine2 true The first line for the shipping address.
shipping.addressLine1 false The default is an empty string. The second line for the shipping address, i.e. apartment number, PO box number, etc
shipping.city true The shipping address city.
shipping.state true The shipping address state.
shipping.zipCode true The shipping address zip code.
shipping.country true The shipping address country.