Contracts
contracts
Section titled “contracts”A contract is the agreement to perform a one-time or recurring payment. Every payment in Shuttle is linked to a contract — even one-off payments create a contract under the hood.
Payment Models
A contract can be created in one of three models:
- One-time: A single charge is created and payment is attempted immediately (or on a scheduled date)
- Recurring (frequency-based): Charges are generated automatically on schedule (weekly, monthly, etc.) and payment is attempted for each
- Scheduled charges: An explicit list of charges is supplied at creation, each with its own amount and due date. Use this when amounts or dates vary between charges (e.g., irregular instalment plans).
frequencymust be omitted or set toONEOFF;action: AUTHis not supported. A charge withdue: "now"or a past timestamp (within 24 hours) is taken synchronously during contract creation and a decline blocks the whole contract from being created. Charges with a futureduetimestamp are taken asynchronously by the scheduler on the due date, and the contract is created regardless of those later payments’ outcome. See List contract charges to retrieve the created charges.
For recurring contracts, if a significant change is made (amount, frequency), a new contract is created with a parent reference to the previous one. Changing the payment method or next payment date does not create a new contract.
Nonce (Duplicate Prevention)
Pass a nonce when creating a payment to prevent duplicate submissions. If the same nonce is submitted within 24 hours, no new contract will be created and the result of the previous contract will be returned.
Automatic Retries
Failed recurring payments are automatically retried on the following schedule:
Errors (e.g., gateway offline): 5 min, then 60 min, then 3 hours, then 6 hours, then 1 day
Declines (e.g., insufficient funds): 1 day, then 3 days, then 7 days, then 14 days, then 21 days
The retry_count tracks attempts and retry_complete is set when all retries are exhausted. A successful payment resets both. New instalments will still be attempted even after retry_complete.
Status Flow
A contract is in progress while it is ACTIVE, FAILING, PENDING, SUSPENDED, UNRESOLVED or CANCELLING, and finished once it is COMPLETED or CANCELLED. Within the in-progress statuses, the status tells you whether the contract needs attention, not whether it is running.
| Status | Description |
|---|---|
SETUP |
Contract is being configured |
ACTIVE |
Contract is active and charges are being generated/paid |
FAILING |
In progress, but a payment is at risk and needs attention. See below |
PENDING |
Payment has been made but is awaiting confirmation |
SUSPENDED |
Contract has been manually suspended |
UNRESOLVED |
No conclusive payment result received |
COMPLETED |
All charges have been paid |
CANCELLING |
Cancellation requested but outstanding balance remains |
CANCELLED |
Contract has been cancelled |
What FAILING Means
FAILING flags an in-progress contract that needs attention because a payment is at risk. It does not on its own mean a payment failed, and it does not mean the contract has stopped. It is set when:
- a collection has failed and is still owed (being retried, or in arrears once retries are spent)
- the contract has no usable payment method, for example because it was removed or archived
- on a recurring contract, the saved card expires before the next charge is due
The card expiry check runs as soon as the contract is activated, so a recurring contract can be FAILING straight after a successful first payment: you receive PAYMENT.SUCCESS and CONTRACT.START, and the contract reads FAILING. The first payment still succeeded; the contract is flagged early so the card can be updated before the next charge.
Treat every in-progress status as a live contract, FAILING included, and use the PAYMENT.* webhooks or the transaction to tell whether a payment succeeded. A contract leaves FAILING for ACTIVE once the cause is dealt with, for example when it is given a payment method that does not expire before the next charge (Change the payment method on a contract).
Was this page helpful?
What went wrong?
Thanks for telling us.