Skip to main content
POST
/
billing
/
customers
curl --request POST \
  --url https://api.momentco.io/billing/customers \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: <idempotency-key>' \
  --data '
{
  "external_reference": "UCR1234567890"
}
'
{
  "id": "bcus_H4jp6KnU5cPw263v1jyz4",
  "external_reference": "UCR1234567890",
  "name": "John Doe",
  "email": "john.doe@example.com",
  "phone": "+27123456789",
  "currency": "ZAR",
  "balance": 2000,
  "payment_rules": {
    "min_amount": 100,
    "max_amount": 1000000,
    "underpayment_allowed": true,
    "overpayment_allowed": false
  },
  "metadata": {
    "customer_type": "premium",
    "registration_source": "website"
  }
}

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
Pattern: ^[a-zA-Z0-9-]+$

Body

application/json

Request payload for creating a new customer

external_reference
string
required

External reference for reconciliation or tracking purposes. Must be unique within your merchant account.

Maximum string length: 255
Pattern: ^[a-zA-Z0-9_-]+$
Example:

"INV-2024-001"

name
string

The customer's full name or business name

Maximum string length: 255
Example:

"John Doe"

email
string<email>

The customer's email address

Maximum string length: 255
Example:

"john.doe@example.com"

phone
string

The customer's phone number in E.164 format

Pattern: ^\+[1-9]\d{1,14}$
Example:

"+27123456789"

currency
string

The ISO 4217 currency code for the payment.

Example:

"ZAR"

balance
integer

Current balance of the entity. If balance is negative, the entity has credit; if positive, the entity owes this amount. If not specified, no balance tracking.

The value is in the smallest currency unit (e.g., cents for ZAR).

Note: If balance is specified, the currency field must also be provided.

Example:

2000

metadata
object

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. NEW Limitations:

  • Maximum 10 keys
  • Key names must be strings (max 40 characters)
  • Values must be strings (max 500 characters)
Example:
{
"customer_id": "cust_123456",
"order_id": "ord_789012"
}

Response

Customer created successfully

A customer represents an individual or business entity that can have accounts and bills within the billing system.

id
string
required

Unique identifier for a customer

Pattern: ^bcus_[a-zA-Z0-9]+$
Example:

"bcus_H4jp6KnU5cPw263v1jyz4"

external_reference
string
required

External reference for reconciliation or tracking purposes. Must be unique within your merchant account.

Maximum string length: 255
Pattern: ^[a-zA-Z0-9_-]+$
Example:

"INV-2024-001"

name
string

The customer's full name or business name

Maximum string length: 255
Example:

"John Doe"

email
string<email>

The customer's email address

Maximum string length: 255
Example:

"john.doe@example.com"

phone
string

The customer's phone number in E.164 format

Pattern: ^\+[1-9]\d{1,14}$
Example:

"+27123456789"

currency
string

The ISO 4217 currency code for the payment.

Example:

"ZAR"

balance
integer

Current balance of the entity. If balance is negative, the entity has credit; if positive, the entity owes this amount. If not specified, no balance tracking.

The value is in the smallest currency unit (e.g., cents for ZAR).

Note: If balance is specified, the currency field must also be provided.

Example:

2000

payment_rules
object

Payment rules associated with the entity. If not specified, the entity cannot be paid against.

metadata
object

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. NEW Limitations:

  • Maximum 10 keys
  • Key names must be strings (max 40 characters)
  • Values must be strings (max 500 characters)
Example:
{
"customer_id": "cust_123456",
"order_id": "ord_789012"
}