Pay-link — customer present
expiresIn(milliseconds) shortens the link’s window; an unpaid link reads backEXPIRED.- Cancel an unpaid link with
payment.cancel(paymentRequestId)→CANCELLED, reasonMERCHANT_CANCELLED.
COMPLETED, FAILED, or
PENDING. Cancelling on the bank page gives CUSTOMER_CANCELLED.
Off-session — under a COLLECT contract [#off-session]
The customer approves the contract (and links a payment method) once at itsauthorizationUrl. After that you
charge under the contract while they’re away — pass the contractId, never a payment method.
limits on every charge. Check what’s left in the window before charging, rather than finding
out from a failed charge:
Charge on approval [#charge-on-approval]
A COLLECT contract can bundle a first charge into the customer’s single approval — one page both activates the contract and takes that payment (a joining fee, a deposit, the first bill). PassinitialCharge to
contract.create; don’t call payment.collect separately for charge #1.
initialCharge.
initialCharge.paymentRequestId only exists once the customer approves. After that, poll payment.get with it;
before it, match on your own orderId. A status of INITIATION_FAILED means the charge never started — the
contract still becomes ACTIVE.
Only take the first charge with payment.collect when the contract was created without an initialCharge.
Doing both charges the customer twice.
Pass storeId to attribute the charge to one of your stores. That store’s name and logo appear on the
customer’s contract page.
SCA on a charge
An off-session charge doesn’t settle until the customer approves it.payment.collect returns a nextAction (next_action in Python) holding an approvalUrl. Send the customer
there. They approve with a one-time code or a passkey on a page hosted by Atoa. Your app never sees the
credential.
nextAction.clientSecret to
confirmApproval from the Approvals SDK.
A declined charge comes back as FAILED with failureReason: APPROVAL_DECLINED. One nobody approved in time
comes back as APPROVAL_EXPIRED. Neither throws — read them off the Payment. In sandbox, open the
approvalUrl yourself and pick the decision you want to test.
Refunds
Refund aCOMPLETED collect, in full or in part. A refund moves INITIATED → COMPLETED (or FAILED).
cancelRefund(refundId). Sandbox: set reason to "FAILURE TEST" to
force a FAILED refund and exercise that branch.