API Reference

Payhook is API-first. Everything you can do in the dashboard, you can do with an HTTP call. Create products, generate checkout URLs, receive webhooks, query revenue.

Authentication

All API requests require an API key passed as a Bearer token in the Authorization header. Get your key from the dashboard.

# Every request needs this header
Authorization: Bearer sk_live_xxxxxxxxxxxxxxxx
Keep your API key secret. Do not commit it to version control or expose it in client-side code. Generate a new key from the dashboard if one is compromised.

Base URL

https://www.getpayhook.com/api/v1

All endpoints below are relative to this base URL. Always use HTTPS.

Errors

Errors return a JSON body with an error string and a standard HTTP status code.

{
  "error": "Product not found"
}
StatusMeaning
400Bad request — missing or invalid parameters
401Unauthorized — missing or invalid API key
404Not found — resource doesn't exist or belongs to another seller
405Method not allowed
500Server error — try again or contact support

Products

GET/api/v1/products

Returns all active and draft products for the authenticated seller.

curl https://www.getpayhook.com/api/v1/products \
  -H "Authorization: Bearer sk_live_xxx"
{
  "products": [
    {
      "id": "e6866e28-5b3f-466b-8e2e-21eb368508cd",
      "name": "Freelancer Growth Kit",
      "description": "Templates, scripts, and trackers for freelancers.",
      "price_cents": 3900,
      "currency": "gbp",
      "status": "active",
      "checkout_url": "https://www.getpayhook.com/checkout/e6866e28-...",
      "created_at": "2026-03-01T12:00:00.000Z"
    }
  ]
}
POST/api/v1/products

Creates a new product. Returns the product with its checkout URL.

ParameterTypeDescription
namestringrequiredProduct name shown at checkout
price_centsnumberrequiredPrice in smallest currency unit (e.g. 3900 = £39.00). Min 50.
descriptionstringoptionalShort description shown at checkout
currencystringoptionalISO currency code. Default: usd
curl -X POST https://www.getpayhook.com/api/v1/products \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"My Template Pack","price_cents":1900,"currency":"usd"}'
{
  "product": {
    "id": "a1b2c3d4-...",
    "name": "My Template Pack",
    "price_cents": 1900,
    "currency": "usd",
    "status": "active",
    "checkout_url": "https://www.getpayhook.com/checkout/a1b2c3d4-...",
    "created_at": "2026-03-02T08:00:00.000Z"
  }
}
GET/api/v1/products/:id

Fetches a single product by ID.

curl https://www.getpayhook.com/api/v1/products/a1b2c3d4-... \
  -H "Authorization: Bearer sk_live_xxx"
PATCH/api/v1/products/:id

Updates a product. Only send the fields you want to change.

ParameterTypeDescription
namestringProduct name
descriptionstringProduct description
price_centsnumberNew price in smallest unit
statusstringdraft | active | archived
DELETE/api/v1/products/:id

Archives a product (soft delete). The product is no longer purchasable but historical data is preserved.

{ "ok": true, "message": "Product archived" }

Revenue

GET/api/v1/revenue

Returns revenue summary for the authenticated seller. Supports period filtering.

ParameterTypeDescription
periodquery string7d | 30d | 90d | 365d. Default: 30d
curl "https://www.getpayhook.com/api/v1/revenue?period=7d" \
  -H "Authorization: Bearer sk_live_xxx"
{
  "period": "7d",
  "period_sales": 3,
  "period_revenue_cents": 11700,
  "period_revenue_formatted": "$117.00",
  "all_time_sales": 14,
  "all_time_revenue_cents": 54600,
  "all_time_revenue_formatted": "$546.00",
  "by_product": {
    "a1b2c3d4-...": { "sales": 3, "revenue_cents": 11700 }
  },
  "generated_at": "2026-03-02T09:00:00.000Z"
}

Webhooks

Payhook sends a signed HTTP POST to your registered webhook endpoints on each event. Register endpoints from the dashboard.

Events

sale.completed
Fired when a buyer completes checkout. Contains purchase details and buyer email.
sale.refunded
Fired when a charge is refunded via Stripe. Contains refunded amount.

Payload format

{
  "event": "sale.completed",
  "created_at": "2026-03-02T09:00:00.000Z",
  "data": {
    "purchase_id": "uuid",
    "product_id": "uuid",
    "buyer_email": "buyer@example.com",
    "amount_cents": 1900,
    "currency": "usd",
    "stripe_session_id": "cs_live_..."
  }
}

Webhook verification

Every request includes an X-Payhook-Signature header. Verify it to confirm the request came from Payhook.

# Node.js example
const crypto = require('crypto')

function verifySignature(body, signature, secret) {
  const expected = 'sha256=' + crypto
    .createHmac('sha256', secret)
    .update(body)
    .digest('hex')
  return crypto.timingSafeEqual(
    Buffer.from(expected),
    Buffer.from(signature)
  )
}

Public API

No authentication required.

GET/api/public/stats

Platform-level stats. Useful for building social proof into your own integrations.

{
  "sales_today": 4,
  "sales_total": 127,
  "gmv_total_cents": 495300,
  "active_sellers": 12,
  "as_of": "2026-03-02T09:00:00.000Z"
}

Related guides

Gumroad API alternative for builders who need write accessDigital product checkout API for AI agentsSell digital products with webhooksAgent storefront infrastructure

Ready to start?

Sign up free. Founding sellers pay 0% platform fees — just Stripe's standard rate.

Create your account