Skip to main content
API documentation

9 endpoints

Subscriptions

A recurring charge on a saved payment method, with its due dates, pauses and dunning.

Endpoint names and descriptions come from the OpenAPI contract, in English — they cannot drift from the API.

In plain English

Charge the same customer at regular intervals, automatically.

When to use it

For any recurring revenue: monthly subscription, plan, or a service billed in instalments.

How to integrate it

  1. 1Create the subscription for an existing customer — one with a valid email, since the mandatory pre-debit notice always goes out by email — with its cadence and its amount.
  2. 2The first payment happens with the customer present, with their explicit consent to store their payment method.
  3. 3Set the payment method to charge, or leave the client's default.
  4. 4Pause, resume or cancel as the contract evolves; consult the due dates for your billing.
  5. 5When a charge fails, the subscription turns PAST_DUE: up to 4 automatic attempts, a fallback payment link sent to the customer, then cancellation — watch subscription.payment_failed and subscription.canceled.
  6. 6In the sandbox, a dedicated endpoint forces the next due date so you can test a year of subscription in a minute.
PUT

Select a subscription payment method

Switches an auto-pay subscription to one of its client's saved payment methods. Only the local payment-method UUID is accepted; provider tokens and CVV are never exposed.

Schema · SelectSubscriptionPaymentMethodRequest

FieldTypeInRequiredDescription
referencestringpathRequired
paymentMethodIdstring (uuid)bodyRequiredClient-owned local payment-method UUID.
POST200

Force the next automatic payment (sandbox only)

Test helper available only with a SANDBOX API key. It creates or reuses the charge for the currently outstanding period, queues the pre-debit e-mail, and immediately executes the saved-token payment with its internally decrypted CVV and 3DS disabled. The CVV never appears in the request or response. The subscription must be INCOMPLETE, ACTIVE or retryable PAST_DUE, autoPay must be enabled, and the first keepAlive + 3DS checkout must already have attached a saved payment method. On success, nextRunDate advances. On failure, it does not advance: an initial failure stays INCOMPLETE; a renewal failure becomes PAST_DUE. The response contains a safe failure category/code, attempt count, retry/cancellation timing and fallbackPayUrl. Hard declines such as an expired card require a replacement payment method or manual payment. Idempotency-Key is mandatory; replaying it returns the same operation without another debit.

FieldTypeInRequiredDescription
referencestringpathRequiredSubscription reference.
Idempotency-KeystringheaderRequiredRequired unique key. Reuse it only to replay this exact test request.
POST

Resume a subscription

Resumes a paused subscription's billing cycle.

FieldTypeInRequiredDescription
referencestringpathRequired
POST

Pause a subscription

Suspends future charges without cancelling. Resume later with /resume.

FieldTypeInRequiredDescription
referencestringpathRequired
POST

Cancel a subscription

Permanently ends the subscription. No further charges are generated.

FieldTypeInRequiredDescription
referencestringpathRequired
GET

List subscriptions

Returns the caller's subscriptions for the key's environment, as a paginated Page.

FieldTypeInRequiredDescription
originenumqueryOptionalFilter by creation origin (API or DASHBOARD).Values APIDASHBOARD
pageablePageablequeryRequired
POST200

Create a subscription

Starts a recurring subscription for an existing client. Auto-pay defaults to true; the returned status is INCOMPLETE until the first billing period succeeds. The first hosted checkout uses 3DS, saves a provider token, masks the PAN and stores reusable authentication material in the restricted audited vault. Neither token nor CVV is returned. Future charges are announced by e-mail and collected at billingTime in Africa/Casablanca. If the start date is today or earlier, the first charge is opened immediately and returned in currentCharge. Supply an optional client-owned externalId (unique per merchant) to make the create idempotent: a duplicate externalId returns the existing subscription with 200 OK.

Schema · CreateSubscriptionRequest

FieldTypeInRequiredDescription
clientIdstring (uuid)bodyRequiredUUID of the client to bill (create it first via /v1/clients).
amountnumberbodyRequiredAmount to charge each period, in MAD major units.
descriptionstringbodyRequiredDescription shown on each generated charge.
frequencyenumbodyRequiredBilling cadence.Values DAILYWEEKLYMONTHLYYEARLY
startDatestring (date)bodyRequiredDate of the first billing period (YYYY-MM-DD).
endDatestring (date)bodyOptionalOptional end date; open-ended when omitted.
channelsarray of enumbodyRequiredChannels used to notify the client of each charge.
externalIdstringbodyOptionalYour subscription identifier, unique per merchant and environment. Creating a subscription with an externalId that already exists returns the existing subscription. It is echoed as ExternalId in every subscription payment webhook for reconciliation.
metadataobjectbodyOptionalOptional merchant-owned reconciliation attributes (maximum 4 KB serialized), echoed unchanged as metadata in every subscription payment webhook. Use opaque identifiers such as customerId or contractId; do not include card data, CVV, credentials, or unnecessary personal data.
autoPaybooleanbodyOptionalSave the payment method after the first 3DS payment and automatically collect future periods. Defaults to true.
billingTimeLocalTimebodyOptionalRecurring charge time in Africa/Casablanca.
billingTime.hourinteger (int32)bodyOptional
billingTime.minuteinteger (int32)bodyOptional
billingTime.secondinteger (int32)bodyOptional
billingTime.nanointeger (int32)bodyOptional
reminderDaysBeforeinteger (int32)bodyOptionalHow many days before an automatic debit to e-mail the client (0-30).
paymentMethodIdstring (uuid)bodyOptionalOptional client-owned payment-method UUID. When omitted, the client's default payment method is reused when one exists; otherwise the first checkout captures a new method.
GET

List a subscription's charges

Returns every charge (payment link) generated by the subscription, most recent period first.

FieldTypeInRequiredDescription
referencestringpathRequired
GET

Retrieve a subscription

Fetches a subscription, its safe saved-method display data, open charge and billing recovery state. For a failed INCOMPLETE setup or PAST_DUE renewal, billingRecovery contains a normalized reason, customer action, attempt count, next retry and cancellation deadline; provider error JSON and sensitive card data are never returned.

FieldTypeInRequiredDescription
referencestringpathRequiredSubscription reference.

Talk to an integrator

A question about integration?

Our technical team supports integrators from the first sandbox call through to go-live.