Appearance
Security
This page lists the secrets an integration holds, how to keep each one, and what MOOKHPay does and does not check on your behalf.
The secrets you hold
| Secret | Looks like | Where it lives | What a thief could do |
|---|---|---|---|
| Secret API key | mkp_live_… | Your server only | Whatever its scopes allow: open checkouts that pay you, read them, ask for refunds that MOOKHPay then reviews, and on a platform key create accounts, read balances, take payments for sellers and make login links. Not pay out on its own. Not from outside your allowed addresses, if you set them |
| Payout signing secret | mps_… | Your payout service only | Together with the key, pay a seller's money out to the seller's own payout account or phone |
| Webhook endpoint secret | whsec_… | The server that receives webhooks | Forge events your server will believe, such as a payment.succeeded that never happened |
Charge client_secret | ch_ke_…_secret_… | The payer's browser, for one charge | Open the card form for that one charge until it expires |
| Login link URL | https://…/connect/open?c=KE#t=mll_… | The seller's browser, for 60 seconds | Open a 30-minute view-only session as the seller |
Keep the API key on your server
- Read it from a secret store or an environment variable. Never put it in a web page, a mobile app, a public repository, a log line or a URL.
- Ask for the scopes the integration needs and no others. A shop needs
checkoutsorcharges:write. Only a platform's back end needs the platform scopes. Scopes are fixed when the key is issued. - An account has one current key. Replacing it, which takes the PIN, makes a new one and leaves the old one working for 24 hours, so you can deploy the new key with no gap. An account never holds more than two live keys.
- If a key leaks, revoke straight away: revoking ends every live key on the account, including one in its 24 hours, and needs no PIN so that it can be done quickly. Then make a new key. Replacing alone leaves a leaked key working for a day.
- If your servers call out from fixed addresses, have an Owner set them as the account's allowed addresses in the hub. A stolen key then answers
403and code3042from anywhere else. - MOOKHPay caches the result of checking a key for 60 seconds, so a revoked or replaced key can keep working for up to a minute on most routes. These routes check the key on every call and stop it at once:
POST /charges,POST /refunds,POST /accounts,POST /accounts/:id/payouts,POST /accounts/:id/login-links, the business account request writes, andPOST /checkoutswithon_behalf_oforplatform_fee. - In an organisation, only an Owner can issue a key with
charges:write,refunds:writeor a platform scope.
Card data never reaches your server
Use the card element or the hosted checkout. In the card element, the card number and security code are typed into CyberSource's own frames inside your page. Your page's JavaScript cannot read them, your server never receives them, and MOOKHPay charges the card with a one-time token. MOOKHPay offers no route that takes a card number, and your server should never collect one.
Handle the client_secret like this:
- Your server receives it in the
POST /chargesanswer. Send it to the one checkout page that will take this card, and nowhere else. - It works only for its charge, only until the charge's
expires_ator the moment the charge leavespending, and only from an origin saved on your Card Payment Pages list. MOOKHPay stores only its hash. - Do not log it or put it in a URL. A replay of the create call issues a new one and the earlier one stops working.
- It is not proof of payment. Confirm on your server with
GET /charges/:idor the webhook.
Save only your own checkout pages as card element origins, and keep the list short. A card element on any other page is refused, and the card form it gets is bound to the one origin it was matched for.
Sign payouts with a second secret
A payout moves a seller's money, so it needs more than the API key. Every POST /accounts/:id/payouts carries an HMAC signature made with your platform's payout signing secret. A stolen API key alone cannot pay out.
- An Owner makes the secret in the hub, acting for the organisation, with their PIN. It is shown once. Store it apart from the API key, in the service that sends payouts, and nowhere else.
- The signature covers a timestamp and the exact body bytes, and MOOKHPay refuses a timestamp more than 300 seconds from its clock. A captured request cannot be replayed later or with another amount.
- To rotate, make a new secret, deploy it, and let the old one lapse: it keeps signing for 24 hours after it is replaced. Making a third secret inside those 24 hours ends the first one at once.
- The scheme and samples are in Pay out sellers.
Verify every webhook
- Check
x-mookh-signatureagainst the raw body andx-mookh-timestamp, with a constant-time comparison, before you act on anything. Refuse a timestamp more than five minutes old. See Verify signatures. - Do not trust a webhook by the address it came from. Trust the signature.
- Even a verified event is a notice, not money. For fulfilment, read the checkout, charge or payout back with your key.
- Rotate an endpoint's secret in the hub with Rotate Secret. For 24 hours every delivery is signed with both the new and the old secret, so deploy the new one inside that time. Accept any one matching signature, never all of them. See Rotate the secret.
- The hub shows an endpoint's secret when it is made and again on a read of that one endpoint. Treat everyone who can open API Integrations as able to see it.
- In an organisation, an endpoint that a Developer adds stays off until an Owner switches it on, because it would send every payment to an address the Developer chose.
Treat login links as passwords
A login link signs whoever opens it in as the seller. Make it when the seller taps your button, redirect their browser to it at once, and never email it, text it, log it or show it as text. It works once, within 60 seconds, and opens a 30-minute session that can read but cannot move money or change settings. See Login links.
What MOOKHPay trusts and does not trust
| MOOKHPay | |
|---|---|
| Takes the payee from the key | A checkout or charge pays the key's owner, or the seller named in on_behalf_of if your platform reaches them. Nothing in a request can name another payee |
| Takes the amount from your server | The payer's browser cannot change an amount. Keep prices on your server too |
| Refuses identity headers | A merchant request carrying X-User-ID, X-Acting-As or any other session or identity header is refused with 400, code 3014 |
Treats return_url as a hint | The payer can reach it without paying, or never reach it after paying. Confirm with GET /checkouts/:id |
Sends webhooks only to public https addresses | No credentials in the URL, no private, loopback or link-local addresses, no internal names. The address is checked again before every delivery, and redirects are not followed |
| Keeps account ids opaque | An unknown, malformed, revoked and another platform's account id all get the same 404. Every miss counts against your platform, and after 100 in an hour account lookups are refused |
| Signs cursors | An edited cursor or one from another platform is refused with 3012 |
| Lets the seller decide where payouts go | A platform cannot name a payout destination |
| Lets the seller revoke your access | After that, every call about the account is a 404 |
What MOOKHPay does not do
- It does not sign or check signatures on any request other than a platform payout. The API key is the only credential on every other merchant route.
- It does not offer mutual TLS.
- It does not store card numbers for you or return them to you.
Report a problem
If you find a security problem in MOOKHPay, contact MOOKHPay support and say it is a security report. Do not test against other people's accounts or money.