API · Direct
Payment Methods
Tokenise a card, mobile wallet, or bank account once; reference the pm_ token on future charges. Sensitive PAN/CVC never reach your origin — they're posted directly from js.merashub.com to MerasPay's vault.
4 endpointspm_
Endpoints
POST
/v1/payment_methodsTokenise a card / mobile / bank payload into pm_.
GET
/v1/payment_methodsList payment methods (filter by customer).
GET
/v1/payment_methods/{id}Retrieve a tokenised payment method.
POST
/v1/payment_methods/{id}/detachRemove the customer link.
Create
| Name | Type | Description |
|---|---|---|
typerequired | enum | card · mobile_wallet · bank_account · agent_cash |
customer | cus_ | Attach to a customer for re-use. |
card | object | For type=card: { number, exp_month, exp_year, cvc, holder? }. Server-side only; for the browser flow, use Elements. |
mobile_wallet | object | For type=mobile_wallet: { provider, msisdn } |
bank_account | object | For type=bank_account: { provider, bank_name?, account_no, holder_name? } |
billing_address | object | AVS / 3DS2 enrichment fields. |
metadata | map | Free-form key/value. |
Sample · tokenise a mobile wallet
bashbash
curl -X POST https://api.merashub.com/v1/payment_methods \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{
"type": "mobile_wallet",
"customer": "cus_01HZ...",
"mobile_wallet": { "provider": "waafi", "msisdn": "+25377xxxxxxx" }
}'201 Createdjson
{
"id": "pm_01HZF...",
"type": "mobile_wallet",
"provider": "waafi",
"msisdn": "+25377xxxxxxx",
"customer_id": "cus_01HZ..."
}ℹ
Reference a pm_ on a future charge
POST /v1/payment_intents accepts payment_method: "pm_…" instead of inline fields. The provider, MSISDN/account, and customer are resolved from the token.⚠
Card tokenisation is browser-side
Card fields must be tokenised via @meraspay/sdk-js Elements — server-side card creation is restricted to PCI-certified callers. See the Card integration guide.