Four things before your first call:
1. Get your API credentials
Your consumer key identifies your merchant account. Live vs demo is derived from the credential — it is never a request parameter (a V3 weakness V4 removes). Manage keys in the merchant dashboard under Settings → API Keys.
2. Generate an RSA keypair
V4 keeps V3's best property: requests are signed with your private key, so the gateway never holds a secret that could forge a merchant request. Generate a 2048-bit keypair and upload the public key in the dashboard. The private key never leaves your servers.
openssl genrsa -out pokeapay_v4_private.pem 2048
openssl rsa -in pokeapay_v4_private.pem -pubout -out pokeapay_v4_public.pem
3. Whitelist your egress IPs
Every API call must originate from an IP you have whitelisted (dashboard → Settings → API Keys → IP Whitelist). Calls from other addresses are rejected before any processing.
4. Understand the money format
Amounts are integer minor units: KES 545.00 is "amount_minor": 54500 with "currency": "KES". Responses use the same convention (balance_minor). Never send decimals.