Integration
RESTAPI Reference
Complete REST API reference for the PaymentHooks payment orchestration platform. All endpoints return JSON and follow consistent envelope patterns.
Base URL
All requests require HTTPS. Plain HTTP is rejected with 301.
Authentication
Include your secret API key in the Authorization header using the Bearer scheme.
Authorization: Bearer sk_live_<your_secret_key>
Test mode
Use sk_test_... keys. No real charges are made.
Live mode
Use sk_live_... keys. Real transactions occur.
Download API collections
Import any of these into your favourite HTTP client. The collection includes every endpoint documented below, pre-filled with example payloads and the right authentication headers.
Pagination
All list endpoints support pagination, filtering, and sorting via query parameters. The response includes a meta object with total count and current page info.
GET /v1/payments?page=2&pageSize=25&status=succeeded&sortField=createdAt&sortDirection=desc
{"data": [ ... ],"meta": { "total": 42, "page": 2, "pageSize": 25 },"error": null}
Payments
Accept one-time payments and issue refunds. Amounts are always in the smallest currency unit (e.g. cents for USD).
Create a payment. Routes through configured gateways based on your routing rules.
Retrieve a single payment by ID.
Return a paginated list of payments. Supports search, status, page, pageSize, sortField, and sortDirection query params.
Update payment metadata or description.
Issue a full or partial refund on a succeeded payment.
Checkout Sessions
Create hosted checkout pages for one-time payments, subscriptions, or card setup. The response includes a url field — redirect your customer there to complete payment.
Create a new checkout session. Returns the session object including the hosted checkout URL.
Return a list of checkout sessions. Filter by status (open, complete, expired) or mode query parameters.
Retrieve a single checkout session by ID. Requires authentication.
Public endpoint for the hosted checkout page. Returns session data without requiring authentication. Used by the checkout UI.
Process payment for a checkout session. Called by the hosted checkout form. This is a public endpoint.
Customers
Manage customer records used across payments, subscriptions, and invoices. Customer email must be unique within your account.
Create a new customer record.
Retrieve a single customer by ID.
Return a paginated list of customers ordered by creation date descending.
Update writable fields on an existing customer. Only provided fields are changed (partial update).
Subscriptions
Recurring billing objects that automatically generate invoices each billing cycle. Supports plan changes, pausing, and cancellation. Create a subscription by attaching a customer to a price — returns 201 with the new subscription in active status and dispatches a subscription.created webhook.
Create a new subscription for a customer against a recurring price. The subscription's first billing period is computed from the price interval. Dispatches subscription.created webhook on success.
Return a paginated list of subscriptions. Filter by customerId or status query parameter.
Retrieve a single subscription including period dates and plan details.
Update a subscription's plan, billing anchor, or metadata. Plan changes are prorated by default.
Pause a subscription. Billing stops immediately and only resumes when explicitly resumed via the resume endpoint.
Resume a paused subscription. Billing restarts from the current date.
Cancel a subscription immediately or at the end of the current billing period.
Preview the proration charges that would be applied if a plan change were committed. Does not mutate the subscription.
Force a retry of the most recent failed invoice payment for a past_due subscription. Returns a checkout session the customer can use to update the payment method and complete payment.
Return all invoices associated with a subscription, ordered by creation date descending.
Return all payments associated with a subscription's invoices, ordered by creation date descending.
Return the raw gateway transactions for a subscription, useful for reconciliation against your gateway dashboard.
Invoices
Create, send, and manage invoices with line items. Invoices support PDF generation and out-of-band payment recording.
Create a new invoice with one or more line items. Created in draft status.
Retrieve a single invoice including all line items and payment status.
Return a paginated list of invoices. Filter by customerId or status.
Send the invoice to the customer's email. Transitions status from draft to sent.
Manually mark an invoice as paid for out-of-band payments (wire, cash, etc.). No request body required.
Download the invoice as a PDF. Returns a binary stream with Content-Type: application/pdf.
Payment Links
Shareable payment links that can be embedded or sent directly to customers. No code required on the customer side.
Create a new payment link. Returns the link object with a shareable URL.
Return a paginated list of payment links. Supports search, status, page, pageSize, sortField, and sortDirection query params.
Retrieve a single payment link by ID.
Update a payment link's name, description, or status.
Public endpoint. Resolve a payment link by its URL slug. Returns 410 if the link is inactive.
Process payment for a payment link. Public endpoint — same parameters as checkout session pay.
Webhooks
Register HTTPS endpoints to receive real-time event notifications. Deliveries are signed with HMAC-SHA256 using the endpoint's signing secret.
Register a new webhook endpoint. The signing secret is returned only once — store it securely.
Return all registered webhook endpoints for your account.
Update a webhook endpoint's URL, subscribed events, or description.
Try it
Test API endpoints directly from the browser. Paste your test API key, select an endpoint, and send a request.
API Explorer
Error Codes
HTTP status codes signal every request outcome. 2xx = success, 4xx = client error, 5xx = server fault. All errors include a structured error object with code, message, and requestId.
| Code | Status | Description |
|---|---|---|
400 | Bad Request | Invalid parameters or malformed request body. |
401 | Unauthorized | Missing or invalid API key in Authorization header. |
403 | Forbidden | Insufficient permissions for the requested action. |
404 | Not Found | The requested resource does not exist. |
409 | Conflict | Idempotency conflict or duplicate resource. |
422 | Unprocessable | Valid JSON but fails business-logic validation. |
429 | Rate Limited | Too many requests. Default limit: 100 req/min. |
500 | Server Error | Internal error — contact support with your request ID. |