curl --request POST \
--url https://us.api.flexprice.io/v1/wallets \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"currency": "<string>",
"alert_settings": {
"alert_enabled": true,
"critical": {
"threshold": 123
},
"info": {
"threshold": 123
},
"warning": {
"threshold": 123
}
},
"auto_topup": {
"amount": 123,
"enabled": true,
"invoicing": true,
"threshold": 123
},
"conversion_rate": "1",
"customer_id": "<string>",
"description": "<string>",
"external_customer_id": "<string>",
"initial_credits_expiry_date_utc": "<string>",
"initial_credits_to_load": "0",
"initial_credits_to_load_expiry_date": 123,
"metadata": {},
"price_unit": "<string>",
"topup_conversion_rate": "<string>"
}
'import requests
url = "https://us.api.flexprice.io/v1/wallets"
payload = {
"currency": "<string>",
"alert_settings": {
"alert_enabled": True,
"critical": { "threshold": 123 },
"info": { "threshold": 123 },
"warning": { "threshold": 123 }
},
"auto_topup": {
"amount": 123,
"enabled": True,
"invoicing": True,
"threshold": 123
},
"conversion_rate": "1",
"customer_id": "<string>",
"description": "<string>",
"external_customer_id": "<string>",
"initial_credits_expiry_date_utc": "<string>",
"initial_credits_to_load": "0",
"initial_credits_to_load_expiry_date": 123,
"metadata": {},
"price_unit": "<string>",
"topup_conversion_rate": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
currency: '<string>',
alert_settings: {
alert_enabled: true,
critical: {threshold: 123},
info: {threshold: 123},
warning: {threshold: 123}
},
auto_topup: {amount: 123, enabled: true, invoicing: true, threshold: 123},
conversion_rate: '1',
customer_id: '<string>',
description: '<string>',
external_customer_id: '<string>',
initial_credits_expiry_date_utc: '<string>',
initial_credits_to_load: '0',
initial_credits_to_load_expiry_date: 123,
metadata: {},
price_unit: '<string>',
topup_conversion_rate: '<string>'
})
};
fetch('https://us.api.flexprice.io/v1/wallets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://us.api.flexprice.io/v1/wallets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'currency' => '<string>',
'alert_settings' => [
'alert_enabled' => true,
'critical' => [
'threshold' => 123
],
'info' => [
'threshold' => 123
],
'warning' => [
'threshold' => 123
]
],
'auto_topup' => [
'amount' => 123,
'enabled' => true,
'invoicing' => true,
'threshold' => 123
],
'conversion_rate' => '1',
'customer_id' => '<string>',
'description' => '<string>',
'external_customer_id' => '<string>',
'initial_credits_expiry_date_utc' => '<string>',
'initial_credits_to_load' => '0',
'initial_credits_to_load_expiry_date' => 123,
'metadata' => [
],
'price_unit' => '<string>',
'topup_conversion_rate' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://us.api.flexprice.io/v1/wallets"
payload := strings.NewReader("{\n \"currency\": \"<string>\",\n \"alert_settings\": {\n \"alert_enabled\": true,\n \"critical\": {\n \"threshold\": 123\n },\n \"info\": {\n \"threshold\": 123\n },\n \"warning\": {\n \"threshold\": 123\n }\n },\n \"auto_topup\": {\n \"amount\": 123,\n \"enabled\": true,\n \"invoicing\": true,\n \"threshold\": 123\n },\n \"conversion_rate\": \"1\",\n \"customer_id\": \"<string>\",\n \"description\": \"<string>\",\n \"external_customer_id\": \"<string>\",\n \"initial_credits_expiry_date_utc\": \"<string>\",\n \"initial_credits_to_load\": \"0\",\n \"initial_credits_to_load_expiry_date\": 123,\n \"metadata\": {},\n \"price_unit\": \"<string>\",\n \"topup_conversion_rate\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://us.api.flexprice.io/v1/wallets")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"currency\": \"<string>\",\n \"alert_settings\": {\n \"alert_enabled\": true,\n \"critical\": {\n \"threshold\": 123\n },\n \"info\": {\n \"threshold\": 123\n },\n \"warning\": {\n \"threshold\": 123\n }\n },\n \"auto_topup\": {\n \"amount\": 123,\n \"enabled\": true,\n \"invoicing\": true,\n \"threshold\": 123\n },\n \"conversion_rate\": \"1\",\n \"customer_id\": \"<string>\",\n \"description\": \"<string>\",\n \"external_customer_id\": \"<string>\",\n \"initial_credits_expiry_date_utc\": \"<string>\",\n \"initial_credits_to_load\": \"0\",\n \"initial_credits_to_load_expiry_date\": 123,\n \"metadata\": {},\n \"price_unit\": \"<string>\",\n \"topup_conversion_rate\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://us.api.flexprice.io/v1/wallets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"currency\": \"<string>\",\n \"alert_settings\": {\n \"alert_enabled\": true,\n \"critical\": {\n \"threshold\": 123\n },\n \"info\": {\n \"threshold\": 123\n },\n \"warning\": {\n \"threshold\": 123\n }\n },\n \"auto_topup\": {\n \"amount\": 123,\n \"enabled\": true,\n \"invoicing\": true,\n \"threshold\": 123\n },\n \"conversion_rate\": \"1\",\n \"customer_id\": \"<string>\",\n \"description\": \"<string>\",\n \"external_customer_id\": \"<string>\",\n \"initial_credits_expiry_date_utc\": \"<string>\",\n \"initial_credits_to_load\": \"0\",\n \"initial_credits_to_load_expiry_date\": 123,\n \"metadata\": {},\n \"price_unit\": \"<string>\",\n \"topup_conversion_rate\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"alert_settings": {
"alert_enabled": true,
"critical": {
"condition": "above",
"threshold": 123
},
"info": {
"condition": "above",
"threshold": 123
},
"warning": {
"condition": "above",
"threshold": 123
}
},
"alert_state": "ok",
"auto_topup": {
"amount": 123,
"enabled": true,
"invoicing": true,
"threshold": 123
},
"balance": "<string>",
"config": {
"allowed_price_types": [
"ALL"
]
},
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_balance": "<string>",
"credits_available_breakdown": {
"free": "<string>",
"purchased": "<string>"
},
"currency": "<string>",
"customer_id": "<string>",
"description": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"name": "<string>",
"status": "published",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"wallet_status": "active",
"wallet_type": "PRE_PAID"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}Create a new wallet
Use when giving a customer a prepaid or credit balance (e.g. prepaid plans or promotional credits).
curl --request POST \
--url https://us.api.flexprice.io/v1/wallets \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"currency": "<string>",
"alert_settings": {
"alert_enabled": true,
"critical": {
"threshold": 123
},
"info": {
"threshold": 123
},
"warning": {
"threshold": 123
}
},
"auto_topup": {
"amount": 123,
"enabled": true,
"invoicing": true,
"threshold": 123
},
"conversion_rate": "1",
"customer_id": "<string>",
"description": "<string>",
"external_customer_id": "<string>",
"initial_credits_expiry_date_utc": "<string>",
"initial_credits_to_load": "0",
"initial_credits_to_load_expiry_date": 123,
"metadata": {},
"price_unit": "<string>",
"topup_conversion_rate": "<string>"
}
'import requests
url = "https://us.api.flexprice.io/v1/wallets"
payload = {
"currency": "<string>",
"alert_settings": {
"alert_enabled": True,
"critical": { "threshold": 123 },
"info": { "threshold": 123 },
"warning": { "threshold": 123 }
},
"auto_topup": {
"amount": 123,
"enabled": True,
"invoicing": True,
"threshold": 123
},
"conversion_rate": "1",
"customer_id": "<string>",
"description": "<string>",
"external_customer_id": "<string>",
"initial_credits_expiry_date_utc": "<string>",
"initial_credits_to_load": "0",
"initial_credits_to_load_expiry_date": 123,
"metadata": {},
"price_unit": "<string>",
"topup_conversion_rate": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
currency: '<string>',
alert_settings: {
alert_enabled: true,
critical: {threshold: 123},
info: {threshold: 123},
warning: {threshold: 123}
},
auto_topup: {amount: 123, enabled: true, invoicing: true, threshold: 123},
conversion_rate: '1',
customer_id: '<string>',
description: '<string>',
external_customer_id: '<string>',
initial_credits_expiry_date_utc: '<string>',
initial_credits_to_load: '0',
initial_credits_to_load_expiry_date: 123,
metadata: {},
price_unit: '<string>',
topup_conversion_rate: '<string>'
})
};
fetch('https://us.api.flexprice.io/v1/wallets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://us.api.flexprice.io/v1/wallets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'currency' => '<string>',
'alert_settings' => [
'alert_enabled' => true,
'critical' => [
'threshold' => 123
],
'info' => [
'threshold' => 123
],
'warning' => [
'threshold' => 123
]
],
'auto_topup' => [
'amount' => 123,
'enabled' => true,
'invoicing' => true,
'threshold' => 123
],
'conversion_rate' => '1',
'customer_id' => '<string>',
'description' => '<string>',
'external_customer_id' => '<string>',
'initial_credits_expiry_date_utc' => '<string>',
'initial_credits_to_load' => '0',
'initial_credits_to_load_expiry_date' => 123,
'metadata' => [
],
'price_unit' => '<string>',
'topup_conversion_rate' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://us.api.flexprice.io/v1/wallets"
payload := strings.NewReader("{\n \"currency\": \"<string>\",\n \"alert_settings\": {\n \"alert_enabled\": true,\n \"critical\": {\n \"threshold\": 123\n },\n \"info\": {\n \"threshold\": 123\n },\n \"warning\": {\n \"threshold\": 123\n }\n },\n \"auto_topup\": {\n \"amount\": 123,\n \"enabled\": true,\n \"invoicing\": true,\n \"threshold\": 123\n },\n \"conversion_rate\": \"1\",\n \"customer_id\": \"<string>\",\n \"description\": \"<string>\",\n \"external_customer_id\": \"<string>\",\n \"initial_credits_expiry_date_utc\": \"<string>\",\n \"initial_credits_to_load\": \"0\",\n \"initial_credits_to_load_expiry_date\": 123,\n \"metadata\": {},\n \"price_unit\": \"<string>\",\n \"topup_conversion_rate\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://us.api.flexprice.io/v1/wallets")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"currency\": \"<string>\",\n \"alert_settings\": {\n \"alert_enabled\": true,\n \"critical\": {\n \"threshold\": 123\n },\n \"info\": {\n \"threshold\": 123\n },\n \"warning\": {\n \"threshold\": 123\n }\n },\n \"auto_topup\": {\n \"amount\": 123,\n \"enabled\": true,\n \"invoicing\": true,\n \"threshold\": 123\n },\n \"conversion_rate\": \"1\",\n \"customer_id\": \"<string>\",\n \"description\": \"<string>\",\n \"external_customer_id\": \"<string>\",\n \"initial_credits_expiry_date_utc\": \"<string>\",\n \"initial_credits_to_load\": \"0\",\n \"initial_credits_to_load_expiry_date\": 123,\n \"metadata\": {},\n \"price_unit\": \"<string>\",\n \"topup_conversion_rate\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://us.api.flexprice.io/v1/wallets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"currency\": \"<string>\",\n \"alert_settings\": {\n \"alert_enabled\": true,\n \"critical\": {\n \"threshold\": 123\n },\n \"info\": {\n \"threshold\": 123\n },\n \"warning\": {\n \"threshold\": 123\n }\n },\n \"auto_topup\": {\n \"amount\": 123,\n \"enabled\": true,\n \"invoicing\": true,\n \"threshold\": 123\n },\n \"conversion_rate\": \"1\",\n \"customer_id\": \"<string>\",\n \"description\": \"<string>\",\n \"external_customer_id\": \"<string>\",\n \"initial_credits_expiry_date_utc\": \"<string>\",\n \"initial_credits_to_load\": \"0\",\n \"initial_credits_to_load_expiry_date\": 123,\n \"metadata\": {},\n \"price_unit\": \"<string>\",\n \"topup_conversion_rate\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"alert_settings": {
"alert_enabled": true,
"critical": {
"condition": "above",
"threshold": 123
},
"info": {
"condition": "above",
"threshold": 123
},
"warning": {
"condition": "above",
"threshold": 123
}
},
"alert_state": "ok",
"auto_topup": {
"amount": 123,
"enabled": true,
"invoicing": true,
"threshold": 123
},
"balance": "<string>",
"config": {
"allowed_price_types": [
"ALL"
]
},
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_balance": "<string>",
"credits_available_breakdown": {
"free": "<string>",
"purchased": "<string>"
},
"currency": "<string>",
"customer_id": "<string>",
"description": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"name": "<string>",
"status": "published",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"wallet_status": "active",
"wallet_type": "PRE_PAID"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}Authorizations
Enter your API key in the format x-api-key <api-key>*
Body
Create wallet request
Show child attributes
Show child attributes
Show child attributes
Show child attributes
amount in the currency = number of credits * conversion_rate ex if conversion_rate is 1, then 1 USD = 1 credit ex if conversion_rate is 2, then 1 USD = 0.5 credits ex if conversion_rate is 0.5, then 1 USD = 2 credits
external_customer_id is the customer id in the external system
initial_credits_expiry_date_utc is the expiry date in UTC timezone (optional to set nil means no expiry) ex 2025-01-01 00:00:00 UTC
initial_credits_to_load is the number of credits to load to the wallet if not provided, the wallet will be created with 0 balance NOTE: this is not the amount in the currency, but the number of credits
initial_credits_to_load_expiry_date YYYYMMDD format in UTC timezone (optional to set nil means no expiry) for ex 20250101 means the credits will expire on 2025-01-01 00:00:00 UTC hence they will be available for use until 2024-12-31 23:59:59 UTC
Show child attributes
Show child attributes
price_unit is the code of the price unit to use for wallet creation If provided, the price unit will be used to set the currency and conversion rate of the wallet:
- currency: set to price unit's base_currency
- conversion_rate: set to price unit's conversion_rate
topup_conversion_rate is the conversion rate for the topup to the currency ex if topup_conversion_rate is 1, then 1 USD = 1 credit ex if topup_conversion_rate is 2, then 1 USD = 0.5 credits ex if topup_conversion_rate is 0.5, then 1 USD = 2 credits
PRE_PAID, POST_PAID Response
OK
Show child attributes
Show child attributes
ok, info, warning, in_alarm Show child attributes
Show child attributes
Show child attributes
Show child attributes
amount in the currency = number of credits * conversion_rate ex if conversion_rate is 1, then 1 USD = 1 credit ex if conversion_rate is 2, then 1 USD = 0.5 credits ex if conversion_rate is 0.5, then 1 USD = 2 credits
Show child attributes
Show child attributes
Show child attributes
Show child attributes
published, deleted, archived topup_conversion_rate is the conversion rate for the topup to the currency ex if topup_conversion_rate is 1, then 1 USD = 1 credit ex if topup_conversion_rate is 2, then 1 USD = 0.5 credits ex if topup_conversion_rate is 0.5, then 1 USD = 2 credits
active, frozen, closed PRE_PAID, POST_PAID 
