This article will cover the following:
Overview
The Billing & Payments API gives you programmatic access to your platform's financial data — affiliate invoices, billing cycles, payment methods, and currencies. All write operations modify financial records, so validate affiliate IDs and date ranges before submitting requests.
Invoice creation and updates are write operations that modify financial records. Always validate affiliate IDs, date ranges, and status values before submitting.
List Invoices
| Parameter | Type | Required | Description |
|---|---|---|---|
| invoice_id | integer | No | Filter to a specific invoice by ID. |
| affiliate_id | integer | No | Filter invoices for a specific affiliate. |
| advertiser_id | integer | No | Filter invoices for a specific advertiser. |
| invoice_status | string | No | Filter by status: pending, approved, paid, or void. |
| start_date | date | No | Invoices with period starting on or after this date (YYYY-MM-DD). |
| end_date | date | No | Invoices with period ending on or before this date (YYYY-MM-DD). |
| start_at_row | integer | No | Row offset. Default: 0. |
| row_limit | integer | No | Max invoices. Default: 100. |
Sample request
GET https://yourdomain.cake.com/api/2/invoices.json
?api_key=YOUR_API_KEY
&affiliate_id=67890
&invoice_status=pending
&start_date=2024-01-01
&row_limit=25Sample response
{
"request_status": "Success",
"invoices": [{
"invoice_id": 4821,
"affiliate_id": 67890,
"affiliate_name": "Acme Media Group",
"invoice_status": "pending",
"start_date": "2024-01-01",
"end_date": "2024-01-31",
"total_amount": "1250.00",
"currency": "USD"
}],
"total_rows": 1
}Create Invoice
Generates a new invoice for a specified affiliate. CAKE calculates the invoice total based on the affiliate's conversions and earnings within the given period.
| Parameter | Type | Required | Description |
|---|---|---|---|
| affiliate_id | integer | Yes | ID of the affiliate for whom the invoice is created. |
| start_date | date | Yes | Start of the billing period (YYYY-MM-DD). |
| end_date | date | Yes | End of the billing period (YYYY-MM-DD). |
| memo | string | No | Optional internal note to attach to the invoice. |
Sample request
POST https://yourdomain.cake.com/api/2/invoice.json?api_key=YOUR_API_KEY
{
"affiliate_id": 67890,
"start_date": "2024-01-01",
"end_date": "2024-01-31",
"memo": "January 2024 manual invoice"
}Sample response
{
"request_status": "Success",
"invoice": {
"invoice_id": 4822,
"affiliate_id": 67890,
"invoice_status": "pending",
"total_amount": "980.50",
"currency": "USD"
}
}Update Invoice
Updates the status, memo, or payment date of an existing invoice. When recording a payment, supply paid_at alongside invoice_status: paid.
| Parameter | Type | Required | Description |
|---|---|---|---|
| invoice_id | integer | Yes | ID of the invoice to update. |
| invoice_status | string | No | New status: pending, approved, paid, or void. |
| memo | string | No | Updated internal note. |
| paid_at | datetime | No | Payment timestamp. Supply with invoice_status: paid. |
Sample request
POST https://yourdomain.cake.com/api/2/update_invoice.json?api_key=YOUR_API_KEY
{
"invoice_id": 4821,
"invoice_status": "paid",
"paid_at": "2024-02-15T10:00:00Z"
}Sample response
{
"request_status": "Success",
"invoice": {
"invoice_id": 4821,
"invoice_status": "paid",
"paid_at": "2024-02-15T10:00:00Z"
}
}Billing Reference Data
Use these lookup endpoints to retrieve valid IDs for billing cycles, payment methods, currencies, and tax classes before creating or updating records.
| Parameter | Type | Required | Description |
|---|---|---|---|
| billing_cycle_id | integer | No | Filter to a specific billing cycle by ID. |
Sample request
GET https://yourdomain.cake.com/api/2/billing_cycles.json?api_key=YOUR_API_KEYSample response
{
"request_status": "Success",
"billing_cycles": [
{"billing_cycle_id": 1, "billing_cycle_name": "Weekly"},
{"billing_cycle_id": 2, "billing_cycle_name": "Bi-Weekly"},
{"billing_cycle_id": 3, "billing_cycle_name": "Monthly"}
]
}| Parameter | Type | Required | Description |
|---|---|---|---|
| payment_method_id | integer | No | Filter to a specific payment method by ID. |
Sample request
GET https://yourdomain.cake.com/api/2/payment_methods.json?api_key=YOUR_API_KEYSample response
{
"request_status": "Success",
"payment_methods": [
{"payment_type_id": 1, "payment_type_name": "Check"},
{"payment_type_id": 2, "payment_type_name": "Wire Transfer"},
{"payment_type_id": 3, "payment_type_name": "PayPal"}
]
}If you have any questions, please reach out to your dedicated CAKE Client Success Manager/Account Manager or contact the CAKE Support Team at support@getCAKE.com.