Update a wallet
curl --request PUT \
--url https://api.getlago.com/api/v1/customers/{external_customer_id}/wallets/{code} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"wallet": {
"name": "new_name",
"code": "prepaid",
"priority": 50,
"expiration_at": "2022-07-07T23:59:59Z",
"invoice_requires_successful_payment": false,
"billing_entity_code": "default",
"invoice_custom_section": {
"skip_invoice_custom_sections": false,
"invoice_custom_section_codes": [
"eu_bank_details"
]
},
"recurring_transaction_rules": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"trigger": "interval",
"method": "target",
"interval": "monthly",
"threshold_credits": "20.0",
"paid_credits": "20.0",
"granted_credits": "10.0",
"grants_target_top_up": false,
"started_at": "2022-08-08T00:00:00Z",
"expiration_at": "2023-09-30T23:59:59Z",
"target_ongoing_balance": "200.0",
"invoice_requires_successful_payment": false,
"transaction_metadata": [
{
"key": "example_key",
"value": "example_value"
},
{
"key": "another_key",
"value": "another_value"
}
],
"transaction_name": "Tokens for models 'high-fidelity-boost'",
"invoice_custom_section": {
"skip_invoice_custom_sections": false,
"invoice_custom_section_codes": [
"eu_bank_details"
]
},
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
}
],
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
},
"applies_to": {
"fee_types": [
"charge"
],
"billable_metric_codes": []
},
"metadata": {
"external_id": "ext-123",
"synced_at": "2024-01-15"
}
}
}
EOFimport requests
url = "https://api.getlago.com/api/v1/customers/{external_customer_id}/wallets/{code}"
payload = { "wallet": {
"name": "new_name",
"code": "prepaid",
"priority": 50,
"expiration_at": "2022-07-07T23:59:59Z",
"invoice_requires_successful_payment": False,
"billing_entity_code": "default",
"invoice_custom_section": {
"skip_invoice_custom_sections": False,
"invoice_custom_section_codes": ["eu_bank_details"]
},
"recurring_transaction_rules": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"trigger": "interval",
"method": "target",
"interval": "monthly",
"threshold_credits": "20.0",
"paid_credits": "20.0",
"granted_credits": "10.0",
"grants_target_top_up": False,
"started_at": "2022-08-08T00:00:00Z",
"expiration_at": "2023-09-30T23:59:59Z",
"target_ongoing_balance": "200.0",
"invoice_requires_successful_payment": False,
"transaction_metadata": [
{
"key": "example_key",
"value": "example_value"
},
{
"key": "another_key",
"value": "another_value"
}
],
"transaction_name": "Tokens for models 'high-fidelity-boost'",
"invoice_custom_section": {
"skip_invoice_custom_sections": False,
"invoice_custom_section_codes": ["eu_bank_details"]
},
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
}
],
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
},
"applies_to": {
"fee_types": ["charge"],
"billable_metric_codes": []
},
"metadata": {
"external_id": "ext-123",
"synced_at": "2024-01-15"
}
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
wallet: {
name: 'new_name',
code: 'prepaid',
priority: 50,
expiration_at: '2022-07-07T23:59:59Z',
invoice_requires_successful_payment: false,
billing_entity_code: 'default',
invoice_custom_section: {
skip_invoice_custom_sections: false,
invoice_custom_section_codes: ['eu_bank_details']
},
recurring_transaction_rules: [
{
lago_id: '1a901a90-1a90-1a90-1a90-1a901a901a90',
trigger: 'interval',
method: 'target',
interval: 'monthly',
threshold_credits: '20.0',
paid_credits: '20.0',
granted_credits: '10.0',
grants_target_top_up: false,
started_at: '2022-08-08T00:00:00Z',
expiration_at: '2023-09-30T23:59:59Z',
target_ongoing_balance: '200.0',
invoice_requires_successful_payment: false,
transaction_metadata: [
{key: 'example_key', value: 'example_value'},
{key: 'another_key', value: 'another_value'}
],
transaction_name: 'Tokens for models \'high-fidelity-boost\'',
invoice_custom_section: {
skip_invoice_custom_sections: false,
invoice_custom_section_codes: ['eu_bank_details']
},
payment_method: {
payment_method_type: 'provider',
payment_method_id: '1a901a90-1a90-1a90-1a90-1a901a901a90'
}
}
],
payment_method: {
payment_method_type: 'provider',
payment_method_id: '1a901a90-1a90-1a90-1a90-1a901a901a90'
},
applies_to: {fee_types: ['charge'], billable_metric_codes: []},
metadata: {external_id: 'ext-123', synced_at: '2024-01-15'}
}
})
};
fetch('https://api.getlago.com/api/v1/customers/{external_customer_id}/wallets/{code}', 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://api.getlago.com/api/v1/customers/{external_customer_id}/wallets/{code}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'wallet' => [
'name' => 'new_name',
'code' => 'prepaid',
'priority' => 50,
'expiration_at' => '2022-07-07T23:59:59Z',
'invoice_requires_successful_payment' => false,
'billing_entity_code' => 'default',
'invoice_custom_section' => [
'skip_invoice_custom_sections' => false,
'invoice_custom_section_codes' => [
'eu_bank_details'
]
],
'recurring_transaction_rules' => [
[
'lago_id' => '1a901a90-1a90-1a90-1a90-1a901a901a90',
'trigger' => 'interval',
'method' => 'target',
'interval' => 'monthly',
'threshold_credits' => '20.0',
'paid_credits' => '20.0',
'granted_credits' => '10.0',
'grants_target_top_up' => false,
'started_at' => '2022-08-08T00:00:00Z',
'expiration_at' => '2023-09-30T23:59:59Z',
'target_ongoing_balance' => '200.0',
'invoice_requires_successful_payment' => false,
'transaction_metadata' => [
[
'key' => 'example_key',
'value' => 'example_value'
],
[
'key' => 'another_key',
'value' => 'another_value'
]
],
'transaction_name' => 'Tokens for models \'high-fidelity-boost\'',
'invoice_custom_section' => [
'skip_invoice_custom_sections' => false,
'invoice_custom_section_codes' => [
'eu_bank_details'
]
],
'payment_method' => [
'payment_method_type' => 'provider',
'payment_method_id' => '1a901a90-1a90-1a90-1a90-1a901a901a90'
]
]
],
'payment_method' => [
'payment_method_type' => 'provider',
'payment_method_id' => '1a901a90-1a90-1a90-1a90-1a901a901a90'
],
'applies_to' => [
'fee_types' => [
'charge'
],
'billable_metric_codes' => [
]
],
'metadata' => [
'external_id' => 'ext-123',
'synced_at' => '2024-01-15'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.getlago.com/api/v1/customers/{external_customer_id}/wallets/{code}"
payload := strings.NewReader("{\n \"wallet\": {\n \"name\": \"new_name\",\n \"code\": \"prepaid\",\n \"priority\": 50,\n \"expiration_at\": \"2022-07-07T23:59:59Z\",\n \"invoice_requires_successful_payment\": false,\n \"billing_entity_code\": \"default\",\n \"invoice_custom_section\": {\n \"skip_invoice_custom_sections\": false,\n \"invoice_custom_section_codes\": [\n \"eu_bank_details\"\n ]\n },\n \"recurring_transaction_rules\": [\n {\n \"lago_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"trigger\": \"interval\",\n \"method\": \"target\",\n \"interval\": \"monthly\",\n \"threshold_credits\": \"20.0\",\n \"paid_credits\": \"20.0\",\n \"granted_credits\": \"10.0\",\n \"grants_target_top_up\": false,\n \"started_at\": \"2022-08-08T00:00:00Z\",\n \"expiration_at\": \"2023-09-30T23:59:59Z\",\n \"target_ongoing_balance\": \"200.0\",\n \"invoice_requires_successful_payment\": false,\n \"transaction_metadata\": [\n {\n \"key\": \"example_key\",\n \"value\": \"example_value\"\n },\n {\n \"key\": \"another_key\",\n \"value\": \"another_value\"\n }\n ],\n \"transaction_name\": \"Tokens for models 'high-fidelity-boost'\",\n \"invoice_custom_section\": {\n \"skip_invoice_custom_sections\": false,\n \"invoice_custom_section_codes\": [\n \"eu_bank_details\"\n ]\n },\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n }\n }\n ],\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n },\n \"applies_to\": {\n \"fee_types\": [\n \"charge\"\n ],\n \"billable_metric_codes\": []\n },\n \"metadata\": {\n \"external_id\": \"ext-123\",\n \"synced_at\": \"2024-01-15\"\n }\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.put("https://api.getlago.com/api/v1/customers/{external_customer_id}/wallets/{code}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"wallet\": {\n \"name\": \"new_name\",\n \"code\": \"prepaid\",\n \"priority\": 50,\n \"expiration_at\": \"2022-07-07T23:59:59Z\",\n \"invoice_requires_successful_payment\": false,\n \"billing_entity_code\": \"default\",\n \"invoice_custom_section\": {\n \"skip_invoice_custom_sections\": false,\n \"invoice_custom_section_codes\": [\n \"eu_bank_details\"\n ]\n },\n \"recurring_transaction_rules\": [\n {\n \"lago_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"trigger\": \"interval\",\n \"method\": \"target\",\n \"interval\": \"monthly\",\n \"threshold_credits\": \"20.0\",\n \"paid_credits\": \"20.0\",\n \"granted_credits\": \"10.0\",\n \"grants_target_top_up\": false,\n \"started_at\": \"2022-08-08T00:00:00Z\",\n \"expiration_at\": \"2023-09-30T23:59:59Z\",\n \"target_ongoing_balance\": \"200.0\",\n \"invoice_requires_successful_payment\": false,\n \"transaction_metadata\": [\n {\n \"key\": \"example_key\",\n \"value\": \"example_value\"\n },\n {\n \"key\": \"another_key\",\n \"value\": \"another_value\"\n }\n ],\n \"transaction_name\": \"Tokens for models 'high-fidelity-boost'\",\n \"invoice_custom_section\": {\n \"skip_invoice_custom_sections\": false,\n \"invoice_custom_section_codes\": [\n \"eu_bank_details\"\n ]\n },\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n }\n }\n ],\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n },\n \"applies_to\": {\n \"fee_types\": [\n \"charge\"\n ],\n \"billable_metric_codes\": []\n },\n \"metadata\": {\n \"external_id\": \"ext-123\",\n \"synced_at\": \"2024-01-15\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v1/customers/{external_customer_id}/wallets/{code}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"wallet\": {\n \"name\": \"new_name\",\n \"code\": \"prepaid\",\n \"priority\": 50,\n \"expiration_at\": \"2022-07-07T23:59:59Z\",\n \"invoice_requires_successful_payment\": false,\n \"billing_entity_code\": \"default\",\n \"invoice_custom_section\": {\n \"skip_invoice_custom_sections\": false,\n \"invoice_custom_section_codes\": [\n \"eu_bank_details\"\n ]\n },\n \"recurring_transaction_rules\": [\n {\n \"lago_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"trigger\": \"interval\",\n \"method\": \"target\",\n \"interval\": \"monthly\",\n \"threshold_credits\": \"20.0\",\n \"paid_credits\": \"20.0\",\n \"granted_credits\": \"10.0\",\n \"grants_target_top_up\": false,\n \"started_at\": \"2022-08-08T00:00:00Z\",\n \"expiration_at\": \"2023-09-30T23:59:59Z\",\n \"target_ongoing_balance\": \"200.0\",\n \"invoice_requires_successful_payment\": false,\n \"transaction_metadata\": [\n {\n \"key\": \"example_key\",\n \"value\": \"example_value\"\n },\n {\n \"key\": \"another_key\",\n \"value\": \"another_value\"\n }\n ],\n \"transaction_name\": \"Tokens for models 'high-fidelity-boost'\",\n \"invoice_custom_section\": {\n \"skip_invoice_custom_sections\": false,\n \"invoice_custom_section_codes\": [\n \"eu_bank_details\"\n ]\n },\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n }\n }\n ],\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n },\n \"applies_to\": {\n \"fee_types\": [\n \"charge\"\n ],\n \"billable_metric_codes\": []\n },\n \"metadata\": {\n \"external_id\": \"ext-123\",\n \"synced_at\": \"2024-01-15\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"wallet": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "hooli_1234",
"status": "active",
"currency": "USD",
"rate_amount": "1.5",
"credits_balance": "28.0",
"balance_cents": 1000,
"consumed_credits": "2.0",
"created_at": "2022-04-29T08:59:51Z",
"invoice_requires_successful_payment": false,
"ongoing_balance_cents": 800,
"ongoing_usage_balance_cents": 200,
"credits_ongoing_balance": "8.0",
"credits_ongoing_usage_balance": "2.0",
"billing_entity_code": "default",
"name": "Prepaid",
"code": "prepaid",
"priority": 50,
"expiration_at": null,
"last_balance_sync_at": "2022-04-29T08:59:51Z",
"last_consumed_credit_at": "2022-04-29T08:59:51Z",
"terminated_at": "2022-09-14T16:35:31Z",
"applies_to": {
"fee_types": [
"charge"
],
"billable_metric_codes": [
"bm1"
]
},
"recurring_transaction_rules": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"trigger": "interval",
"method": "target",
"interval": "monthly",
"status": "active",
"threshold_credits": "20.0",
"paid_credits": "20.0",
"granted_credits": "10.0",
"grants_target_top_up": false,
"started_at": "2022-08-08T00:00:00Z",
"target_ongoing_balance": "200.0",
"created_at": "2022-04-29T08:59:51Z",
"expiration_at": "2023-09-30T23:59:59Z",
"invoice_requires_successful_payment": false,
"transaction_metadata": [
{
"key": "example_key",
"value": "example_value"
},
{
"key": "another_key",
"value": "another_value"
}
],
"transaction_name": "Tokens for models 'high-fidelity-boost'",
"ignore_paid_top_up_limits": false,
"applied_invoice_custom_sections": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"created_at": "2023-07-06T14:35:58Z",
"invoice_custom_section": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "EU Bank Details",
"code": "eu_bank_details",
"description": "This section contains the bank details for EU customers.",
"details": "Bank Name: Lago Bank, IBAN: FR7630004000031234567890143",
"display_name": "Bank Details:",
"applied_to_organization": true,
"organization_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"created_at": "2023-07-06T14:35:58Z"
},
"invoice_custom_section_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
],
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
}
],
"paid_top_up_min_amount_cents": 100,
"paid_top_up_max_amount_cents": 1000,
"applied_invoice_custom_sections": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"created_at": "2023-07-06T14:35:58Z",
"invoice_custom_section": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "EU Bank Details",
"code": "eu_bank_details",
"description": "This section contains the bank details for EU customers.",
"details": "Bank Name: Lago Bank, IBAN: FR7630004000031234567890143",
"display_name": "Bank Details:",
"applied_to_organization": true,
"organization_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"created_at": "2023-07-06T14:35:58Z"
},
"invoice_custom_section_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
],
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
},
"metadata": {
"external_id": "ext-123",
"synced_at": "2024-01-15",
"source": null
}
}
}{
"status": 400,
"error": "Bad request"
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 403,
"error": "Forbidden",
"code": "feature_unavailable"
}{
"status": 404,
"error": "Not Found",
"code": "object_not_found"
}{
"status": 422,
"error": "Unprocessable entity",
"code": "validation_errors",
"error_details": {}
}Wallets by code
Update a wallet by code
This endpoint is used to update an existing wallet, identified by the customer’s external ID and the wallet code.
PUT
/
customers
/
{external_customer_id}
/
wallets
/
{code}
Update a wallet
curl --request PUT \
--url https://api.getlago.com/api/v1/customers/{external_customer_id}/wallets/{code} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"wallet": {
"name": "new_name",
"code": "prepaid",
"priority": 50,
"expiration_at": "2022-07-07T23:59:59Z",
"invoice_requires_successful_payment": false,
"billing_entity_code": "default",
"invoice_custom_section": {
"skip_invoice_custom_sections": false,
"invoice_custom_section_codes": [
"eu_bank_details"
]
},
"recurring_transaction_rules": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"trigger": "interval",
"method": "target",
"interval": "monthly",
"threshold_credits": "20.0",
"paid_credits": "20.0",
"granted_credits": "10.0",
"grants_target_top_up": false,
"started_at": "2022-08-08T00:00:00Z",
"expiration_at": "2023-09-30T23:59:59Z",
"target_ongoing_balance": "200.0",
"invoice_requires_successful_payment": false,
"transaction_metadata": [
{
"key": "example_key",
"value": "example_value"
},
{
"key": "another_key",
"value": "another_value"
}
],
"transaction_name": "Tokens for models 'high-fidelity-boost'",
"invoice_custom_section": {
"skip_invoice_custom_sections": false,
"invoice_custom_section_codes": [
"eu_bank_details"
]
},
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
}
],
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
},
"applies_to": {
"fee_types": [
"charge"
],
"billable_metric_codes": []
},
"metadata": {
"external_id": "ext-123",
"synced_at": "2024-01-15"
}
}
}
EOFimport requests
url = "https://api.getlago.com/api/v1/customers/{external_customer_id}/wallets/{code}"
payload = { "wallet": {
"name": "new_name",
"code": "prepaid",
"priority": 50,
"expiration_at": "2022-07-07T23:59:59Z",
"invoice_requires_successful_payment": False,
"billing_entity_code": "default",
"invoice_custom_section": {
"skip_invoice_custom_sections": False,
"invoice_custom_section_codes": ["eu_bank_details"]
},
"recurring_transaction_rules": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"trigger": "interval",
"method": "target",
"interval": "monthly",
"threshold_credits": "20.0",
"paid_credits": "20.0",
"granted_credits": "10.0",
"grants_target_top_up": False,
"started_at": "2022-08-08T00:00:00Z",
"expiration_at": "2023-09-30T23:59:59Z",
"target_ongoing_balance": "200.0",
"invoice_requires_successful_payment": False,
"transaction_metadata": [
{
"key": "example_key",
"value": "example_value"
},
{
"key": "another_key",
"value": "another_value"
}
],
"transaction_name": "Tokens for models 'high-fidelity-boost'",
"invoice_custom_section": {
"skip_invoice_custom_sections": False,
"invoice_custom_section_codes": ["eu_bank_details"]
},
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
}
],
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
},
"applies_to": {
"fee_types": ["charge"],
"billable_metric_codes": []
},
"metadata": {
"external_id": "ext-123",
"synced_at": "2024-01-15"
}
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
wallet: {
name: 'new_name',
code: 'prepaid',
priority: 50,
expiration_at: '2022-07-07T23:59:59Z',
invoice_requires_successful_payment: false,
billing_entity_code: 'default',
invoice_custom_section: {
skip_invoice_custom_sections: false,
invoice_custom_section_codes: ['eu_bank_details']
},
recurring_transaction_rules: [
{
lago_id: '1a901a90-1a90-1a90-1a90-1a901a901a90',
trigger: 'interval',
method: 'target',
interval: 'monthly',
threshold_credits: '20.0',
paid_credits: '20.0',
granted_credits: '10.0',
grants_target_top_up: false,
started_at: '2022-08-08T00:00:00Z',
expiration_at: '2023-09-30T23:59:59Z',
target_ongoing_balance: '200.0',
invoice_requires_successful_payment: false,
transaction_metadata: [
{key: 'example_key', value: 'example_value'},
{key: 'another_key', value: 'another_value'}
],
transaction_name: 'Tokens for models \'high-fidelity-boost\'',
invoice_custom_section: {
skip_invoice_custom_sections: false,
invoice_custom_section_codes: ['eu_bank_details']
},
payment_method: {
payment_method_type: 'provider',
payment_method_id: '1a901a90-1a90-1a90-1a90-1a901a901a90'
}
}
],
payment_method: {
payment_method_type: 'provider',
payment_method_id: '1a901a90-1a90-1a90-1a90-1a901a901a90'
},
applies_to: {fee_types: ['charge'], billable_metric_codes: []},
metadata: {external_id: 'ext-123', synced_at: '2024-01-15'}
}
})
};
fetch('https://api.getlago.com/api/v1/customers/{external_customer_id}/wallets/{code}', 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://api.getlago.com/api/v1/customers/{external_customer_id}/wallets/{code}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'wallet' => [
'name' => 'new_name',
'code' => 'prepaid',
'priority' => 50,
'expiration_at' => '2022-07-07T23:59:59Z',
'invoice_requires_successful_payment' => false,
'billing_entity_code' => 'default',
'invoice_custom_section' => [
'skip_invoice_custom_sections' => false,
'invoice_custom_section_codes' => [
'eu_bank_details'
]
],
'recurring_transaction_rules' => [
[
'lago_id' => '1a901a90-1a90-1a90-1a90-1a901a901a90',
'trigger' => 'interval',
'method' => 'target',
'interval' => 'monthly',
'threshold_credits' => '20.0',
'paid_credits' => '20.0',
'granted_credits' => '10.0',
'grants_target_top_up' => false,
'started_at' => '2022-08-08T00:00:00Z',
'expiration_at' => '2023-09-30T23:59:59Z',
'target_ongoing_balance' => '200.0',
'invoice_requires_successful_payment' => false,
'transaction_metadata' => [
[
'key' => 'example_key',
'value' => 'example_value'
],
[
'key' => 'another_key',
'value' => 'another_value'
]
],
'transaction_name' => 'Tokens for models \'high-fidelity-boost\'',
'invoice_custom_section' => [
'skip_invoice_custom_sections' => false,
'invoice_custom_section_codes' => [
'eu_bank_details'
]
],
'payment_method' => [
'payment_method_type' => 'provider',
'payment_method_id' => '1a901a90-1a90-1a90-1a90-1a901a901a90'
]
]
],
'payment_method' => [
'payment_method_type' => 'provider',
'payment_method_id' => '1a901a90-1a90-1a90-1a90-1a901a901a90'
],
'applies_to' => [
'fee_types' => [
'charge'
],
'billable_metric_codes' => [
]
],
'metadata' => [
'external_id' => 'ext-123',
'synced_at' => '2024-01-15'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.getlago.com/api/v1/customers/{external_customer_id}/wallets/{code}"
payload := strings.NewReader("{\n \"wallet\": {\n \"name\": \"new_name\",\n \"code\": \"prepaid\",\n \"priority\": 50,\n \"expiration_at\": \"2022-07-07T23:59:59Z\",\n \"invoice_requires_successful_payment\": false,\n \"billing_entity_code\": \"default\",\n \"invoice_custom_section\": {\n \"skip_invoice_custom_sections\": false,\n \"invoice_custom_section_codes\": [\n \"eu_bank_details\"\n ]\n },\n \"recurring_transaction_rules\": [\n {\n \"lago_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"trigger\": \"interval\",\n \"method\": \"target\",\n \"interval\": \"monthly\",\n \"threshold_credits\": \"20.0\",\n \"paid_credits\": \"20.0\",\n \"granted_credits\": \"10.0\",\n \"grants_target_top_up\": false,\n \"started_at\": \"2022-08-08T00:00:00Z\",\n \"expiration_at\": \"2023-09-30T23:59:59Z\",\n \"target_ongoing_balance\": \"200.0\",\n \"invoice_requires_successful_payment\": false,\n \"transaction_metadata\": [\n {\n \"key\": \"example_key\",\n \"value\": \"example_value\"\n },\n {\n \"key\": \"another_key\",\n \"value\": \"another_value\"\n }\n ],\n \"transaction_name\": \"Tokens for models 'high-fidelity-boost'\",\n \"invoice_custom_section\": {\n \"skip_invoice_custom_sections\": false,\n \"invoice_custom_section_codes\": [\n \"eu_bank_details\"\n ]\n },\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n }\n }\n ],\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n },\n \"applies_to\": {\n \"fee_types\": [\n \"charge\"\n ],\n \"billable_metric_codes\": []\n },\n \"metadata\": {\n \"external_id\": \"ext-123\",\n \"synced_at\": \"2024-01-15\"\n }\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.put("https://api.getlago.com/api/v1/customers/{external_customer_id}/wallets/{code}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"wallet\": {\n \"name\": \"new_name\",\n \"code\": \"prepaid\",\n \"priority\": 50,\n \"expiration_at\": \"2022-07-07T23:59:59Z\",\n \"invoice_requires_successful_payment\": false,\n \"billing_entity_code\": \"default\",\n \"invoice_custom_section\": {\n \"skip_invoice_custom_sections\": false,\n \"invoice_custom_section_codes\": [\n \"eu_bank_details\"\n ]\n },\n \"recurring_transaction_rules\": [\n {\n \"lago_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"trigger\": \"interval\",\n \"method\": \"target\",\n \"interval\": \"monthly\",\n \"threshold_credits\": \"20.0\",\n \"paid_credits\": \"20.0\",\n \"granted_credits\": \"10.0\",\n \"grants_target_top_up\": false,\n \"started_at\": \"2022-08-08T00:00:00Z\",\n \"expiration_at\": \"2023-09-30T23:59:59Z\",\n \"target_ongoing_balance\": \"200.0\",\n \"invoice_requires_successful_payment\": false,\n \"transaction_metadata\": [\n {\n \"key\": \"example_key\",\n \"value\": \"example_value\"\n },\n {\n \"key\": \"another_key\",\n \"value\": \"another_value\"\n }\n ],\n \"transaction_name\": \"Tokens for models 'high-fidelity-boost'\",\n \"invoice_custom_section\": {\n \"skip_invoice_custom_sections\": false,\n \"invoice_custom_section_codes\": [\n \"eu_bank_details\"\n ]\n },\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n }\n }\n ],\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n },\n \"applies_to\": {\n \"fee_types\": [\n \"charge\"\n ],\n \"billable_metric_codes\": []\n },\n \"metadata\": {\n \"external_id\": \"ext-123\",\n \"synced_at\": \"2024-01-15\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v1/customers/{external_customer_id}/wallets/{code}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"wallet\": {\n \"name\": \"new_name\",\n \"code\": \"prepaid\",\n \"priority\": 50,\n \"expiration_at\": \"2022-07-07T23:59:59Z\",\n \"invoice_requires_successful_payment\": false,\n \"billing_entity_code\": \"default\",\n \"invoice_custom_section\": {\n \"skip_invoice_custom_sections\": false,\n \"invoice_custom_section_codes\": [\n \"eu_bank_details\"\n ]\n },\n \"recurring_transaction_rules\": [\n {\n \"lago_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"trigger\": \"interval\",\n \"method\": \"target\",\n \"interval\": \"monthly\",\n \"threshold_credits\": \"20.0\",\n \"paid_credits\": \"20.0\",\n \"granted_credits\": \"10.0\",\n \"grants_target_top_up\": false,\n \"started_at\": \"2022-08-08T00:00:00Z\",\n \"expiration_at\": \"2023-09-30T23:59:59Z\",\n \"target_ongoing_balance\": \"200.0\",\n \"invoice_requires_successful_payment\": false,\n \"transaction_metadata\": [\n {\n \"key\": \"example_key\",\n \"value\": \"example_value\"\n },\n {\n \"key\": \"another_key\",\n \"value\": \"another_value\"\n }\n ],\n \"transaction_name\": \"Tokens for models 'high-fidelity-boost'\",\n \"invoice_custom_section\": {\n \"skip_invoice_custom_sections\": false,\n \"invoice_custom_section_codes\": [\n \"eu_bank_details\"\n ]\n },\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n }\n }\n ],\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n },\n \"applies_to\": {\n \"fee_types\": [\n \"charge\"\n ],\n \"billable_metric_codes\": []\n },\n \"metadata\": {\n \"external_id\": \"ext-123\",\n \"synced_at\": \"2024-01-15\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"wallet": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "hooli_1234",
"status": "active",
"currency": "USD",
"rate_amount": "1.5",
"credits_balance": "28.0",
"balance_cents": 1000,
"consumed_credits": "2.0",
"created_at": "2022-04-29T08:59:51Z",
"invoice_requires_successful_payment": false,
"ongoing_balance_cents": 800,
"ongoing_usage_balance_cents": 200,
"credits_ongoing_balance": "8.0",
"credits_ongoing_usage_balance": "2.0",
"billing_entity_code": "default",
"name": "Prepaid",
"code": "prepaid",
"priority": 50,
"expiration_at": null,
"last_balance_sync_at": "2022-04-29T08:59:51Z",
"last_consumed_credit_at": "2022-04-29T08:59:51Z",
"terminated_at": "2022-09-14T16:35:31Z",
"applies_to": {
"fee_types": [
"charge"
],
"billable_metric_codes": [
"bm1"
]
},
"recurring_transaction_rules": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"trigger": "interval",
"method": "target",
"interval": "monthly",
"status": "active",
"threshold_credits": "20.0",
"paid_credits": "20.0",
"granted_credits": "10.0",
"grants_target_top_up": false,
"started_at": "2022-08-08T00:00:00Z",
"target_ongoing_balance": "200.0",
"created_at": "2022-04-29T08:59:51Z",
"expiration_at": "2023-09-30T23:59:59Z",
"invoice_requires_successful_payment": false,
"transaction_metadata": [
{
"key": "example_key",
"value": "example_value"
},
{
"key": "another_key",
"value": "another_value"
}
],
"transaction_name": "Tokens for models 'high-fidelity-boost'",
"ignore_paid_top_up_limits": false,
"applied_invoice_custom_sections": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"created_at": "2023-07-06T14:35:58Z",
"invoice_custom_section": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "EU Bank Details",
"code": "eu_bank_details",
"description": "This section contains the bank details for EU customers.",
"details": "Bank Name: Lago Bank, IBAN: FR7630004000031234567890143",
"display_name": "Bank Details:",
"applied_to_organization": true,
"organization_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"created_at": "2023-07-06T14:35:58Z"
},
"invoice_custom_section_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
],
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
}
],
"paid_top_up_min_amount_cents": 100,
"paid_top_up_max_amount_cents": 1000,
"applied_invoice_custom_sections": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"created_at": "2023-07-06T14:35:58Z",
"invoice_custom_section": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "EU Bank Details",
"code": "eu_bank_details",
"description": "This section contains the bank details for EU customers.",
"details": "Bank Name: Lago Bank, IBAN: FR7630004000031234567890143",
"display_name": "Bank Details:",
"applied_to_organization": true,
"organization_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"created_at": "2023-07-06T14:35:58Z"
},
"invoice_custom_section_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
],
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
},
"metadata": {
"external_id": "ext-123",
"synced_at": "2024-01-15",
"source": null
}
}
}{
"status": 400,
"error": "Bad request"
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 403,
"error": "Forbidden",
"code": "feature_unavailable"
}{
"status": 404,
"error": "Not Found",
"code": "object_not_found"
}{
"status": 422,
"error": "Unprocessable entity",
"code": "validation_errors",
"error_details": {}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The customer external unique identifier (provided by your own application)
Example:
"5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
A unique wallet identifier within a customer. It is either set by the user at creation or auto-generated by Lago if not provided.
Example:
"wallet-code"
Body
application/json
Wallet update payload
Show child attributes
Show child attributes
Response
Wallet updated
Show child attributes
Show child attributes
Was this page helpful?
⌘I