Overview
A Subscription links a customer’s card to a plan and starts the recurring billing cycle. Once created, Payaza automatically charges the card on every billing date defined by the plan — you do not need to trigger each charge manually.Key Requirements
Retrieve your API keys from your dashboard by following the steps on our Authentication page. Use your public API key for all subscription requests.
How subscriptions work
When you call Create Subscription, three things happen in one request:- Card enrolment — the customer’s card is validated and stored for recurring charges.
- First charge — if no trial period is set, the first payment is attempted immediately.
- Billing schedule — the next charge date is calculated and set based on the plan’s interval.
No trial period — immediate charge
No trial period — immediate charge
The subscription is created and the first charge is attempted right away. If the card is charged successfully, the subscription status becomes
ACTIVE and nextChargeDate is set to one billing cycle from now.If the charge fails, the subscription enters INCOMPLETE status until a successful payment is received.With trial period — deferred charge
With trial period — deferred charge
The card is enrolled immediately but no charge is attempted. The subscription status becomes
TRIALING. The first charge is deferred until the end of the trial period. Until then, the customer has free access.3DS authentication required
3DS authentication required
Some cards require the customer to complete a 3D Secure challenge before the first charge can go through. In this case, the subscription is created with a status of
REQUIRES_ACTION and the response includes threeDsUrl, formData, and threeDsHtml — handle these exactly as described in the Card Collections guide.Once the customer completes the 3DS challenge, the subscription moves to ACTIVE.Subscription statuses
Understanding what each status means before you build will save you debugging time later.Create a Subscription
cardDetails is mandatory. You cannot create a subscription without a card — Payaza uses it to enroll the customer for all future recurring charges.Response types
Checkdata.subscription.status to understand what happened, then check data.chargeResult for the payment outcome.
Response 1 — Subscription active, first charge successful
Key fields to save from the response
Error handling
Developer notes
- Save
data.subscription.idfrom every Create Subscription response — this integeridis what all lifecycle and read operations use (notplanCode, notenrollmentReference). - One
customerEmailcan only have one active subscription per plan. If a customer tries to subscribe to the same plan twice, the API returns a409conflict. Cancel the existing subscription first if you need to re-subscribe them. present: trueincardDetailsis always required — it tells the system to validate the card data as part of enrolment.- When
chargeModeisDIRECT_CHARGE, Payaza charges the card directly on each billing cycle. The card service determines the charge mode automatically during enrolment — you do not set it. - For NGN cards,
securityCodeis the card’s CVV. For some non-NGN cards, a PIN may be required — refer to the Card Collections guide for PIN handling.
What’s next
Now that you have an active subscription, explore how to manage it over time:Subscription Lifecycle
Pause, resume, cancel, or move a customer to a different plan.
Subscription Reads
Fetch subscription details, charge history, upcoming charges, and event logs.