11. Security practices
Credentials #
- Call the API from your server only. The secret key never reaches a browser, an app or a URL users can see.
- Keep keys in a secret store or environment variables, not in code.
- Pay-in status requests carry the keys in the query string: redact them from your request logs.
- Rotate the secret key (merchant portal → Rotate keys) if it may have leaked, and periodically. The old secret stops at once.
- Everything is HTTPS. Plain HTTP is refused.
Webhooks #
- Your
webhookUrlandcallbackUrlare HTTPS, public, and answer 2xx within 8 seconds. - Every webhook's signature is checked over the raw body, and timestamps older than 5 minutes are refused.
- Duplicate deliveries are harmless: credit once per
transactionId, only onapproved. - Before crediting,
orderId,userIdandamountmatch the pay-in you created.
Pay-ins #
- Each deposit has its own
orderId. A timed-out create call is retried with the sameorderId. - Both your
orderIdand Royal Pay'stransactionIdare stored. - The customer is redirected to
paymentUrlin the browser they pay from, and nothing opens it first. - Pay-ins still
progressorpendingafter an hour are checked with 4. Get transaction status.
Payouts #
- Only whitelisted servers (IPs registered with Royal Pay) can call payout endpoints.
- Payouts go through your own approval process before you call the API: each call moves real money.
- Payouts are followed by webhook or status until
completed, and areversedaftercompletedis handled.