Skerry/ Guides

Payments

Taking money for a customer: checkout sessions, payment links, saved methods, subscriptions, refunds and disputes.

Taking money for a customer: every method and direction with its status, then checkout sessions, payment links, payments, saved methods, subscriptions, refunds, disputes, and paying a checkout session by stablecoin or bank transfer.

Status: card, wallet and bank-debit acceptance and payment instructions at checkout are test mode only. Delegated payment tokens and paying by the call are preview, off by default. The code is lib/checkout.ts, lib/payments-sync.ts, lib/deposits.ts, lib/ops/ and lib/providers/cards.ts; the matrix is lib/pure/payment-matrix.ts.

The customer is the merchant: each customer holds its own account at the card processor, created on demand and onboarded on a hosted page, and Skerry acts on it as the platform. Payers pay on hosted pages, so card details never reach Skerry or the partner. Amounts are integer minor units beside a lowercase currency.

Before a customer can take a card payment

A customer takes card payments once its own account at the card processor reports that charges are enabled. GET /customers/{id} says so in can.accept_cards and in card_acceptance. Until then a checkout session or a payment is refused with 409 onboarding_incomplete, and detail.steps names card_acceptance.

card_acceptance.currencies lists the currencies a card payment can be presented in, from the processor's rules for the account's country, and card_acceptance.settlement_currency the one its settlements arrive in. A checkout session, payment link or subscription in any other currency is refused with 400 currency_not_supported before the processor is asked, and detail.accepted lists the ones that work. A session that can also be paid by instruction is still made, without the card. Both fields are empty until the account has been read from the processor once.

A person does this step, once for each customer. POST /customers/{id}/onboarding-link with steps: ["card_acceptance"] returns a link. Whoever opens it is sent to the card processor's hosted page, confirms the details of the business there and accepts the processor's agreement. Business verification is a separate step, and a card payment does not wait for it.

Sandbox is the same. The account is the business's own account at the card processor, and the processor takes its agreement only from a person on its own page, so no call completes this step, in test mode either. In sandbox the page accepts the processor's test values and no real business is checked. Do it once for each sandbox customer that takes payments. POST /customers/{id}/verification is not this step: it carries business verification only, and only for a customer whose owner has already opened the hosted onboarding.

Before the banking partner knows a customer

A customer made from a name, an email and a country is not known to the banking partner until its owner has been through hosted onboarding (POST /customers/{id}/onboarding-link). Until then:

  • A list of what the banking partner holds for the customer (accounts, payees, wallets, standing orders, memos, people, and GET /payouts?customer_id=) answers with an empty data.
  • One thing of the customer's by its id (a payee, an account, a wallet, a standing order's conversions, a person) answers 404: none of them exists yet.
  • An operation that makes or changes something at the banking partner, or reads its settings (fees, rewards), answers 409 onboarding_incomplete with detail.next_step naming the onboarding link.
  • The customer itself, its verification and its card acceptance answer as for any customer.

Every method and direction

GET /capabilities returns this matrix as payment_methods; GET /customers/{id}/payment-methods returns it for one customer with each cell marked enabled. A cell has one status, a reason_code, and the provider by role. test/payment-matrix.test.mjs fails when a cell claims to work and no route serves it.

StatusMeaning
availableWorks for every verified customer.
per_customerWorks for a customer the provider has enabled for it.
previewBuilt against a provider preview; off unless the deployment switches it on and the customer's merchant account reports the feature.
offIntended, not usable yet.
not_offeredNot served, or the direction does not apply to the method.

Settles says whether the outcome is known as the payer finishes (immediate) or arrives later as an event (delayed): a delayed method moves a payment through processing to succeeded or failed.

