Get started
Getting Started
Set up your account and make your first API call in under 5 minutes.
Overview
PaymentHooks runs subscription billing and payments for your application on the payment gateways you connect: checkout, renewals, invoices and webhooks. This guide walks you through account setup, API key retrieval, SDK installation, and your first payment.
5 minutes
Typical integration time
Test mode
Simulated hosted checkout payments
38 gateways
In the gateway marketplace
Create an account
Sign up at paymenthooks.com/signup. Verify your email address, then enter your name, company name, and a password. You will then land in your merchant dashboard.
Get your API keys
Go to Developers → API Keys in your merchant dashboard and create a key for your business. Creating a key gives you a pair; the secret key is shown only once, so copy it immediately. Send it as Authorization: Bearer phk_live_... (or in an x-api-key header). New keys have Full access; choose Restricted to limit a key to specific resources. An endpoint outside a key's permissions returns 403 INSUFFICIENT_SCOPE; fix it with Edit permissions on the key, without rotating it.
phk_pub_...Publishable key
Read-only (payments, customers, products). Safe for client-side use
phk_live_...Secret key
Server-side only. Full access by default, or restricted to the permissions you select. Keep private
Install the SDK
The Node.js package is optional. The examples on this page call the REST API directly, which works from any language. The SDK usage documented on these pages requires @paymenthooks/sdk 2.0.0 or later; earlier versions do not match the current API. See Node.js SDK, and the CLI to receive webhooks while developing.
# npmnpm install @paymenthooks/sdk@^4# yarnyarn add @paymenthooks/sdk@^4# pnpmpnpm add @paymenthooks/sdk@^4
Make your first payment
A payment needs a customer. Create one with POST /api/v1/customers (name and email), then pass its id as customerId. Creating a customer with an email you already used returns 409 DUPLICATE_EMAIL, and a customerId from another account returns 404. The payment is routed to one of your connected, enabled gateways (sandbox connections only while your account is in test mode), so connect a gateway first. The response is 201 and its status reflects the gateway result.
curl -X POST https://paymenthooks.com/api/v1/payments \
-H "Authorization: Bearer phk_live_..." \
-H "Content-Type: application/json" \
-d '{"transactionLocalCurrencyAmount": 2000, "customerId": "CUSTOMER_ID", "transactionLocalCurrency": "USD"}'Go live
When you are ready to accept real payments, switch the environment toggle in the dashboard header from Test to Live. Your API keys stay the same; the mode is an account setting. In live mode, hosted checkout payments are routed only to gateway connections set to live mode, so enter your production gateway credentials first. Stripe, PayPal, Square, Braintree, Cashfree and Instamojo connections also require their webhook signing secret before they can be saved. For Razorpay the webhook secret is optional: without it, each webhook is confirmed by reading the payment from Razorpay with your API keys.