Skip to main content
API documentation

7 endpoints

Subscriptions

A payment link e-mailed at every due date, with its reminders, pauses and history.

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

Start in test mode

You create your test key in the portal as soon as your account is activated.

In plain English

Send the same customer a payment link at regular intervals.

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 e-mail, since every instalment is sent there — with its cadence and its amount.
  2. 2At each due date, ChariPay generates a single-use payment link and sends it to the customer; the first payment moves the subscription from INCOMPLETE to ACTIVE.
  3. 3While an instalment is unpaid, a reminder goes out every day and no new period opens; the link stays payable for 14 days after the due date, then the subscription is cancelled — watch subscription.payment_succeeded, subscription.payment_failed and subscription.canceled.
  4. 4Pause, resume or cancel as the contract evolves; read the instalments for your invoicing.
  5. 5In the sandbox, a start date set to today opens the first instalment immediately; a DAILY frequency brings the next one the following day.
POST

Resume a subscription

Resumes a paused subscription's billing cycle. Periods elapsed while paused are not billed retroactively.

FieldTypeInRequiredDescription
referencestringpathRequired
POST

Pause a subscription

Suspends the subscription: no new period is opened and no payment link is sent until /resume.

FieldTypeInRequiredDescription
referencestringpathRequired
POST

Cancel a subscription

Permanently ends the subscription. No further payment link is 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 subscription for an existing client; the returned status is INCOMPLETE until the first period is paid. At each due date a single-use payment link is generated for the period and e-mailed to the client, who pays it on the hosted checkout with 3DS. While a period stays unpaid, a reminder is e-mailed daily and no later period is opened; a link left unpaid 14 days after its due date cancels the subscription. 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). The client needs an e-mail address: each period's payment link is sent there.
amountnumberbodyRequiredAmount of each period's payment link, in MAD major units.
descriptionstringbodyRequiredDescription shown on each generated payment link.
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 send each period's payment link to the client. EMAIL is the supported channel.
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.
GET

List a subscription's charges

Returns every charge generated by the subscription (one single-use payment link per billing period), most recent period first.

FieldTypeInRequiredDescription
referencestringpathRequired
GET

Retrieve a subscription

Fetches a subscription with its lifecycle state and its open charge: the current period's payment link, when one is open.

FieldTypeInRequiredDescription
referencestringpathRequiredSubscription reference.

Talk to an integrator

Make your first test-mode call

Create your account, generate your test key in the portal and send your first request today — or talk to an integrator.

  • Free, no commitment
  • Test mode from sign-up
  • No approval to wait for