SDK reference
Checkout
createCheckoutSession, the payer's attempt, and the hand-back to the merchant.
A session is a payment request plus the return URLs. The HTTP surface is Checkout.
createCheckoutSession(input)
Requires a credential. You are the merchant.
const session = await path.createCheckoutSession({
requestReference: request.reference,
successUrl: 'https://store.example.com/thanks?order=10482',
cancelUrl: 'https://store.example.com/cart',
webhookUrl: 'https://store.example.com/hooks/path',
});
session.url; // the public link, same grammar as a request'sgetCheckoutSession(id)
Requires a credential. The merchant's own view, by internal id. The payer-facing object travels on the public link, not on this call.
payer_member is the wallet that served the session. It may belong to a member you have never
integrated with.
attemptCheckout(reference, detail?)
Requires a credential. The payer's wallet, keyed by the reference on the link.
await path.attemptCheckout(session.reference, {
via: { asset_type: 'fiat', asset_code: 'USD', rail: 'book' },
instruction: instruction.reference,
});The calling credential is the wallet's member. Attempts are counted.
completeCheckout(reference)
Requires a credential. The hand-back. No body. An open session becomes completed, and the
response carries success_url.
This does not mark the underlying request paid.
revokeCheckout(reference)
Requires a credential. The merchant withdraws an open session: open becomes revoked.