API Reference
Get Subscription
Retrieve subscription details by slug
GET /subscription/:slug
Retrieves subscription details including payer information, line items, and billing cycle details.
Request
curl -X GET https://api.givepay.co/api/v1/subscription/sub_01HGW5N8J9K7M2Q4R6S8T1V3W5 \
-H "Authorization: YOUR_API_KEY"Path Parameters
| Parameter | Type | Description |
|---|---|---|
slug | string | Subscription slug (e.g., sub_01HGW5N8J9K7M2Q4R6S8T1V3W5) |
Response
{
"id": "0383d477-cb22-4d88-8987-7eaee5bc89d9",
"slug": "sub_01HGW5N8J9K7M2Q4R6S8T1V3W5",
"status": "active",
"amount": 5500,
"currency": "GBP",
"tip": 500,
"interval": "month",
"interval_count": 1,
"cancel_at_period_end": false,
"current_period_start": "2024-11-01T00:00:00Z",
"current_period_end": "2024-12-01T00:00:00Z",
"charity": {
"slug": "example-charity",
"name": "Example Charity",
"website": "https://example-charity.org",
"logo": {
"url": "https://cdn.givepay.co/logos/example.png"
},
"theme": {
"primary_color": "#0066cc"
}
},
"payer": {
"id": "6c93dd55-9207-4a7a-8eeb-798c1436eb2e",
"email": "john.doe@example.com",
"first_name": "John",
"last_name": "Doe",
"phone": "+447700900000",
"billing_address": {
"country": "GB",
"city": "London",
"line1": "123 Main Street",
"line2": "Apt 4B",
"postcode": "SW1A 1AA",
"state": ""
}
},
"line_items": [
{
"id": "49ba6867-ef7b-4d65-84d9-1447c5262d33",
"type": "recurring",
"quantity": 1,
"amount": 5000,
"total": 5000,
"currency": "GBP",
"country_iso": "GB",
"intention": "General Donation",
"project": "Winter Appeal 2024"
}
],
"return_url": "https://yoursite.com/subscription-complete",
"created_at": "2024-11-01T00:00:00Z",
"updated_at": "2024-11-01T00:00:00Z"
}Response Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique subscription UUID |
slug | string | Subscription slug identifier |
status | string | Current status (e.g., active, canceled, past_due) |
amount | integer | Total amount in pence (including tip) |
currency | string | Currency code (e.g., GBP, USD) |
tip | integer | Platform fee/tip amount in pence |
interval | string | Billing interval (e.g., month, year) |
interval_count | integer | Number of intervals between billings (e.g., 1 for monthly, 3 for quarterly) |
cancel_at_period_end | boolean | Whether the subscription will cancel at the end of the current period |
current_period_start | string | ISO 8601 timestamp of current billing period start |
current_period_end | string | ISO 8601 timestamp of current billing period end |
charity | object | Charity organization details |
payer | object | Payer details |
line_items | array | Array of line items (includes both recurring and one-time items) |
return_url | string | Redirect URL after payment management actions |
created_at | string | ISO 8601 creation timestamp |
updated_at | string | ISO 8601 last update timestamp |
Line Item Fields
Each item in the line_items array contains:
| Field | Type | Description |
|---|---|---|
id | string | Unique line item UUID |
type | string | Item type: "recurring" or "one_time" |
quantity | integer | Quantity of items |
amount | integer | Unit amount in pence |
total | integer | Total amount (quantity × amount) in pence |
currency | string | Currency code |
country_iso | string | ISO country code |
intention | string | Donation intention/purpose |
project | string | Project name or campaign |
Error Responses
| Status | Description |
|---|---|
400 | Invalid slug format |
404 | Subscription not found |
500 | Internal server error |