Authentication and API keys
On this page
Choose a key type, limit its scopes, and register your websites, callback URLs and server IP addresses before you go live.
Send your API key as a bearer token in the Authorization header of every request:
curl https://api.pf.organizer.tr/v1/payment_intents?limit=3 \
-H "Authorization: Bearer sk_sandbox_YOUR_KEY"
A missing, unknown or revoked key returns 401 with the type authentication_error.
Key types
| Type | Prefix | Use |
|---|---|---|
| Secret | sk_live_…, sk_sandbox_… |
On your server. Full access. Never put it in a browser or an app. |
| Restricted | rk_live_…, rk_sandbox_… |
On your server, with only the scopes you pick. Create one per integration. |
| Publishable | pk_live_…, pk_sandbox_… |
In the browser or a mobile app. It can call only POST /v1/payment_methods (card tokenization) and POST /v1/installment_plans/preview. |
Create, list and revoke keys on the API keys page in the Developers menu of the merchant panel. The key is shown once, when you create it. To rotate a key, create a new one, deploy it, then revoke the old one. A revoked key stops working at once.
Restricted key scopes
A scope is <resource>:read or <resource>:write, and write includes read. A call outside the key's scopes returns 403 with the type permission_error.
Resources: payment_intents, installment_plans, refunds, disputes, balance, balance_transactions, topups, payouts, settlement_accounts, webhook_endpoints, events, customers, payment_methods, request_logs, reporting, products, payment_links.
| Integration | Scopes |
|---|---|
| Refund service | refunds:write, payment_intents:read |
| Reconciliation job | balance_transactions:read, payouts:read, balance:read |
| Reporting dashboard | reporting:read, payment_intents:read |
Before you go live
A live installation accepts requests only from the places you registered. Register them in the merchant panel. Your payment institution approves each new entry, so add them a few days before launch.
| What | Where | Used for |
|---|---|---|
| Websites | The Websites and callbacks tab of Business details | The sites where you take payments. Verified by a DNS TXT record or by review. |
| Callback URLs | The Websites and callbacks tab of Business details | 3D Secure return_url and webhook URLs that are not on a registered website. The scheme, host and port must be the same. The path matches exact, or by prefix: /pay matches /pay and /pay/done, not /payments. |
| Server IP addresses | The Allowed IP addresses tab of API keys | The addresses your secret and restricted keys call from: single IPv4 or IPv6 addresses, or CIDR blocks. Enter the public address your traffic leaves from. |
In the sandbox these checks refuse nothing. They add a warning to the request on the Logs page in the Developers menu, so you can see what live would refuse.
Errors
| HTTP | error.code |
Meaning |
|---|---|---|
| 401 | api_key_missing, api_key_invalid, api_key_revoked, api_key_mode_mismatch |
The key is missing, unknown, revoked or belongs to the other installation. |
| 403 | insufficient_scope |
The restricted key lacks the scope. The message names it. |
| 403 | ip_not_allowed |
The request came from an address that is not registered. |
| 403 | website_not_registered |
The payment comes from a website that is not registered. |
| 403 | product_not_enabled |
Your account does not have the virtual POS product, which online card payments need. Ask your payment institution to add it. |
| 400 | return_url_not_allowed |
return_url is not on a registered website or callback URL. |
| 400 | webhook_url_not_allowed |
The webhook url is not on a registered website or callback URL. |
Next: Try your key with Test cards and sandbox, then build the payment flow in Card payments and 3D Secure.