Payment link creation API
Creates a payment link for your shop. You redirect the customer to the returned paymentLink, and Papi notifies your notificationUrl when the payment status changes.
For a step-by-step walkthrough of the whole payment flow, see the integration guide.
Endpoint
POST https://app.papi.mg/engine/api/payment-links
| Item | Value |
|---|---|
| Base URL | https://app.papi.mg/engine/api |
| Path | /payment-links |
| Method | POST |
| Request body | JSON |
| Response body | JSON |
POST https://app.papi.mg/dashboard/api/payment-links is still accepted for existing integrations. It forwards the request to the engine unchanged and returns the engine's answer unchanged, so the behaviour described on this page is the same on both URLs. The only difference: if the engine cannot be reached, the legacy URL answers 503 with the code ENGINE_UNAVAILABLE. Use the engine URL for new integrations.
Authentication
Every request must carry your shop's API key in the Token header. You find the API key in the dashboard: Avatar icon → Boutiques → select shop → Developer tab.
The link is created in the shop that the API key belongs to. Idempotency (see Idempotency) is also evaluated inside that shop.
A missing or unknown API key is answered with 400 (not 401) on this endpoint. See Errors.
Request headers
| Header | Required | Value | Description |
|---|---|---|---|
Token | ✓ | <YOUR_API_KEY> | API key of your shop. |
Content-Type | ✓ | application/json | The body is JSON. The legacy dashboard URL refuses any other content type. |
No other header is read by this endpoint. In particular, the LinkToken header used by the payment page is not accepted as an authentication method here.
Body parameters
| Field | Type | Required | Constraints / validation | Description |
|---|---|---|---|---|
amount | number | ✓ | Not null. Minimum 300. | Amount to pay, in currency. |
reference | string | ✓ | Not blank. | Your identifier for this payment (for example, your order ID). It is the idempotency key: see Idempotency. It is returned as paymentReference in the creation response and as merchantPaymentReference in notifications and in the read-back. |
clientName | string | ✓ | Not blank. | Customer's name. |
description | string | ✓ | Not blank. Maximum 255 characters. | Short description of the payment. |
successUrl | string | ✗ | Must start with http:// or https://. Must be sent together with failureUrl. | URL the customer is redirected to after a successful payment. |
failureUrl | string | ✗ | Must start with http:// or https://. Must be sent together with successUrl. | URL the customer is redirected to after a failed payment. |
notificationUrl | string | ✗ | Must start with http:// or https://. | Your endpoint that receives payment notifications. Strongly recommended. Without it, read the outcome with the Get payment link status API. |
validDuration | integer | ✗ | Integer greater than 0, at most 596. Default: 1. | Validity of the link, in hours, counted from its creation (596 hours is about 24 days). |
provider | string | ✗ | One of MVOLA, AIRTEL_MONEY, ORANGE_MONEY, BRED. | Restricts the link to one provider. When omitted, the customer chooses on the payment page. |
currency | string | ✗ | A currency code known to Papi (ISO 4217 style, uppercase). Default: MGA. | Currency of amount. Only MGA is settled today: send MGA or omit the field. Another known code is accepted by this endpoint, but Papi does not settle payments in it. |
displayCurrency | string | ✗ | Only MGA is accepted. Default: MGA. | Currency shown to the customer on the payment page. |
payerEmail | string | ✗ | Valid email address. An empty string is treated as absent. | Customer's email address. |
payerPhone | string | ✗ | Valid phone number. Allowed characters: digits, +, -, space, (, ), .. Numbers without a country code are read as Malagasy numbers. An empty string is treated as absent. | Customer's phone number. It is returned in international format (for example +261 34 00 000 00). |
testReason | string | ✗ | None. | Reason for the test. Shown in the dashboard. |
paymentTester | string |