Checkout
Checkout — methods, parameters, and examples for easy-sdk (pip).
The client.checkout resource creates a one-shot, server-side checkout
that combines a payment, an order, and (optionally) subscriptions in a
single API call. Use it when you already have a tokenized payment
instrument and want to charge + record + subscribe atomically.
Namespace: client.checkout.
Other checkout surfaces live next door:
- Payment Links — share a hosted URL.
- Embedded Checkout — render a session in your own UI.
Methods
create
result = client.checkout.create(
customer={
"first_name": "Ada",
"last_name": "Lovelace",
"email": "ada@example.com",
},
payment_instrument={
"type": "PAYMENT_CARD",
"name": "Ada Lovelace",
"token_id": "tok_abc",
},
items=[
{"price_id": "price_widget", "quantity": 2},
],
idempotency_key="checkout-cart-2025-01-01-001",
)
print(result.transfer.id if result.transfer else None)
print(result.order_id)Returns: CheckoutResponse. All fields are accepted via **kwargs;
see the Easy Labs API reference for the
full request schema.
Object shape
CheckoutResponse:
| Field | Type | Notes |
|---|---|---|
transfer | Transfer | None | The charge created by the call. |
order_id | str | None (alias orderId) | The Order produced (look up with client.orders.retrieve). |
subscriptions | list[dict[str, Any]] | None | Any subscriptions started in the same call. |
order | dict[str, Any] | None | Full order payload when expanded. |
customer | dict[str, Any] | None | The customer that was created or matched. |
Examples
Charge a returning customer with a saved instrument
result = client.checkout.create(
identity_id="ident_123",
payment_instrument_id="pi_abc",
items=[{"price_id": "price_widget", "quantity": 1}],
idempotency_key=f"order-{order_id}",
)
if result.transfer and result.transfer.state == "SUCCEEDED":
fulfill_order(result.order_id)Combine a one-time charge with a subscription start
result = client.checkout.create(
customer={"first_name": "Ada", "last_name": "L.", "email": "a@b.c"},
payment_instrument={"type": "PAYMENT_CARD", "name": "Ada", "token_id": "tok_abc"},
items=[{"price_id": "price_setup_fee", "quantity": 1}],
subscriptions=[{"items": [{"price_id": "price_monthly"}]}],
idempotency_key="signup-ada-2025-01-01",
)
setup_charge = result.transfer
new_subs = result.subscriptions or []