POST
/
billing
/
bills
curl --request POST \
--url https://api.momentco.io/billing/bills \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '{
"customer": "bcus_H4jp6KnU5cPw263v1jyz4",
"external_reference": "UBR1234567890",
"currency": "ZAR",
"amount_due": 2000,
"bill_date": "2025-01-01",
"due_date": "2025-01-31",
"metadata": {
"invoice_period": "January 2025",
"service_type": "subscription"
}
}'
{
"id": "bill_H4jp6KnU5cPw263v1jyz4",
"external_reference": "UBR1234567890",
"customer_id": "bcus_H4jp6KnU5cPw263v1jyz4",
"account_id": "bacc_H4jp6KnU5cPw263v1jyz4",
"status": "unpaid",
"currency": "ZAR",
"amount_due": 2000,
"amount_paid": 0,
"amount_remaining": 2000,
"bill_date": "2025-01-01",
"due_date": "2025-01-31",
"payment_rules": {
"min_amount": 100,
"max_amount": 2000,
"underpayment_allowed": true,
"overpayment_allowed": false
},
"metadata": {
"invoice_period": "January 2025",
"service_type": "subscription"
}
}

Authorizations

Authorization
string
header
required

Authentication using Bearer tokens. Include your API key in the Authorization header.

Key Types:

  • Test Keys: sk_test_* for development and testing
  • Live Keys: sk_* for production environments
  • Public Keys: pk_test_* or pk_* for client-side operations

📩 Need access? Contact Support to request your API keys.

Usage:

Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc

Headers

Idempotency-Key
string<uuid>
required

A unique key to prevent duplicate operations. Use the same key for retries to ensure idempotent behavior.

Best Practices:

  • Use UUIDs or other cryptographically unique identifiers
  • Maintain keys for at least 24 hours for retry scenarios
  • Use different keys for different operations
  • Monitor Idempotent-Replayed header for cache hits
Required string length: 1 - 255

Body

application/json

Request payload for creating a new bill

Response

201
application/json

Bill created successfully

A bill represents a payment request that can be associated with a customer or specific account.