Payments API
Security baseline
- HTTPS only for API and webhook URLs. The merchant portal rejects webhook targets that use private/reserved addresses, localhost, or embedded credentials; outbound delivery also skips targets that fail the same checks (including DNS resolution to a non-public IP when enabled).
- Optional API IP allowlist (portal → Developers → API security, Portal admin only, or admin merchant edit): when configured,
POST /v1/oauth/tokenand all bearer-authenticated routes are rejected unless the client IP matches an allowed IPv4/IPv6 address or CIDR. Empty allowlist means no IP restriction. Behind a reverse proxy, setTRUSTED_PROXIESso the application sees the real client IP. - Tenant isolation — Bearer tokens are scoped to one merchant. Lookups by public ID or
merchant_referencenever return another merchant’s records (missing resources respond 404). - OAuth — Invalid or unknown
client_idvalues still run secret verification against a fixed hash to reduce timing leaks; per-IP and per-client rate limits apply toPOST /v1/oauth/token. - Never send
client_secret/access_tokenin query strings or redirect URLs. - Verify every outbound webhook from MojoPay using
MojoPay-Signaturebefore changing state (see Verify webhook signatures). - Use constant-time signature comparison (
hash_equals,timingSafeEqual). - Hosted checkout offers mobile money on the pay page, plus card only when MojoPay has enabled card checkout for your merchant.