Checkout
Checkout — methods, parameters, and examples for easy-sdk (gem).
One-shot, server-driven checkout. Use this when you've collected payment-instrument data via tokenisation and want to create the customer
- instrument + charge in a single API call. For a hosted page, use Payment Links. For an iframe-embeddable widget, use Embedded Checkout.
Accessed via client.checkout. Maps to a single endpoint.
Methods
create(**body)
POST /checkout. Accepts both card/bank and wallet (crypto) variants —
the API discriminates on the body shape. Pass source for a tokenised
payment instrument or wallet details for a wallet-checkout flow.
session = client.checkout.create(
customer_creation: false,
identity_id: customer[:id],
source: token_id,
line_items: [
{ name: "Pro plan", quantity: 1, unit_price: 4_900, currency: "USD" }
]
)Object shape
The response includes the resulting :order, :transfer (if a charge
was made), and :customer records. Wallet-checkout responses additionally
include the on-chain transaction reference.
Examples
Charge a tokenised card on a guest checkout
client.checkout.create(
customer_creation: true,
customer_details: { first_name: "Ada", last_name: "Lovelace", email: "ada@example.com" },
source: token_from_browser,
line_items: [
{ name: "Annual plan", quantity: 1, unit_price: 19_900, currency: "USD" }
]
)