MethodProviderSettlespay_inpay_outhold_and_capturerecurringrefunddispute
Cardscard_processorimmediateper_customernot_offeredper_customerper_customerper_customerper_customer
Wallets (saved cards and device wallets)card_processorimmediateper_customernot_offeredper_customerper_customerper_customerper_customer
Klarnacard_processorimmediateper_customernot_offeredper_customernot_offeredper_customerper_customer
Affirmcard_processorimmediateper_customernot_offeredper_customernot_offeredper_customerper_customer
Afterpay and Clearpaycard_processorimmediateper_customernot_offeredper_customernot_offeredper_customerper_customer
iDEALcard_processorimmediateper_customernot_offerednot_offerednot_offeredper_customerper_customer
Bancontactcard_processorimmediateper_customernot_offerednot_offerednot_offeredper_customerper_customer
EPScard_processorimmediateper_customernot_offerednot_offerednot_offeredper_customerper_customer
Przelewy24card_processorimmediateper_customernot_offerednot_offerednot_offeredper_customerper_customer
BLIKcard_processorimmediateper_customernot_offerednot_offerednot_offeredper_customerper_customer
TWINTcard_processorimmediateper_customernot_offerednot_offerednot_offeredper_customerper_customer
Swishcard_processorimmediateper_customernot_offerednot_offerednot_offeredper_customerper_customer
MobilePaycard_processorimmediateper_customernot_offeredper_customernot_offeredper_customerper_customer
Pixcard_processorimmediateper_customernot_offerednot_offerednot_offeredper_customerper_customer
Cash App Paycard_processorimmediateper_customernot_offeredper_customerper_customerper_customerper_customer
Amazon Paycard_processorimmediateper_customernot_offeredper_customerper_customerper_customerper_customer
Revolut Paycard_processorimmediateper_customernot_offeredper_customerper_customerper_customerper_customer
Multibancocard_processordelayedper_customernot_offerednot_offerednot_offeredper_customernot_offered
Konbinicard_processordelayedper_customernot_offerednot_offerednot_offeredper_customernot_offered
Boletocard_processordelayedper_customernot_offerednot_offerednot_offerednot_offerednot_offered
OXXOcard_processordelayedper_customernot_offerednot_offerednot_offerednot_offerednot_offered
ACH debitcard_processordelayedper_customernot_offerednot_offeredper_customerper_customerper_customer
SEPA debitcard_processordelayedper_customernot_offerednot_offeredper_customerper_customerper_customer
Bacs debitcard_processordelayedper_customernot_offerednot_offeredper_customerper_customerper_customer
Stablecoin on the hosted pagecard_processordelayedper_customernot_offerednot_offerednot_offeredper_customernot_offered
ACH credit into a virtual accountbanking_partnerdelayedavailablenot_offerednot_offerednot_offeredavailablenot_offered
Wire into a virtual accountbanking_partnerdelayedavailablenot_offerednot_offerednot_offeredavailablenot_offered
SEPA credit into a virtual accountbanking_partnerdelayedavailablenot_offerednot_offerednot_offeredavailablenot_offered
Faster Payments into a virtual accountbanking_partnerdelayedoffnot_offerednot_offerednot_offeredoffnot_offered
ACH payoutbanking_partnerdelayednot_offeredavailablenot_offerednot_offerednot_offerednot_offered
Same-day ACH payoutbanking_partnerdelayednot_offeredavailablenot_offerednot_offerednot_offerednot_offered
Wire payoutbanking_partnerdelayednot_offeredavailablenot_offerednot_offerednot_offerednot_offered
FedNow payoutbanking_partnerdelayednot_offeredper_customernot_offerednot_offerednot_offerednot_offered
RTP payoutbanking_partnerdelayednot_offerednot_offerednot_offerednot_offerednot_offerednot_offered
SEPA payoutbanking_partnerdelayednot_offeredavailablenot_offerednot_offerednot_offerednot_offered
Faster Payments payoutbanking_partnerdelayednot_offeredper_customernot_offerednot_offerednot_offerednot_offered
SPEI payoutbanking_partnerdelayednot_offeredper_customernot_offerednot_offerednot_offerednot_offered
Pix payoutbanking_partnerdelayednot_offeredper_customernot_offerednot_offerednot_offerednot_offered
Bre-B payoutbanking_partnerdelayednot_offeredper_customernot_offerednot_offerednot_offerednot_offered
Colombian bank transfer payoutbanking_partnerdelayednot_offeredper_customernot_offerednot_offerednot_offerednot_offered
USDC on base, ethereum, polygon, solana, arbitrum, optimism, tron, stellar, tempobanking_partnerdelayedper_customerper_customernot_offerednot_offeredper_customernot_offered
USDT on base, ethereum, polygon, solana, arbitrum, optimism, tron, stellar, tempobanking_partnerdelayedper_customerper_customernot_offerednot_offeredper_customernot_offered
EURC on base, ethereum, polygon, solana, arbitrum, optimism, tron, stellar, tempobanking_partnerdelayedper_customerper_customernot_offerednot_offeredper_customernot_offered
PYUSD on base, ethereum, polygon, solana, arbitrum, optimism, tron, stellar, tempobanking_partnerdelayedper_customerper_customernot_offerednot_offeredper_customernot_offered
USDB on base, ethereum, polygon, solana, arbitrum, optimism, tron, stellar, tempobanking_partnerdelayedper_customerper_customernot_offerednot_offeredper_customernot_offered
OUSD on base, ethereum, solana, tempobanking_partnerdelayedper_customerper_customernot_offerednot_offeredper_customernot_offered
Conversion between a customer's own balancesbanking_partnerdelayednot_offeredavailablenot_offerednot_offerednot_offerednot_offered
Pulling money from a bank account into a wallet on demandbanking_partnernot_offerednot_offerednot_offerednot_offerednot_offerednot_offered
Cards issued against a balancebanking_partnernot_offeredoffnot_offerednot_offerednot_offeredoff
Paying by the call in stablecoin (x402 and the Machine Payments Protocol)card_processordelayedpreviewnot_offerednot_offeredpreviewpreviewnot_offered
Paying by the call with a delegated card token (the Machine Payments Protocol)card_processorimmediatepreviewnot_offerednot_offeredpreviewpreviewpreview
A delegated payment token presented by an agent at checkout (seller side)card_processorimmediatepreviewnot_offerednot_offerednot_offeredpreviewpreview
An agent paying other merchants (buyer side)nonenot_offeredpreviewnot_offerednot_offerednot_offerednot_offered
Push to a debit cardnonenot_offerednot_offerednot_offerednot_offerednot_offerednot_offered
Cashnonenot_offerednot_offerednot_offerednot_offerednot_offerednot_offered
Chequenonenot_offerednot_offerednot_offerednot_offerednot_offerednot_offered
Mobile moneynonenot_offerednot_offerednot_offerednot_offerednot_offerednot_offered
Crypto assets other than stablecoinsnonenot_offerednot_offerednot_offerednot_offerednot_offerednot_offered

