Request Body
The ID of the customer this wallet belongs to. Either customer_id or external_customer_id is required.
The external customer ID from your system. Either customer_id or external_customer_id is required.
Three-letter ISO currency code (e.g., USD, EUR, GBP)
Type of walletValues:
PREPAID: Customer must load credits before usage
POSTPAID: Customer can use credits and pay later
Conversion rate from wallet credits to currency during consumptionExamples:
1: 1 credit = 1 USD
2: 1 credit = 0.5 USD (2 credits per dollar)
0.5: 1 credit = 2 USD (0.5 credits per dollar)
Conversion rate for top-ups to the currency. If not provided, uses conversion_rate.Examples:
1: 1 USD = 1 credit
2: 1 USD = 0.5 credits
0.5: 1 USD = 2 credits
Number of credits to load into the wallet upon creation (not currency amount)
initial_credits_expiry_date_utc
Expiry date for initial credits in ISO 8601 format (e.g., 2025-12-31T23:59:59Z)If not set, credits don’t expire.
Optional description for the wallet
Custom metadata as key-value pairs
Alert configuration for low balance notificationsShow Alert settings object
Type of thresholdValues: PERCENTAGE, ABSOLUTE
Threshold value (percentage or absolute amount)
Auto top-up configuration
Enable automatic top-ups when balance is low
Balance threshold that triggers auto top-up
Amount to add during auto top-up
Price unit code to use for wallet creation. If provided, overrides currency and conversion_rate with values from the price unit.
Response
Unique identifier for the wallet
ID of the customer this wallet belongs to
Auto-generated wallet name (e.g., “Prepaid Wallet - USD”)
Three-letter ISO currency code
Type of wallet (PREPAID or POSTPAID)
Current status of the walletValues: ACTIVE, INACTIVE, SUSPENDED
Current balance in currency
Current balance in credits
Conversion rate from credits to currency
Conversion rate for top-ups
Current alert stateValues: OK, WARNING, CRITICAL
Auto top-up configuration
Timestamp when wallet was created
Timestamp when wallet was last updated
curl -X POST "https://api.flexprice.io/v1/wallets" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"customer_id": "cust_1234",
"currency": "usd",
"wallet_type": "PREPAID",
"conversion_rate": "1",
"initial_credits_to_load": "100.00"
}'
{
"id": "wallet_abc123",
"customer_id": "cust_1234",
"name": "Prepaid Wallet - USD",
"currency": "usd",
"wallet_type": "PREPAID",
"wallet_status": "ACTIVE",
"balance": "100.000000000",
"credit_balance": "100.000000000",
"conversion_rate": "1.00000",
"topup_conversion_rate": "1.00000",
"alert_state": "OK",
"metadata": {},
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
Wallet Types Explained
A prepaid wallet requires customers to load credits before using your service.Use cases:
- Pay-as-you-go models
- Promotional credits
- Preventing overages
- Prepaid customer segments
Behavior:
- Usage is blocked when balance reaches zero
- Credits must be added before additional usage
- Suitable for usage-based pricing only
A postpaid wallet allows customers to use services and pay later through invoicing.Use cases:
- Enterprise customers
- Net payment terms
- Monthly invoicing cycles
- Customers with credit arrangements
Behavior:
- Balance can go negative
- Usage tracked and invoiced periodically
- Supports all price types (fixed, usage, tiered, etc.)
Conversion Rate Examples
Conversion rates allow you to decouple internal credit accounting from actual currency values.
Example 1: 1:1 conversion
{
"conversion_rate": "1",
"currency": "usd"
}
Result: 1 credit = $1.00 USD
Example 2: Bulk discount pricing
{
"conversion_rate": "0.8",
"currency": "usd"
}
Result: 1 credit = $0.80 USD (customer gets 25% more value)
Example 3: Premium pricing
{
"conversion_rate": "1.5",
"currency": "usd"
}
Result: 1 credit = $1.50 USD