Storefront Cart

A cart represents a customer's virtual shopping cart.

Endpoints

  • Request Headers

  • Name
    Authorization
    Type
    customer auth
    Tags
    REQUIRED
    Description

    the token of your customer prefixed with customer, see more information here

  • Name
    x-paynow-customer-ip
    Type
    string
    Tags
    Description

    the IP address (IPv4 or IPv6) of the customer.

  • Name
    x-paynow-customer-countrycode
    Type
    string
    Tags
    Description

    the customer's country code in ISO 3166-1 alpha-2 format. If you're using Cloudflare, you can use the value of CF-IPCountry header from the request of your customer.

    You need to include either x-paynow-customer-ip or x-paynow-customer-countrycode if the requests are not being made from the customer's browser.


The Cart object

  • Fields

  • Name
    store_id
    Type
    flake
    Tags
    Description

    id of the store this cart belongs to

  • Name
    customer_id
    Type
    flake
    Tags
    Description

    id of the customer this cart belongs to

  • Name
    total
    Type
    integer
    Tags
    Description

    sum of all line prices in this cart

  • Name
    lines
    Type
    []cart_line
    Tags
    Description

    list of items in cart

Cart Line object structure

  • Fields

  • Name
    product_id
    Type
    flake
    Tags
    Description

    id of the product

  • Name
    name
    Type
    string
    Tags
    Description

    name of the product

  • Name
    slug
    Type
    string
    Tags
    Description

    url-safe identifier of the product

  • Name
    price
    Type
    integer
    Tags
    Description

    the price of this line in zero-decimal format (where "$10.00" is 1000)

  • Name
    quantity
    Type
    integer
    Tags
    Description

    the quantity (count) of products in this line

  • Name
    selected_gameserver
    Type
    string
    Tags
    NULLABLE
    Description

    the selected game server for the product, if applicable. This field can be null if no server is selected.

  • Name
    selected_gameserver_id
    Type
    string
    Tags
    NULLABLE
    Description

    the unique identifier of the selected game server, if applicable. This field can be null if no server is selected.

The Cart object

{
	"store_id": "94688451781206016",
	"customer_id": "97394129868165120",
	"lines": [
		{
			"product_id": "124249183568797696",
			"slug": "banana",
			"name": "Banana",
			"price": 117,
			"quantity": 2
		},
		{
			"product_id": "117390520375844864",
			"slug": "super-special-kit",
			"name": "Super Special Kit",
			"price": 499,
			"quantity": 1
		},
		{
			"product_id": "95146937015078912",
			"slug": "blender",
			"name": "A blender. It blends stuff.",
			"price": 1999,
			"quantity": 6
		}
	],
	"total": 12727
}

Get Current Cart

Returns the cart for the currently authenticated customer.

Returns

Returns a cart.

Request

GET
/store/cart

Response

{
	"store_id": "94688451781206016",
	"customer_id": "97394129868165120",
	"lines": [
		{
			"product_id": "124249183568797696",
			"slug": "banana",
			"name": "Banana",
			"price": 117,
			"quantity": 2
		},
		{
			"product_id": "117390520375844864",
			"slug": "super-special-kit",
			"name": "Super Special Kit",
			"price": 499,
			"quantity": 1
		},
		{
			"product_id": "95146937015078912",
			"slug": "blender",
			"name": "A blender. It blends stuff.",
			"price": 1999,
			"quantity": 6
		}
	],
	"total": 12727
}

Empty Current Cart

Empties the cart for the currently authenticated customer.

Returns

Returns HTTP 204

Request

Response

HTTP 204

Set Cart Lines

Creates or updates a cart line of the currently authenticated customer.

  • Query Parameters

  • Name
    product_id
    Type
    flake
    Tags
    Description

    id of the product

  • Name
    quantity
    Type
    integer
    Tags
    Description

    the quantity (count) of products in this line

Returns

Returns HTTP 204

Request

Response

HTTP 204