A method the card processor reports active on a merchant account that this table does not know is still shown for that customer, with refund and dispute marked as the processor reports them.

Reason codeMeaning
okWorks as documented.
enabled_at_onboardingSwitched on for a customer when the card processor has enabled it on the customer's merchant account.
enabled_at_verificationSwitched on for a customer during verification by the banking partner.
chain_coin_pair_variesOffered where the banking partner supports this coin on this chain for the customer.
payee_bank_dependentUsed only when the payee's bank reports that it can receive it.
not_applicableThis direction does not apply to this method.
not_builtThe provider offers it; this platform does not serve it yet.
no_holds_on_methodThe method collects at once; there is nothing to hold and capture later.
no_recurring_on_methodThe method cannot be charged again without the payer present.
method_has_no_refundsThe method cannot be refunded through the processor; return the money another way.
method_has_no_disputesThe payer authorises each payment, so the method has no dispute process.
refund_is_a_payoutA refund is a payout back to where the money came from, or to a destination given with the refund.
as_reported_by_processorDepends on the method as the card processor reports it for the payment.
preview_off_by_defaultBuilt against a provider preview. Off unless the deployment switches it on and the customer's merchant account reports the feature.
card_issuing_not_switched_onCard issuing is switched off for this platform.
account_currency_not_switched_onAccounts in this currency are switched off for this platform.
inbound_onlyReported on money arriving; not offered for sending.
provider_has_no_pull_apiThe banking partner documents no call that pulls money from a bank account on demand. Money comes in by the payer sending it to a virtual account.
agent_paying_previewBuilt from the wallet provider's and the payment protocols' documentation, and not yet run against them. Off unless the deployment switches it on and connects the wallet provider.
not_servedThe platform does not serve this method.
not_served_non_stablecoinOnly stablecoins are held and moved. Other crypto assets are not served.

The operations

