Subscriptions are part of Accept, which is in early access and subject to change. To request
Accept access, contact hi@natural.com.
POST /subscriptions, a subscription with no end sets terms.amount, the amount of every payment (at least $0.50), and terms.every, its one interval. Its terms.paymentCount reads null.
Installments
A subscription in installments splits one purchase into 2 to 4 payments. InPOST /subscriptions, set the purchase’s total in terms.totalAmount, the number of payments in terms.paymentCount, and the time between payments in terms.every, on the same intervals as one with no end.
terms.payments.
Payment 1 is charged in checkout, on the day the payer agrees, and payment n falls n-1 intervals after that day. A payer who agrees on Jan 31 to monthly payments pays on Jan 31, Feb 28 and Mar 31. Checkout shows the payer every date before they agree, and the dates don’t change after that. nextPayment.dueDate gives the next one.
Tax
amount and totalAmount are what the payer pays, tax included. To say how much of it is tax, set terms.taxAmount, which defaults to 0. Every payment of a subscription with no end carries taxAmount. In installments, the tax is split the same way as its total, with the cents that don’t divide evenly on payment 1, and terms.payments lists each payment’s taxAmount. Each payment’s payment intent carries its share. The agreement the payer accepts names each payment’s tax, and each payment’s receipt shows its tax.
Lifecycle
- Create a subscription with
POST /subscriptions. It startspendingand returns apayUrland aclientSecret. To stop checkout taking payment after a deadline, setexpiresAt. A pending subscription can’t be changed, and neither can its checkout’s payment intent. To offer other terms, end the subscription (see Canceling) and create a new one. - The payer agrees to the terms and pays payment 1 in checkout. The subscription becomes
active. - Natural charges each later payment automatically when it falls due. A payment can be charged from 12:00 UTC on its due date until 30 days later, or until the next payment opens if that’s sooner.
GET /card-payments?subscriptionId={subscriptionId}lists every card payment whosesubscriptionis that subscription, newest first: each attempt at each payment, payment 1’s checkout attempts included. - A subscription becomes
canceledwhen the payer or you cancel it, when the payer’s bank stops its agreement, when checkout ends or expires without payment 1, or when the agreement can’t be set up. One in installments becomescompletedonce every payment is paid or marked paid. A canceled subscription stays canceled, even if a charge already under way then pays its last payment.
GET /subscriptions lists your subscriptions, newest first. Pass status to list only those in one status, such as needs_attention.
Embed checkout
To take payment 1 on your own page instead of sending the payer topayUrl, pass the subscription’s clientSecret from your server to the payer’s browser. It’s set whenever payUrl is, so it’s null once checkout ends. Treat it like a password. Mount Natural’s payment form with it:
TypeScript
Missed payments
Natural retries a declined payment within its window. If retries run out or the window closes unpaid, the payment becomesmissed and the subscription is past_due. Natural makes no more attempts on that payment. The payer can pay it from their subscription page. If you collect it another way, mark it paid right away, which removes the payer’s Pay button. Later payments are still charged on schedule.
List missed payments with GET /subscriptions/{subscriptionId}/payments?status=missed. Each payment has its own spm_ ID, payment number, amount and due date. The list returns the newest payment number first. Pass meta.pagination.nextCursor as cursor to read earlier payments. Omit status to include open, missed, paid and canceled payments. Payments continue to come due while collection is paused.
A subscription becomes needs_attention, and Natural pauses collecting, when the bank declines the card in a way that rules out a retry. attention.reason says why.
Once you’ve collected a missed payment another way, use its ID in POST /subscriptions/{subscriptionId}/payments/{subscriptionPaymentId}/mark-paid with data.attributes set to {}, so it’s no longer owed. That includes a payment whose window closed while the subscription was paused. Marking a payment paid first records any earlier payments that already lapsed as missed, so they stay owed until you mark them paid too. Marking paid only settles a missed payment: it doesn’t settle an upcoming one, and it doesn’t restart a subscription that needs attention.
Marking paid changes the payment’s status to paid and sets resolution.type to marked_paid. Its resolution.recordedAt is when Natural recorded the resolution, which may be later than when you collected the money. Its due date and missedAt stay on the record. A payment paid by card has resolution.type set to card_payment and a resolvingCardPayment relationship. Earlier declined card attempts stay in the card payments list. Imported history can have a null missedAt or resolution.recordedAt when the original time was not recorded. A null time does not change the payment status.
Canceling
You can cancel a subscription withPOST /subscriptions/{subscriptionId}/cancel. The payer of a subscription with no end can also cancel it online, on its manage page. The payer of one in installments can view it there but can’t cancel it, because they still owe its remaining payments. When a subscription is canceled, its status becomes canceled. Natural charges nothing more and emails the payer a confirmation. A charge already under way when the subscription is canceled can still go through, and the subscription’s payments stay listed.
Canceling a subscription that’s still pending cancels its checkout instead, so the payer can’t pay payment 1, and the subscription becomes canceled. You get paymentIntent.canceled and subscription.canceled, and the payer isn’t emailed. If the payer has already submitted payment 1, the cancel is refused with subscription_pending until its outcome lands. Once it’s paid and the subscription is active, a cancel works as above.
The payer reaches the manage page from Natural’s emails. The subscription’s confirmation, each receipt and each failed-payment email link to it: “Manage or cancel” for a subscription with no end, “View your installment payments” for installments. Hosted checkout’s confirmation links to it too, for a subscription with no end. The link asks for a code sent to the email the payer confirmed in checkout.
The manage page shows the subscription’s terms and status, its next payment, its payments and the card on file. There the payer can update the card, pay a missed payment, and, for a subscription with no end, cancel.
Subscription payments and webhooks
Every charge attempt for a subscription is a card payment. A subscription payment records what is owed. Several card payments can be attempts to pay it. Each attempt carries these fields:subscriptionhas the subscription’sid, thepaymentNumberthe charge pays, and itspaymentCount, which is null when it has no end. Payment 1 is the checkout payment.- A later payment has
channelapi, because Natural charged the card without the payer present.
GET /card-payments?subscriptionId={subscriptionId} and GET /card-payments/{cardPaymentId}. Every charge, payment 1 included, sends cardPayment.created, then cardPayment.succeeded or cardPayment.failed, each with the same fields. A successful charge also sends paymentIntent.completed.
Subscription status changes send one of four events. Each has the subscription’s snapshot, which includes its status, next payment and attention reason, and data.previousStatus, the status it left.
subscription.activated: the payer paid payment 1 and its agreement was set up, so the subscription is nowactive.subscription.updated: the status changed in any other way that doesn’t end the subscription, such asactivetopast_dueorneeds_attention.subscription.canceled: the subscription becamecanceled, for any reason in Lifecycle. That includes apendingsubscription whose checkout was canceled, expired or ended without payment 1, so you can get it for a subscription that never sentsubscription.activated.subscription.completed: every payment of a subscription in installments is paid or marked paid.
GET /subscriptions/{subscriptionId}/payments for payment status and resolution history. Marking a payment paid sends a subscription event only if it changes the subscription’s status.