Skip to content

API Overview

The Payre API powers the @payre/pay SDK. You don't need to call it directly -- the SDK handles everything. This reference is for advanced use cases or building custom integrations.

Base URL: https://api.payre.dev

Core Endpoints

EndpointMethodAuthDescription
/v1/chargesPOSTDeveloper secret keyCreate a charge (SDK calls this)
/v1/balanceGETConsumer API keyCheck consumer balance
/v1/usageGETConsumer API keyGet charge history
/v1/top-upPOSTConsumer API keyAdd credits to balance
/v1/earningsGETDeveloper secret keyGet developer earnings
/v1/toolsGETDeveloper secret keyList registered tools
/v1/toolsPOSTDeveloper secret keyRegister a tool

Authentication

Two types of keys:

  • Developer secret key (pyr_sk_live_xxx): Sent as Authorization: Bearer pyr_sk_live_xxx
  • Consumer API key (pyr_ck_live_xxx): Sent as Authorization: Bearer pyr_ck_live_xxx

The API determines whether you're a developer or consumer based on the key prefix.

Errors

All errors return JSON with this shape:

json
{
  "error": "error_code",
  "message": "Human-readable description"
}
HTTP StatusError CodeMeaning
401unauthorizedMissing or invalid API key
402insufficient_balanceConsumer balance too low
403forbiddenKey doesn't have permission for this endpoint
404not_foundResource not found
500internal_errorServer error

Rate Limits

  • 1,000 requests per minute per key
  • POST /v1/charges is optimized for high throughput (avg 0.5ms processing time)