Skip to main content
API documentation

7 endpoints

Payment links

An amount, a description, a link to send. The customer pays on a page hosted by ChariPay — you host no card data.

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

In plain English

A ready-to-share payment page — no website needed.

When to use it

For an invoice, a quote, a remote sale, a WhatsApp sale or a cash payment at an agency. It is the fastest integration: one call is enough to get paid.

How to integrate it

  1. 1Create the link with the amount and a description; add your externalId so you can replay the call safely.
  2. 2Share the link you get back — or its QR code, or the print-ready PDF poster for payments at the counter.
  3. 3For a cash payment, create the link with paymentMethod: CASH: the payer receives a code (cashinCode) to present at an agency, and the payment.succeeded webhook confirms the payment — same mechanics as card.
  4. 4Receive the payment-succeeded webhook and match it to your order through the externalId you supplied.
  5. 5Cancel the link if the sale falls through: a cancelled link can no longer be paid.

Sandbox test card

The sandbox runs on real rails against a test environment: the flows are genuine, the money is not. Only one card is accepted there.

Only this PAN is accepted. Any other number — including the 4242… cards from other platforms — is rejected upstream, usually with a 502 and the stable BAAS_CHARI_ERROR code. If you hit that error while testing, check the card number you entered first.

POST202

E-mail a payment link

Sends the payment link by e-mail to the given address, or the link's stored customer e-mail if no body is provided. Returns 202 Accepted.

Schema · SendPaymentLinkRequest

FieldTypeInRequiredDescription
referencestringpathRequired
emailstringbodyOptionalRecipient e-mail; falls back to the link's stored customer e-mail when omitted.
POST

Cancel a payment link

Deactivates the link so it can no longer be paid. Idempotent; returns the updated link.

FieldTypeInRequiredDescription
referencestringpathRequiredPayment-link reference.
POST200

Create a payment link

Creates a reusable (or single-use) payment link. Supply an optional client-owned externalId (unique per merchant) to make the create idempotent: a duplicate externalId returns the existing link with 200 OK instead of creating a new one. Returns the link including its buyer-facing payUrl.

Schema · CreatePaymentLinkRequest

FieldTypeInRequiredDescription
Idempotency-KeystringheaderOptionalOptional idempotency key; replaying the same value returns the first result.
amountnumberbodyRequiredAmount to collect, in MAD major units.
descriptionstringbodyRequiredShort description shown to the buyer.
singleUsebooleanbodyOptionaltrue = link is consumed after one successful payment; false = reusable. Defaults to true.
paymentMethodenumbodyOptionalDefault method shown on the hosted checkout. Defaults to CARD.Values CARDCASH
customerNamestringbodyOptionalOptional buyer name.
customerEmailstringbodyOptionalOptional buyer e-mail.
customerPhonestringbodyOptionalOptional buyer phone (E.164).
expiresAtstring (date-time)bodyOptionalOptional expiry (ISO-8601 UTC). Must be in the future.
acceptUrlstringbodyOptionalBuyer is redirected here after a successful payment (https:// only).
declineUrlstringbodyOptionalBuyer is redirected here after a failed/declined payment (https:// only).
notificationUrlstringbodyOptionalPer-link webhook target (https:// only), in addition to registered endpoints.
externalIdstringbodyOptionalOptional client-supplied id, unique per merchant. Creating a link with an externalId that already exists returns the existing link (idempotent replay).
metadataobjectbodyOptionalOptional free-form metadata object, echoed back on reads and in the payment webhook when the link is paid.

Talk to an integrator

A question about integration?

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