API Reference · Billing
Meter Events
Usage metering for pay-as-you-go billing. Not working yet: events are not recorded and usage is not billed.
The billing.meter_event object
Represents a billing.meter_event entity in the rafiqPay system.
| Field | Type & Flags | Description |
|---|---|---|
| id | string | Event ID (mev_...). |
| eventKey | string | Meter event key (e.g. "student.active"). |
| customerId | string | Customer ID. |
| value | number | Quantity. Defaults to 1. |
Example billing.meter_event JSON
billing.meter_event example payload
{
"id": "mev_01",
"eventKey": "student.active",
"customerId": "cus_amina_01",
"value": 1
}Endpoints & Operations
POST/v1/billing/meter-eventsProposed
Report a meter event
The route answers, but does not record the event yet, so nothing is counted or billed.
Request Example
POST /v1/billing/meter-events
cURL · v1
curl -X POST "https://api.rafiqpay.net/v1/billing/meter-events" \
-H "Authorization: Bearer rp_test_sk_kanzu_9f8a7b6c5d4e3f2a" \
-H "Idempotency-Key: idem_report-meter-event_01" \
-H "Content-Type: application/json" \
-d '{
"eventKey": "student.active",
"customerId": "cus_amina_01",
"value": 1,
"idempotencyKey": "mev_kanzu_01"
}'Response (200 OK)
Response payload
{
"success": true,
"recordedAt": "2026-11-11T09:00:00.000Z"
}POST/v1/billing/metersProposed
Create a meter
Creates a usage meter aggregation definition.
Request Example
POST /v1/billing/meters
cURL · v1
curl -X POST "https://api.rafiqpay.net/v1/billing/meters" \
-H "Authorization: Bearer rp_test_sk_kanzu_9f8a7b6c5d4e3f2a" \
-H "Idempotency-Key: idem_create-meter_01" \
-H "Content-Type: application/json" \
-d '{
"eventName": "student.active",
"aggregation": "count"
}'Response (200 OK)
Response payload
{
"id": "mtr_01",
"eventName": "student.active"
}GET/v1/billing/metersProposed
List meters
Lists configured usage meters.
Request Example
GET /v1/billing/meters
cURL · v1
curl -X GET "https://api.rafiqpay.net/v1/billing/meters" \
-H "Authorization: Bearer rp_test_sk_kanzu_9f8a7b6c5d4e3f2a"Response (200 OK)
Response payload
{
"object": "list",
"data": [],
"hasMore": false,
"nextCursor": null
}Related Webhook Events
These events are dispatched to your webhook endpoints when actions occur on this resource: