Skip to main content

Qashier Online Payment API (1.0.0)

Checkout Session

A Checkout Session represents your customer's session as they pay for one-time purchases through Checkout. We recommend creating a new Session each time your customer attempts to pay.

You can create a Checkout Session on your server and redirect to its URL to begin Checkout.

Related guide: Accept a payment

Endpoints

API endpoints for managing payment online checkout sessions

Create a Checkout Session

Creates a Checkout Session object.

Authorizations:
bearerAuthapiKey
Request Body schema: application/json
required
cancel_url
string

If set, Checkout displays a back button and customers will be directed to this URL if they decide to cancel payment and return to your website.

expires_at
integer

The Epoch time in seconds at which the Checkout Session will expire. It can be anywhere from 30 minutes to 24 hours after Checkout Session creation. By default, this value is 24 hours from creation

required
Array of objects (LineItemCreate)

A list of items the customer is purchasing.

Array
object

Data used to generate a new Price object inline. One of price or price_data is required

quantity
integer

The quantity of the line item being purchased.

return_url
required
string

The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method’s app or site.

success_url
required
string

The URL to which Qashier should send customers when payment or setup is complete

Responses

Request samples

Content type
application/json
{
  • "cancel_url": "string",
  • "expires_at": 0,
  • "line_items": [
    ],
  • "return_url": "string",
  • "success_url": "string"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "currency": "string",
  • "line_items": {
    },
  • "object": "checkout.session",
  • "amount_total": 0,
  • "created": 0,
  • "expires_at": 0,
  • "mode": "payment",
  • "payment_status": "paid",
  • "status": "open",
  • "return_url": "string",
  • "success_url": "string",
  • "url": "string"
}

List all Checkout Sessions

Returns a list of Checkout Sessions.

A dictionary with a data property that contains an array of up to limit Checkout Sessions, starting after Checkout Session starting_after. Each entry in the array is a separate Checkout Session object. If no more Checkout Sessions are available, the resulting array will be empty.

Authorizations:
bearerAuthapiKey
query Parameters
object

Only return Checkout Sessions created during the given date interval

ending_before
string

A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar, your subsequent call can include ending_before=obj_bar in order to fetch the previous page of the list.

limit
integer [ 1 .. 100 ]
Default: 10

A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.

starting_after
string

A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order to fetch the next page of the list.

status
string
Enum: "open" "complete" "expired"

Only return the Checkout Sessions matching the given status.

Possible values:

  • complete: The checkout session is complete. Payment processing may still be in progress
  • expired: The checkout session has expired. No further processing will occur
  • open: The checkout session is still in progress. Payment processing has not started

Responses

Response samples

Content type
application/json
{
  • "object": "list",
  • "data": [
    ],
  • "has_more": true,
  • "url": "/checkout/sessions"
}

Retrieve a Checkout Session

Retrieves a Checkout Session object.

Authorizations:
bearerAuthapiKey
path Parameters
id
required
string

The ID of the Checkout Session to retrieve

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "currency": "string",
  • "line_items": {
    },
  • "object": "checkout.session",
  • "amount_total": 0,
  • "created": 0,
  • "expires_at": 0,
  • "mode": "payment",
  • "payment_status": "paid",
  • "status": "open",
  • "return_url": "string",
  • "success_url": "string",
  • "url": "string"
}

Expire a Checkout Session

A Checkout Session can be expired when it is in one of these statuses: open

After it expires, a customer can't complete a Checkout Session and customers loading the Checkout Session see a message saying the Checkout Session is expired.

Returns a Checkout Session object if the expiration succeeded. Returns an error if the Checkout Session has already expired or isn't in an expireable state.

Authorizations:
bearerAuthapiKey
path Parameters
id
required
string

The ID of the Checkout Session to expire

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "currency": "string",
  • "line_items": {
    },
  • "object": "checkout.session",
  • "amount_total": 0,
  • "created": 0,
  • "expires_at": 0,
  • "mode": "payment",
  • "payment_status": "paid",
  • "status": "open",
  • "return_url": "string",
  • "success_url": "string",
  • "url": "string"
}

Webhooks

Webhook events sent to your server

Checkout Session Updated Webhook

Occurs when a Checkout Session has been updated

Authorizations:
bearerAuthapiKey
Request Body schema: application/json
required
id
string

Unique identifier for the event

api_version
string

The Qashier API version used to render data when the event was created. "1.0.0" is the latest version.

object
id
string

The ID of the request that triggered this event, handled by Qashier. It's the same as TraceId in traceparent header.

idempotency_key
string

The idempotency key used for the request

type
string
Enum: "checkout.session.completed" "checkout.session.expired"
  • checkout.session.completed Occurs when a Checkout Session has been successfully completed.
  • checkout.session.expired Occurs when a Checkout Session is expired.
account
string

The ID of the account that this event belongs to

created
integer

Time at which the object was created. Measured in seconds since the Unix epoch.

object
object (CheckoutSession)
id
string

Unique identifier for the object

currency
string

Three-letter ISO currency code

object
object
string
Value: "checkout.session"

String representing the object's type

amount_total
integer

Total of all items after discounts and taxes are applied

created
integer

Time at which the object was created

expires_at
integer

The Epoch time at which the Checkout Session will expire

mode
string
Value: "payment"

The mode of the Checkout Session

payment_status
string
Enum: "paid" "unpaid" "no_payment_required"

The payment status of the Checkout Session

status
string
Enum: "open" "complete" "expired"

The status of the Checkout Session

return_url
string

URL to redirect customer back to after authentication

success_url
string

URL customers will be directed to after successful payment

url
string

The URL to the Checkout Session

Request samples

Content type
application/json
{
  • "id": "evt_1234567890",
  • "api_version": "string",
  • "request": {
    },
  • "type": "checkout.session.completed",
  • "account": "string",
  • "created": 0,
  • "data": {
    }
}

CheckoutSession

id
string

Unique identifier for the object

currency
string

Three-letter ISO currency code

object
object
string
Value: "list"

String representing the object’s type. Objects of the same type share the same value. Always has the value list.

Array of objects (LineItem)
object
string
Value: "checkout.session"

String representing the object's type

amount_total
integer

Total of all items after discounts and taxes are applied

created
integer

Time at which the object was created

expires_at
integer

The Epoch time at which the Checkout Session will expire

mode
string
Value: "payment"

The mode of the Checkout Session

payment_status
string
Enum: "paid" "unpaid" "no_payment_required"

The payment status of the Checkout Session

status
string
Enum: "open" "complete" "expired"

The status of the Checkout Session

return_url
string

URL to redirect customer back to after authentication

success_url
string

URL customers will be directed to after successful payment

url
string

The URL to the Checkout Session

{
  • "id": "string",
  • "currency": "string",
  • "line_items": {
    },
  • "object": "checkout.session",
  • "amount_total": 0,
  • "created": 0,
  • "expires_at": 0,
  • "mode": "payment",
  • "payment_status": "paid",
  • "status": "open",
  • "return_url": "string",
  • "success_url": "string",
  • "url": "string"
}

LineItem

amount_total
integer

Total after discounts and taxes

currency
string

Three-letter ISO currency code. Only SGD is supported for now

description
string

An arbitrary string attached to the object. Often useful for displaying to users. Defaults to product name.

quantity
integer

The quantity of products being purchased

{
  • "amount_total": 0,
  • "currency": "string",
  • "description": "string",
  • "quantity": 0
}