• Keep the secret server-side only — not in frontend code, not in Git, not in logs. Use environment variables or a KMS.
  • Live and test keys have different prefixes (sk_live_ / sk_test_) so a mix-up is visible at a glance.
  • Enable the IP allowlist. The merchant API is meant for your server only; browsers should never call it directly.
  • Deliver only after signature verification, and cross-check amount and order reference against your own records.
  • Poll the query endpoint as a fallback for missed webhooks.
  • Refund to the original address only. Never accept a user-supplied address — that is the standard shape of overpayment fraud.