Skip to main content

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.
A plan must exist before you can create a subscription. If you have not created a plan yet, go to Subscription Plans first, create a plan, and copy the planCode from the response. You will need it here.

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.
Set the following headers on every request:

How subscriptions work

When you call Create Subscription, three things happen in one request:
  1. Card enrolment — the customer’s card is validated and stored for recurring charges.
  2. First charge — if no trial period is set, the first payment is attempted immediately.
  3. Billing schedule — the next charge date is calculated and set based on the plan’s interval.
After that, Payaza handles all future charges automatically on each renewal date.
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.
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.
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.
Request body parameters

Response types

Check data.subscription.status to understand what happened, then check data.chargeResult for the payment outcome. Response 1 — Subscription active, first charge successful
Response 2 — Trial period active, no charge yet
Response 3 — 3DS authentication required
When status: "REQUIRES_ACTION", the subscription is created but the card has not been confirmed yet. You must complete the 3DS flow before Payaza can enrol the card and begin billing. See the Card Collections guide for the full 3DS HTML integration.

Key fields to save from the response


Error handling


Developer notes

  • Save data.subscription.id from every Create Subscription response — this integer id is what all lifecycle and read operations use (not planCode, not enrollmentReference).
  • One customerEmail can only have one active subscription per plan. If a customer tries to subscribe to the same plan twice, the API returns a 409 conflict. Cancel the existing subscription first if you need to re-subscribe them.
  • present: true in cardDetails is always required — it tells the system to validate the card data as part of enrolment.
  • When chargeMode is DIRECT_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, securityCode is 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.