PayFlow API
Payments Made Simple

Accept payments, manage refunds, and track transactions with a modern RESTful API. Built for developers who ship fast.

Quick Start Explore API
$ curl -X POST https://api.payflow.io/v1/payments \
-H "Authorization: Bearer pk_live_..." \
-d '{"amount": 2500, "currency": "usd"}'

{"id": "pay_1Hx7...", "status": "succeeded", "amount": 2500}

Quick Start

Go from zero to first payment in under 5 minutes.

1

Install the SDK

Add PayFlow to your project with your preferred package manager.

bash
# npm
npm install @payflow/sdk

# pip
pip install payflow
2

Get Your API Key

Generate an API key from the dashboard to authenticate requests.

javascript
const payflow = require('@payflow/sdk');

const client = new payflow.Client({
  apiKey: process.env.PAYFLOW_API_KEY
});
3

Create Your First Payment

Charge a customer in a single API call.

javascript
const payment = await client.payments.create({
  amount: 2500,        // $25.00
  currency: 'usd',
  source: 'tok_visa',
  description: 'Order #1234'
});

console.log(payment.id); // pay_1Hx7...

API Endpoints

A complete set of RESTful endpoints to manage payments end-to-end. Click any endpoint to expand details.

POST /v1/payments

Create a new payment charge. Supports one-time and recurring billing with multiple payment methods.

amount currency source description metadata

Parameters

NameTypeDescription
amountREQintegerAmount in cents (e.g. 2500 = $25.00)
currencyREQstringThree-letter ISO currency code (e.g. "usd")
sourceREQstringPayment source token (e.g. "tok_visa")
descriptionstringArbitrary description for your records
metadataobjectKey-value pairs for custom data

Example Response

{
  "id": "pay_1Hx7kQ2eZvKYl0",
  "object": "payment",
  "amount": 2500,
  "currency": "usd",
  "status": "succeeded",
  "created": 1709251200
}
GET /v1/payments/:id

Retrieve the details of an existing payment by its unique identifier. Includes full charge history.

id expand[]

Parameters

NameTypeDescription
idREQstringUnique payment identifier (path param)
expand[]arrayRelated objects to expand (e.g. "customer", "source")

Example Response

{
  "id": "pay_1Hx7kQ2eZvKYl0",
  "object": "payment",
  "amount": 2500,
  "currency": "usd",
  "status": "succeeded",
  "source": { "type": "card", "last4": "4242" },
  "created": 1709251200
}
POST /v1/refunds

Issue a full or partial refund against a completed payment. Funds returned within 5-10 business days.

payment_id amount reason

Parameters

NameTypeDescription
payment_idREQstringID of the payment to refund
amountintegerPartial refund amount in cents (omit for full refund)
reasonstringReason: "duplicate", "fraudulent", or "requested_by_customer"

Example Response

{
  "id": "ref_3Kz9mR4fBnLYp1",
  "object": "refund",
  "amount": 2500,
  "status": "pending",
  "payment_id": "pay_1Hx7kQ2eZvKYl0"
}
GET /v1/balance

Retrieve your current account balance, including available, pending, and reserved amounts by currency.

currency

Parameters

NameTypeDescription
currencystringFilter by currency code (optional)

Example Response

{
  "object": "balance",
  "available": [{ "amount": 142580, "currency": "usd" }],
  "pending": [{ "amount": 8450, "currency": "usd" }],
  "reserved": [{ "amount": 0, "currency": "usd" }]
}
POST /v1/webhooks

Register a webhook endpoint to receive real-time event notifications for payment status changes.

url events[] secret

Parameters

NameTypeDescription
urlREQstringHTTPS URL to receive webhook POST requests
events[]REQarrayEvents to subscribe to (e.g. "payment.succeeded")
secretstringCustom signing secret (auto-generated if omitted)

Example Response

{
  "id": "whk_5Np2qT8gDmRYs3",
  "object": "webhook",
  "url": "https://example.com/webhooks",
  "events": ["payment.succeeded", "payment.failed"],
  "active": true
}
GET /v1/transactions

List all transactions with filtering, pagination, and sorting. Export-ready for reconciliation reports.

limit offset status created[gte]

Parameters

NameTypeDescription
limitintegerNumber of results (1-100, default 25)
offsetintegerPagination offset
statusstringFilter by status: "succeeded", "pending", "failed"
created[gte]stringOnly return transactions created after this date

