Skip to content
Payments · Secret guide

Leaked PayMongo Secret Key: what to do in the first hour

High severityDetected onlyLast verified · 4 min read

A PayMongo secret key lets whoever holds it call the PayMongo API on your merchant account. That includes creating payments and payment links, reading payment and customer details, and issuing refunds. The danger is unauthorized payment activity and exposure of customer data. PayMongo has no revoke without replace: revoking a key means regenerating it. So regenerate first, then investigate.

Check your GitHub account for leaked secrets — free

Provider
PayMongo
Severity
High
Impact
Payments and customer data
Checked live by LeakWatch
No

What a PayMongo secret key looks like

PayMongo keys carry a prefix that tells you the type and the mode. Secret keys start with sk_ and public keys start with pk_, followed by test_ or live_:

sk_live_XXXXXXXX…   secret key, live mode (masked)
sk_test_XXXXXXXX…   secret key, test mode (masked)
pk_live_XXXXXXXX…   public key, live mode (masked)

The public key is meant to be used in browsers and mobile apps, and it cannot perform sensitive actions. The secret key must stay on your server. In code you will find it as PAYMONGO_SECRET_KEY, or as the username of a basic authentication header on calls to the PayMongo API. A sk_test_ key reaches only the test mode, which is not urgent, but a live secret key is. The rule in this guide targets a key of 32 characters near the word paymongo, so confirm which key it found.

How PayMongo secret keys get leaked

  • Server code with keys written inline. A payment helper with the key in the source, committed with the integration.
  • Environment files. PAYMONGO_SECRET_KEY in a committed .env file or a container definition.
  • Front-end bundles. A secret key used in client-side code, so every visitor can read it in the browser.
  • Mobile apps. An app that calls PayMongo directly and ships the secret key inside the package.
  • Continuous integration and logs. A pipeline file or a debug log that prints the key.
  • Shared snippets and screenshots. A support request or a forum post with the authorization header or the dashboard keys page visible.

What to do in the first hour

  1. Prepare the deployment. Regenerating a key stops the old one at once, so know where it is used before you start. If you see active abuse, regenerate immediately and accept a short interruption.
  2. Regenerate the API keys. In the PayMongo dashboard, go to the developer section, open the API keys and use the regenerate action. You will be asked for a one-time code sent to your registered email or phone.
  3. Deploy the new keys to your server and test with a small payment in test mode before live.
  4. Audit payments. Review recent payments, payment links, refunds and customers since the exposure. Look for payments you did not create or refunds you did not issue.
  5. Check webhooks. Review the webhook endpoints registered on the account and remove any you do not recognize.
  6. Review account access. Only owners and admins can see keys, so check the list of users and roles and remove unknown members.
  7. Clean up the code and look for other secrets next to the key. See I accidentally pushed an API key to GitHub.

Not sure what else leaked from the same repository? Run a free scan.

Not sure what else leaked? Run a free scan.

Revoke it at PayMongo

PayMongo keys are managed in the developer section of your PayMongo dashboard, which shows the keys to an account owner or admin after sign-in and verification. The regeneration flow asks you to confirm and enter a one-time code, and the old keys stop working once new ones are issued. A person has not confirmed the exact menu wording for this guide, and the documentation pages differ slightly on labels, so look for the section where API keys are listed, and follow the PayMongo documentation. If you think the keys are compromised and cannot regenerate them, contact PayMongo support.

How LeakWatch detects it

The rule is called PayMongo API Key. It needs the word paymongo in the text, followed within about 40 characters by a value of exactly 32 characters made of letters, digits and underscores, delimited by word boundaries. The match is case-insensitive. A key with the usual sk_live_ prefix followed by a longer body will not be cut into a 32-character match unless the boundaries fall right, so a real key can be missed, and a 32-character identifier near the word can raise a false alert. Always check what the match contains. The severity is high. This type is not checked live: LeakWatch does not send any request to PayMongo with the value it found.

LeakWatch detects this format but does not check it live: it can tell you the key is exposed, not whether it still works. Assume it does until you have revoked it.

FAQ

Is the public key a problem if it leaks?

Not by itself. Public keys are designed to appear in client code. Regenerating the account keys covers it anyway.

Can I revoke the key without issuing a new one?

According to PayMongo’s documentation, revoking means regenerating, so a replacement is issued. Update your applications straight away.

Will payments fail after regenerating?

Until the new key is deployed, yes. Prepare the change first. If the key is being abused, regenerate at once.

Get alerted next time a secret leaks — create a free account

LeakWatch is not affiliated with PayMongo.