Accept payments, manage refunds, and track transactions with a modern RESTful API. Built for developers who ship fast.
Go from zero to first payment in under 5 minutes.
Add PayFlow to your project with your preferred package manager.
# npm
npm install @payflow/sdk
# pip
pip install payflow
Generate an API key from the dashboard to authenticate requests.
const payflow = require('@payflow/sdk');
const client = new payflow.Client({
apiKey: process.env.PAYFLOW_API_KEY
});
Charge a customer in a single API call.
const payment = await client.payments.create({
amount: 2500, // $25.00
currency: 'usd',
source: 'tok_visa',
description: 'Order #1234'
});
console.log(payment.id); // pay_1Hx7...
A complete set of RESTful endpoints to manage payments end-to-end. Click any endpoint to expand details.
Create a new payment charge. Supports one-time and recurring billing with multiple payment methods.
| Name | Type | Description |
|---|---|---|
| amountREQ | integer | Amount in cents (e.g. 2500 = $25.00) |
| currencyREQ | string | Three-letter ISO currency code (e.g. "usd") |
| sourceREQ | string | Payment source token (e.g. "tok_visa") |
| description | string | Arbitrary description for your records |
| metadata | object | Key-value pairs for custom data |
{
"id": "pay_1Hx7kQ2eZvKYl0",
"object": "payment",
"amount": 2500,
"currency": "usd",
"status": "succeeded",
"created": 1709251200
}
Retrieve the details of an existing payment by its unique identifier. Includes full charge history.
| Name | Type | Description |
|---|---|---|
| idREQ | string | Unique payment identifier (path param) |
| expand[] | array | Related objects to expand (e.g. "customer", "source") |
{
"id": "pay_1Hx7kQ2eZvKYl0",
"object": "payment",
"amount": 2500,
"currency": "usd",
"status": "succeeded",
"source": { "type": "card", "last4": "4242" },
"created": 1709251200
}
Issue a full or partial refund against a completed payment. Funds returned within 5-10 business days.
| Name | Type | Description |
|---|---|---|
| payment_idREQ | string | ID of the payment to refund |
| amount | integer | Partial refund amount in cents (omit for full refund) |
| reason | string | Reason: "duplicate", "fraudulent", or "requested_by_customer" |
{
"id": "ref_3Kz9mR4fBnLYp1",
"object": "refund",
"amount": 2500,
"status": "pending",
"payment_id": "pay_1Hx7kQ2eZvKYl0"
}
Retrieve your current account balance, including available, pending, and reserved amounts by currency.
| Name | Type | Description |
|---|---|---|
| currency | string | Filter by currency code (optional) |
{
"object": "balance",
"available": [{ "amount": 142580, "currency": "usd" }],
"pending": [{ "amount": 8450, "currency": "usd" }],
"reserved": [{ "amount": 0, "currency": "usd" }]
}
Register a webhook endpoint to receive real-time event notifications for payment status changes.
| Name | Type | Description |
|---|---|---|
| urlREQ | string | HTTPS URL to receive webhook POST requests |
| events[]REQ | array | Events to subscribe to (e.g. "payment.succeeded") |
| secret | string | Custom signing secret (auto-generated if omitted) |
{
"id": "whk_5Np2qT8gDmRYs3",
"object": "webhook",
"url": "https://example.com/webhooks",
"events": ["payment.succeeded", "payment.failed"],
"active": true
}
List all transactions with filtering, pagination, and sorting. Export-ready for reconciliation reports.
| Name | Type | Description |
|---|---|---|
| limit | integer | Number of results (1-100, default 25) |
| offset | integer | Pagination offset |
| status | string | Filter by status: "succeeded", "pending", "failed" |
| created[gte] | string | Only return transactions created after this date |
{
"object": "list",
"data": [
{ "id": "pay_1Hx7...", "amount": 2500, "status": "succeeded" },
{ "id": "pay_2Ky9...", "amount": 4999, "status": "succeeded" }
],
"has_more": true,
"total_count": 847
}
Ready-to-use snippets in your favorite language. Click "Run" to see mock responses.
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
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
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}
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
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
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}
Transparent pricing that scales with your business. No hidden fees.
Test API calls directly in your browser. Modify parameters and see instant mock responses.
First-class libraries maintained by the PayFlow team. Ship faster.
Async support, type hints, and auto-retry built in. Python 3.8+.
pip install payflow
ESM & CJS support, TypeScript definitions, promise-based API.
npm install @payflow/sdk
Laravel integration, PSR-18 compatible, PHP 8.1+.
composer require payflow/payflow-php
Context-aware, idiomatic error handling, zero dependencies.
go get github.com/payflow/payflow-go