🔌 API Reference

Payment Links API

Create and manage payment links programmatically with our REST API.

Base Endpoint
All payment link operations use this base URL
https://api.payflow.com/v1/payment_links
Create Payment Link
Create a new payment link
POST/v1/payment_links
curl -X POST https://api.payflow.com/v1/payment_links \
  -H "Authorization: Bearer pk_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Premium Course Access",
    "description": "Get access to our premium course content",
    "amount": 2500,
    "currency": "PKR",
    "expires_at": "2024-12-31T23:59:59Z"
  }'

Request Parameters

Required

titlestring
amountinteger
currencystring

Optional

descriptionstring
expires_atdatetime
success_urlstring
cancel_urlstring

Response

{
  "id": "pl_1234567890",
  "title": "Premium Course Access",
  "description": "Get access to our premium course content",
  "amount": 2500,
  "currency": "PKR",
  "status": "active",
  "url": "https://payflow.com/pay/premium-course-123",
  "expires_at": "2024-12-31T23:59:59Z",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}
List Payment Links
Retrieve a list of your payment links
GET/v1/payment_links

Query Parameters

limitDefault: 10, Max: 100
starting_afterCursor for pagination
statusFilter by status

Example Request

curl -X GET "https://api.payflow.com/v1/payment_links?limit=20&status=active" \
  -H "Authorization: Bearer pk_live_YOUR_API_KEY"

Response

{
  "data": [
    {
      "id": "pl_1234567890",
      "title": "Premium Course Access",
      "amount": 2500,
      "currency": "PKR",
      "status": "active",
      "url": "https://payflow.com/pay/premium-course-123",
      "created_at": "2024-01-15T10:30:00Z"
    }
  ],
  "has_more": false,
  "total_count": 1
}
Retrieve Payment Link
Get details of a specific payment link
GET/v1/payment_links/:id

Example Request

curl -X GET https://api.payflow.com/v1/payment_links/pl_1234567890 \
  -H "Authorization: Bearer pk_live_YOUR_API_KEY"

Response

{
  "id": "pl_1234567890",
  "title": "Premium Course Access",
  "description": "Get access to our premium course content",
  "amount": 2500,
  "currency": "PKR",
  "status": "active",
  "url": "https://payflow.com/pay/premium-course-123",
  "clicks": 15,
  "conversion_rate": 0.33,
  "total_revenue": 7500,
  "expires_at": "2024-12-31T23:59:59Z",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}
Update Payment Link
Modify an existing payment link
PATCH/v1/payment_links/:id

Example Request

curl -X PATCH https://api.payflow.com/v1/payment_links/pl_1234567890 \
  -H "Authorization: Bearer pk_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Updated Course Title",
    "amount": 3000
  }'

Updatable Fields

  • • title - Product title
  • • description - Product description
  • • amount - Price amount
  • • expires_at - Expiration date
  • • success_url - Success redirect URL
  • • cancel_url - Cancel redirect URL
Error Handling
Common error responses and how to handle them

Common Error Codes

400 Bad Request

Invalid parameters or missing required fields

Check your request body and ensure all required fields are present

401 Unauthorized

Invalid or missing API key

Verify your API key is correct and included in the Authorization header

404 Not Found

Payment link not found

Check the payment link ID in your request URL
Rate Limits
API rate limits for payment link operations
100

Requests per minute

Standard rate limit

1000

Requests per hour

Hourly limit

10,000

Requests per day

Daily limit

Rate Limit Headers: The API includes X-RateLimit-* headers in responses to help you track your usage and stay within limits.