Authentication & Keys
PerfectPay uses a simple header-based authentication pattern. Both server-side and client-side requests use the api-key header.
Dashboard Paths
- Developers -> API Keys: create and rotate secret keys, copy publishable keys
- Developers -> Settings: copy your hosted SDK details and environment configuration
Key Hosts
| Surface | Host |
|---|---|
| Dashboard | https://app.perfectpay.ai |
| Hosted Web SDK | https://sdk.perfectpay.ai |
| Sandbox API | https://sandbox.perfectpay.ai |
| Production API | https://api.perfectpay.ai |
Secret API Key
Use your secret key for all server-to-server calls. Pass it in the api-key header:
HTTP
api-key: YOUR_SECRET_API_KEY
Use this format for:
POST /paymentsPOST /payments/{payment_id}/confirmPOST /payments/{payment_id}/capturePOST /payments/{payment_id}/cancelPOST /customersPOST /refundsPOST /payment_methodsPOST /subscriptions
Example
GET //sandbox.perfectpay.ai/payments
curl https://sandbox.perfectpay.ai/payments \
-X POST \
-H "api-key: YOUR_SECRET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"amount": 4999, "currency": "USD"}'
Publishable Key
Use your publishable key for client-side calls. It uses the same api-key header:
HTTP
api-key: YOUR_PUBLISHABLE_KEY
The publishable key is safe to include in browser code and mobile apps. It can only be used to retrieve payment status and interact with the Web SDK -- it cannot create payments or issue refunds.
The client secret is passed separately, either in the request body or as a query parameter, depending on the endpoint. It is not part of the auth header.
Required Values
| Value | Where it comes from | Notes |
|---|---|---|
| Secret API key | Developers -> API Keys | Never expose in client code |
| Publishable key | Developers -> API Keys | Safe for public clients |
| Client secret | Payment creation response | Tied to one payment, passed in body or query param |
Security Defaults
- Keep secret keys on your server only.
- Rotate keys when moving environments or changing backend ownership.
- Store keys in your secrets manager, not in application code or frontend bundles.
- Clear saved example credentials from this docs page when you finish debugging on a shared machine.