Example Response

{
  "object": "list",
  "data": [
    { "id": "pay_1Hx7...", "amount": 2500, "status": "succeeded" },
    { "id": "pay_2Ky9...", "amount": 4999, "status": "succeeded" }
  ],
  "has_more": true,
  "total_count": 847
}

Code Examples

Ready-to-use snippets in your favorite language. Click "Run" to see mock responses.

Create a Payment

python
import payflow

client = payflow.Client(api_key="pk_live_your_key_here")

payment = client.payments.create(
    amount=2500,          # Amount in cents ($25.00)
    currency="usd",
    source="tok_visa",
    description="Order #1234",
    metadata={
        "customer_id": "cus_9x82k",
        "order_ref": "ORD-2024-1234"
    }
)

print(f"Payment {payment.id}{payment.status}")
# Payment pay_1Hx7... — succeeded
javascript
const PayFlow = require('@payflow/sdk');

const client = new PayFlow.Client({
  apiKey: process.env.PAYFLOW_API_KEY
});

const payment = await client.payments.create({
  amount: 2500,            // Amount in cents ($25.00)
  currency: 'usd',
  source: 'tok_visa',
  description: 'Order #1234',
  metadata: {
    customer_id: 'cus_9x82k',
    order_ref: 'ORD-2024-1234'
  }
});

console.log(`Payment ${payment.id}${payment.status}`);
// Payment pay_1Hx7... — succeeded
bash
curl -X POST https://api.payflow.io/v1/payments \
  -H "Authorization: Bearer pk_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 2500,
    "currency": "usd",
    "source": "tok_visa",
    "description": "Order #1234",
    "metadata": {
      "customer_id": "cus_9x82k",
      "order_ref": "ORD-2024-1234"
    }
  }'

# Response:
# {"id": "pay_1Hx7...", "status": "succeeded", "amount": 2500}

List Transactions

python
transactions = client.transactions.list(
    limit=25,
    status="succeeded",
    created_gte="2024-01-01"
)

for txn in transactions.data:
    print(f"{txn.id}  ${txn.amount / 100:.2f}  {txn.status}")
# pay_1Hx7...  $25.00  succeeded
# pay_2Ky9...  $49.99  succeeded
javascript
const transactions = await client.transactions.list({
  limit: 25,
  status: 'succeeded',
  created: { gte: '2024-01-01' }
});

transactions.data.forEach(txn => {
  console.log(`${txn.id}  $${(txn.amount / 100).toFixed(2)}  ${txn.status}`);
});
// pay_1Hx7...  $25.00  succeeded
// pay_2Ky9...  $49.99  succeeded
bash
curl -G https://api.payflow.io/v1/transactions \
  -H "Authorization: Bearer pk_live_your_key_here" \
  -d "limit=25" \
  -d "status=succeeded" \
  -d "created[gte]=2024-01-01"

# Response:
# {"data": [{"id": "pay_1Hx7...", "amount": 2500, ...}], "has_more": true}

API Pricing

Transparent pricing that scales with your business. No hidden fees.

Free

$0/mo
1,000 API calls / month
  • Test & live mode access
  • All core endpoints
  • Community support
  • Basic webhook events
  • Single API key

Enterprise

Custom
Unlimited API calls
  • Everything in Pro
  • Dedicated account manager
  • 99.99% SLA guarantee
  • Custom rate limits
  • SOC 2 & PCI DSS reports
  • On-premise deployment option

API Playground

Test API calls directly in your browser. Modify parameters and see instant mock responses.

Request
Headers
Body
Response
// Click "Send Request" to see the response

Official SDKs

First-class libraries maintained by the PayFlow team. Ship faster.

Py Python

v3.2.1 · Updated 2 days ago

Async support, type hints, and auto-retry built in. Python 3.8+.

bash
pip install payflow

JS Node.js

v4.1.0 · Updated 5 days ago

ESM & CJS support, TypeScript definitions, promise-based API.

bash
npm install @payflow/sdk

PH PHP

v2.4.3 · Updated 1 week ago

Laravel integration, PSR-18 compatible, PHP 8.1+.

bash
composer require payflow/payflow-php

Go Go

v1.8.0 · Updated 3 days ago

Context-aware, idiomatic error handling, zero dependencies.

bash
go get github.com/payflow/payflow-go