A checkout session is one visit to Sovgate's hosted payment page. Your server opens it with what it sells, sends the customer to its url, and learns it was paid from the checkout.session.completed event. A session stays open until the customer pays or it expires.
Attributes
| Name | Type | Description |
|---|---|---|
id | string | Unique identifier, starting cs_live_ or cs_test_. |
object | string | Always checkout_session. |
livemode | boolean | true in live mode. |
mode | enum | payment: a one-time payment. subscription: its first payment starts a subscription. setup: sells nothing and saves the customer's card to charge later. |
status | enum | open, complete or expired. |
payment_status | enum | paid, unpaid or no_payment_required (a setup session). |
ui_mode | enum | hosted_page: Sovgate's checkout page. |
currency | string | usd. |
amount_total | integer | What the customer pays, in cents: the lines' total. |
line_item_count | integer | How many lines it sells. |
customer | string or null | The customer it was opened for, cust_..., or null for a guest. |
client_reference_id | string or null | Your own reference, such as an order number, as you sent it. |
metadata | object | Your own key-value data, as you sent it. |
url | string or null | The page to send your customer to. Returned only when the session is created; null after. |
payment_link | string or null | The payment link that opened it, or null. |
payment | string or null | The payment that completed it, pay_..., or null until one does. |
attempts | integer | How many payments were attempted in it. A declined card leaves it open for the next try. |
created | timestamp | When it was opened. |
expires_at | timestamp | When it stops taking a payment. |
completed_at | timestamp or null | When it was paid. |
expired_at | timestamp or null | When it expired unpaid. |
Read a session from your server to check it was paid: Sovgate answers from its own record of the payment, so a session read as paid was paid. Fulfil the order once, by client_reference_id: the same event can arrive more than once.
Example
Endpoints
| Endpoint | What it does |
|---|---|
POST /v1/checkout/sessions | Open a session with what you sell, and send your customer to its url. |
GET /v1/checkout/sessions/{id} | Get a session by the ID its creation returned, to check it was paid. |
GET /v1/checkout/sessions | List your checkout sessions, newest first. |
POST /v1/checkout/sessions/{id}/expire | End an open session now, so it can no longer be paid. |