OperationScopeIdempotency-KeyMoves moneyWhat it does
POST /checkout-sessionspayments:writeoptionalyesStart a checkout for a payer.
GET /checkout-sessionspayments:readnonenoCheckout sessions, newest first.
GET /checkout-sessions/{id}payments:readnonenoOne session.
POST /checkout-sessions/{id}/expirepayments:writeoptionalnoClose an open session so it can no longer be paid.
POST /payment-linkspayments:writeoptionalyesA reusable or single-use link to a hosted checkout for a fixed amount.
GET /payment-linkspayments:readnonenoPayment links, newest first.
GET /payment-links/{id}payments:readnonenoOne payment link, with how many times it has been used.
PATCH /payment-links/{id}payments:writenonenoPause, resume or disable a link.
GET /paymentspayments:readnonenoPayments, newest first.
GET /payments/{id}payments:readnonenoOne payment: status, fee, amounts received and refunded, and risk (level, score and how the payer's authentication ended) where the processor reports them.
POST /paymentspayments:writerequiredyesCharge a saved method with the payer absent, under the mandate they gave; or, with payment_token, charge a delegated payment token an agent holds for its buyer (a preview: 409 capability_off until it is switched on for the customer).
POST /payments/{id}/capturepayments:writeoptionalyesCollect funds that were held.
POST /payments/{id}/cancelpayments:writeoptionalnoRelease a hold, or abandon a payment that has not succeeded.
POST /payments/{id}/refundsrefunds:writerequiredyesRefund all or part of a payment.
GET /payments/{id}/refundspayments:readnonenoRefunds made against a payment.
GET /disputespayments:readnonenoDisputes against payments, newest first.
GET /disputes/{id}payments:readnonenoOne dispute, with the date evidence is due.
POST /disputes/{id}/evidencepayments:writeoptionalnoSend evidence, and submit it when complete: text fields, file fields (the id of an uploaded file) and enhanced_evidence.
POST /disputes/{id}/filespayments:writeoptionalnoUpload a file to use as evidence: PDF, JPEG or PNG, up to 5 MB, base64-encoded.
GET /disputes/{id}/filespayments:readnonenoFiles uploaded for a dispute, newest first.
GET /disputes/{id}/suggested-evidencepayments:readnonenoA draft of the text evidence from what is on record: the session, what was bought, the delegated token and its limits, how the calling agent identified itself, and the times.
GET /customers/{id}/unmatched-depositspayments:readnonenoDeposits that could not be credited to a checkout session (wrong coin or chain, no reference, an unknown reference, or late), waiting for a person.
POST /customers/{id}/unmatched-deposits/{deposit_id}/assignpayments:writeoptionalnoCredit a deposit that was set aside to the checkout session it was meant for.
POST /customers/{id}/unmatched-deposits/{deposit_id}/refundrefunds:writerequiredyesSend a deposit that was set aside back, whole: to where it came from when that is on record, otherwise to destination.
GET /settlementssettlements:readnonenoCard proceeds on their way to the business's bank, newest first.
GET /settlements/{id}settlements:readnonenoOne settlement.
POST /settlementssettlements:writerequiredyesSend proceeds to the business's bank now.
GET /customers/{id}/balancescustomers:readnonenoWhat the customer holds per currency: card proceeds (available, pending) and stablecoin.
POST /payerspayments:writeoptionalnoRecord someone who pays a customer.
GET /payerspayments:readnonenoPayers, newest first.
GET /payers/{id}payments:readnonenoOne payer.
GET /payers/{id}/payment-methodspayments:readnonenoMethods the payer saved: brand, last four, expiry, and the mandate.
DELETE /payers/{id}/payment-methods/{method_id}payments:writenonenoForget a saved method and revoke its mandate.
POST /customers/{id}/payment-method-setupspayments:writeoptionalnoA hosted page where a payer saves a method for later, without paying now.
POST /subscriptionspayments:writerequiredyesCharge a payer on a schedule from a saved method.
GET /subscriptionspayments:readnonenoSubscriptions, newest first.
GET /subscriptions/{id}payments:readnonenoOne subscription.
POST /subscriptions/{id}/cancelpayments:writeoptionalnoEnd a subscription now or at the end of the paid period.
POST /meterspayments:writeoptionalnoA usage meter on a customer's merchant account, for billing by use.
GET /meterspayments:readnonenoMeters, newest first.
POST /meters/{id}/eventspayments:writeoptionalnoRecord usage by a payer against a meter.
GET /meters/{id}/summarypayments:readnonenoWhat a payer has used over a period.

Checkout sessions

POST /checkout-sessions
Authorization: Bearer sk_test_…
Idempotency-Key: 4c2a…

{ customer_id, amount | line_items, currency, ui?: skerry | hosted | embedded, success_url?, cancel_url?, methods?, payment_instructions?: { methods: [stablecoin | bank_transfer], wallet_id, chain?, coin? }, authentication?, capture?, save_method?, payer_id? | payer?, expires_at?, reference?, external_ref?, external_kind?, metadata? }

ui picks where the payer pays:

  • skerry: Skerry's own checkout. url is Skerry's page for the session on Skerry's host (https://api.skerry.xyz/checkout/{id}), and the same session can be mounted on your own page with Skerry's script or React package (below). success_url is optional: once the payment is confirmed the payer goes on to it, or sees Skerry's page saying it is paid. Open in an environment once Skerry's publishable key for it is set; until then the request answers 409 ui_unavailable.
  • hosted (the default): the card processor's own page. success_url is required.
  • embedded: the card processor's own embedded form; the response carries client_params for it.

The session carries its page's URL and share_url. The page offers the methods enabled for the business at the processor: cards and wallets always, bank debit and stablecoin only where the processor reports them active on the merchant account. methods is checked against that and does not narrow what the page shows; the response says what is offered. capture: "manual" holds funds for POST /payments/{id}/capture; save_method with a payer saves the method; authentication is automatic or required. expires_at must be between 30 minutes and 24 hours from now.

Build orders from payment.succeeded, never from the payer's browser returning to success_url. While a session is open, GET /checkout-sessions/{id} also asks the processor, so a missed webhook cannot mislead.

Under a mandate, a session or a payment link above the mandate's checkout_above is checked as checkout.create or payment_link.create, and a credential that may only act under a policy has its operation list checked whatever the amount.

POST /sandbox/checkout-sessions/{id}/complete with { outcome } acts as the payer: succeed, decline, run short of funds, or open a dispute.

POST /payment-links

{ customer_id, amount, currency, description?, reusable?, max_uses?, expires_at?, reference?, external_ref?, external_kind?, success_url? }

Single-use, capped or reusable. PATCH /payment-links/{id} with { status } pauses, resumes or disables one.

Where Skerry's own checkout is open, the link's share_url is Skerry's page for it: who is paid, how much, and a pay button. Pressing the button opens a ui: "skerry" session for the link (POST /pay-link/{id}/session), and the form appears in its place; success_url is where the payer goes once paid. A single-use or capped link is never over-sold: while its uses and the sessions still open for it reach the cap, the open session is handed out again, and once it is used up the link is completed, its other open sessions are closed and its page at the processor is switched off. Where Skerry's own checkout is not open, share_url sends the payer to the processor's page, as url does. A link also has a share_url; see agentic-checkout.md for what it answers a client that asks for JSON.

Skerry's form and pay button on your page

A ui: "skerry" session can be paid on your own page. Skerry's script draws the form in the Praecise look, light or dark, at any width. The card and wallet fields in it are the card processor's own embedded elements: the script loads the processor's script from the processor and mounts its fields with the processor's publishable key, so card data never reaches Skerry or you.

<div data-skerry-checkout="{checkout_session_id}"></div>
<div data-skerry-link="{payment_link_id}"></div>
<script type="module" src="https://api.skerry.xyz/js/skerry.js"></script>

Or from code, with @skerry/js (mountCheckout(element, { session, onComplete }), mountPayButton(element, { session | link, inline? })) or @skerry/react (<SkerryCheckout session={id} />, <SkerryPayButton link={id} />). Both are in skerry-clients. Without onComplete, the payer goes on to the session's return address, which goes on to success_url. data-skerry-theme (light, dark, auto) picks the look; a page may set the --skerry-* CSS variables on .skerry to adjust it. data-skerry-accent (or accent) gives the pay button the page's brand colour, used only where the words on it reach WCAG AA. data-skerry-locale (or locale, a BCP 47 tag; the browser's language by default) sets the language the amounts are written in and the processor's fields speak; messages gives the page's own words for Skerry's text, which is English, the source.

The script reads GET /checkout/{id}/client, which any origin may read: the amount, the lines, the merchant's name, and while the session is open the processor's script, publishable key, account and the session's client secret, which can pay this one session and nothing else. The processor sends a payer back to GET /checkout/{id}/return, which reads the outcome from the processor before going on. As always, build orders from payment.succeeded, not from the browser.

Payments

GET /payments/{id} returns status, fee, amounts received and refunded, and risk where the processor reports it. A payment that did not come by card also carries method (stablecoin, bank_transfer or machine), payer_ref and amount_overpaid; one an agent made carries agent and agent_identity. ?wait=<seconds up to 30>&until=<state> holds the request until the payment reaches a final state.

POST /payments/{id}/capture with { amount? } collects a hold, and may capture less than the hold. POST /payments/{id}/cancel releases a hold or abandons a payment that has not succeeded.

Charging a saved method

POST /payments
Idempotency-Key: 9d0f…

{ customer_id, payer_id, payment_method_id, amount, currency, off_session: true, authentication?, capture?, reference?, external_ref?, external_kind?, description?, metadata? }

The payer must have agreed to be charged later (mandate_required otherwise). The call is checked by the spend guard as payment.charge. A decline is returned as a payment with status: failed and a reason, not as an error, and does not count against a limit.

The other form of the body, { customer_id, amount, currency, payment_token: { type: "shared_payment_token", id }, … }, charges a delegated payment token an agent holds for its buyer. That is a preview: it answers 409 capability_off until it is switched on for the customer.

Payers, saved methods and subscriptions

A payer is someone who pays a customer. POST /customers/{id}/payment-method-setups with { payer_id | payer, success_url, cancel_url } returns a hosted page where the payer saves a method without paying; payment_method.saved follows. GET /payers/{id}/payment-methods returns brand, last four, expiry and the mandate, never a card number. DELETE /payers/{id}/payment-methods/{method_id} forgets the method and revokes its mandate.

POST /subscriptions
Idempotency-Key: 71be…

{ customer_id, payer_id, payment_method_id, currency, interval, interval_count?, items: [{ name, amount, quantity? }], trial_days?, reference?, external_ref?, external_kind?, dry_run? }

Each period's charge arrives as a payment and as subscription.payment_succeeded or subscription.payment_failed. Under a mandate that covers subscription.create, the amount of one period is checked against the mandate and counted once. POST /subscriptions/{id}/cancel with { at_period_end? } ends it now or at the end of the paid period.

Usage meters (/meters) are per account: they answer capability_off until a platform administrator switches them on.

Refunds

POST /payments/{id}/refunds
Idempotency-Key: a13c…

{ amount?, reason?, destination?: { address, chain? } | { payee_id }, external_ref?, external_kind? }

Checked by the spend guard as refund.create. Refused above what remains of the payment (refund_not_possible), in another currency (currency_mismatch), and for a method that cannot be refunded through the processor (refund_not_supported, before the processor is asked). refund.updated and payment.refunded follow.

A payment made by stablecoin or bank transfer is refunded by a payout back: to the sending address, or to the sending bank account through the banking partner's return of the deposit, where that is on record; otherwise to destination (refund_destination_required when neither exists). A bank deposit on ACH or FedNow goes back whole.

Disputes

GET /disputes/{id} carries the date evidence is due. Evidence is text fields, file fields and enhanced_evidence, from the lists the card processor accepts; a field outside them is refused by name.

POST /disputes/{id}/files
{ filename, content_type, data }

POST /disputes/{id}/evidence
{ evidence: { ... }, submit? }

A file is PDF, JPEG or PNG, up to 5 MB, base64-encoded; its id is then named in a file field. GET /disputes/{id}/suggested-evidence drafts the text evidence from what is on record (the session, what was bought, a delegated token and its limits, how the calling agent identified itself, the times) for a person to review; nothing is submitted by it. A dispute that is no longer waiting for a response refuses evidence and files with dispute_closed.

Settlements and balances

GET /settlements lists card proceeds on their way to the business's bank; POST /settlements with { customer_id, amount, currency } sends proceeds now and needs an Idempotency-Key. They are named settlements so they cannot be confused with payouts, which move stablecoin and bank transfers from the customer's balances at the banking partner. GET /customers/{id}/balances returns what the customer holds per currency: card proceeds (available, pending) and stablecoin.

Stablecoin and bank transfer at checkout

A session created with payment_instructions carries payment_instructions[]:

  • for stablecoin, a deposit address (and a memo where the chain uses one) for a named coin on a named chain;
  • for bank_transfer, the details of a virtual account and a reference the payer must quote.

wallet_id is the customer's wallet the money is delivered to. The instructions are bound to the session and expire with it. A customer without card acceptance can open a session that has instructions only: it has no hosted page, and expires after 24 hours unless expires_at says otherwise. A coin is accepted for a session only when it is pegged to the session's currency, one for one.

The session completes when the deposit arrives, as one payment with method, rail, amount_received, fee and the usual events. The rules for a deposit are in lib/pure/deposit-match.ts:

What arrivesWhat happens
The amount, as askedThe session completes; the payment succeeds.
The same deposit reported twiceCredited once.
Too littleThe session stays open with amount_remaining until it expires. Then the payment fails with underpaid, and what arrived is refundable.
Too muchThe session completes; the excess is amount_overpaid and refundable.
A second deposit to a session already paidAll of it is excess.
The wrong coin, the wrong chain, no reference, or a reference nobody issuedNever credited. It becomes an unmatched deposit (deposit.unmatched).
A deposit after the session expiredThe same: an unmatched deposit.

An unmatched deposit waits for a person:

GET  /customers/{id}/unmatched-deposits?status=
POST /customers/{id}/unmatched-deposits/{deposit_id}/assign   { checkout_session_id }
POST /customers/{id}/unmatched-deposits/{deposit_id}/refund   { destination?: { address, chain? } | { payee_id } }

refund sends it back whole and needs an Idempotency-Key; deposit.resolved follows either. One that is already assigned or sent back answers deposit_resolved.

POST /sandbox/checkout-sessions/{id}/deposit with { method?, amount?, coin?, chain?, reference?, state?, at?, deposit_ref? } acts as the payer on a session's instructions: pay it, underpay, overpay, pay late, or send the wrong coin, chain or reference.

Events

EventConcernsWhen
checkout_session.completedcheckout_sessionA payer finished a checkout session.
checkout_session.expiredcheckout_sessionA checkout session expired unpaid.
payment.requires_actionpaymentThe payer must authenticate before the payment can proceed.
payment.processingpaymentThe payer has paid by a method that settles later, such as a bank debit. Wait for payment.succeeded or payment.failed.
payment.authorizedpaymentFunds are held and waiting to be captured.
payment.succeededpaymentFunds were collected.
payment.failedpaymentThe payment was declined or failed.
payment.canceledpaymentAn authorisation was released before capture.
payment.refundedpaymentA payment was refunded, wholly or in part. Read data.status to tell which: refunded or partially_refunded.
payment.disputeddisputeThe payer's bank opened a dispute.
dispute.updateddisputeA dispute moved: evidence due, under review, won or lost.
refund.updatedrefundA refund changed state.
payment_method.savedpayment_methodA payer saved a method for later charges.
settlement.createdsettlementCard proceeds were sent towards the business's bank.
settlement.paidsettlementA settlement arrived.
settlement.failedsettlementA settlement failed.
subscription.updatedsubscriptionA subscription was created or changed.
subscription.canceledsubscriptionA subscription ended.
subscription.payment_succeededsubscriptionA recurring charge collected.
subscription.payment_failedsubscriptionA recurring charge failed.
deposit.unmatchedunmatched_depositMoney arrived that could not be credited to a checkout session: the wrong coin or chain, no known reference, or after the session expired. A person assigns it or sends it back.
deposit.resolvedunmatched_depositAn unmatched deposit was assigned to a session, or sent back.

The card processor's events these come from are in providers.md.

Written and kept by Skerry. Read from https://api.skerry.xyz/guides/payments.md.

This page as Markdown