# Modem Pay

> Set up Modem Pay in the Gambia to collect Wave, Afrimoney, QMoney, APS, Yonna and card payments in GMD with your own live secret key and automatic callbacks.

Source: https://docs.centipidbilling.com/billing/payment-gateways/modempay

## Collect payments with Modem Pay

`MODEMPAY` sends the payer to **Modem Pay's hosted checkout**, where they can pay
with **Wave, Afrimoney, QMoney, APS, Yonna or a card** in Gambian dalasi (`GMD`),
then return to your captive portal.

Centipid Billing creates a Modem Pay payment intent, redirects the payer to its
`payment_link`, and confirms the payment through a signed per-payment callback
plus a server-side status check against Modem Pay before anything is credited.

The money goes into **your own Modem Pay account**. Centipid Billing never holds
it. Offered in the country catalog for **The Gambia (`GM`)** only.

## Before you start

1. Open a live Modem Pay business account owned by your ISP and finish
   verification.
2. Your Centipid Billing account must bill in `GMD`. Packages priced below
   **GMD 10** cannot be charged through Modem Pay.

## Configure the gateway

#### Open Settings → Payments → Modem Pay

Select **Modem Pay** from the payment marketplace (or create a Modem Pay
payment account under **Settings → Payments → Payment accounts** to assign
it to specific routers or services).

#### Copy your live secret key

In your Modem Pay dashboard, switch to **Live mode**, open
**Developers → API Keys**, and copy your live secret key (starts with
`sk_live_`). Paste it into **Live secret key**. Test keys (`sk_test_`) are
refused.

#### No webhook setup required

Centipid Billing sends a per-payment `callback_url` with every checkout, and
Modem Pay signs those callbacks with a hash of your live secret key. You do
not need to register a webhook URL in Modem Pay.

#### Run a controlled live payment

Pay a small plan of at least **GMD 10** from the captive portal on a device
that is not logged in, and confirm the payment reaches your ledger and the
subscriber connects.

## Credentials

| Field | Required | Notes |
|---|---|---|
| Live secret key | Yes | Secret, stored encrypted. Must start with `sk_live_`. From **Developers → API Keys** in your Modem Pay dashboard. |

## How a payment completes

1. Centipid Billing checks that the ISP bills in `GMD`, has a live `sk_live_`
   key saved, and the plan is at least **GMD 10**, then creates a payment
   intent on `https://api.modempay.com/v1/payments` with our reference in
   `metadata` and in `callback_url`.
2. The payer completes payment on `checkout.modempay.com` and returns to
   `/api/modempay/return`.
3. Modem Pay posts `charge.succeeded` to our callback URL, signed in
   `x-modem-signature` (HMAC-SHA512 keyed with lowercase hex SHA-256 of your
   live secret key). Centipid Billing verifies the signature, then calls
   `GET /v1/payments/verify?intent_secret=…` using the `intent_secret` stored
   at initiation.
4. Access is granted only when Modem Pay reports `successful`, `test_mode` is
   `false`, the metadata reference matches, and both amount and currency (`GMD`)
   match. Repeated callbacks update the same payment instead of crediting twice.
5. If a callback is lost — or if you roll your API key in Modem Pay before
   updating Centipid Billing — the background status poll still checks
   `/v1/payments/verify` and connects the paid customer automatically.

## Walled garden

For MikroTik hotspot routers, Centipid Billing adds `checkout.modempay.com`,
`api.modempay.com`, Wave's hosts (`pay.wave.com`, `wave.com`, `www.wave.com`,
`api.wave.com`), and `na-gateway.mastercard.com` to the hotspot payment walled
garden automatically.

## Troubleshooting

| Symptom | What it means | What to do |
|---|---|---|
| *"Use your Modem Pay live secret key. It starts with sk_live_."* | A test key (`sk_test_`) or public key was pasted. | Switch Modem Pay to **Live mode** and copy the `sk_live_` secret key. |
| *"Modem Pay takes payments of GMD 10 or more."* | The selected plan is priced under GMD 10. | Raise the package price to GMD 10 or higher. |
| *"Modem Pay takes payments in GMD only."* | The workspace billing currency is not `GMD`. | Contact Centipid support to set your billing currency to `GMD`. |
| Payments succeed in Modem Pay after rolling your API key | Modem Pay signs callbacks with your newest live key, so old-key signatures fail until updated. | Paste the new `sk_live_` key into **Settings → Payments → Modem Pay**. In-flight payments are still recovered by the status poll once the new key is saved. |

For every gateway's fields in one place, see the
[credential reference](https://docs.centipidbilling.com/billing/payment-gateways/credentials-reference).
