curl --request POST \
--url https://api.sandbox.lead.bank/v2/user_credit_transactions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"user_credit_balance_id": "user_credit_balance_1HCpXwx2EK9oYluWbacgeCnFcLf",
"type": "card",
"description": "Monthly card fee",
"currency": "USD",
"amount": 1500,
"amount_breakdown": {
"principal": 0,
"interest": 0,
"fees": 1500
},
"effective_at": "2026-09-30T00:00:00Z",
"amount_in_usd": 1630,
"card_settlement_date": "2026-09-30",
"card": {
"card_id": "card_xyz123",
"bin": "412345",
"network": "visa",
"original_user_credit_transaction_id": "user_credit_transaction_2JdQyVm8LpT4nWxZ7aBcEfGhKjR",
"network_transfer_type": "card",
"settlement": {
"amount": 1500,
"currency": "USD"
},
"authorization": {
"amount": 1500,
"currency": "USD"
},
"merchant": {
"name": "Acme Inc.",
"mcc": "5411",
"address": {
"line_1": "123 Main St",
"city": "Kansas City",
"state": "MO",
"postal_code": "64105",
"country": "US"
}
}
},
"funding_id": "funding_0o5Fs0EELR0fUjHjbCnEtdUwQe3",
"metadata": {}
}
'import requests
url = "https://api.sandbox.lead.bank/v2/user_credit_transactions"
payload = {
"user_credit_balance_id": "user_credit_balance_1HCpXwx2EK9oYluWbacgeCnFcLf",
"type": "card",
"description": "Monthly card fee",
"currency": "USD",
"amount": 1500,
"amount_breakdown": {
"principal": 0,
"interest": 0,
"fees": 1500
},
"effective_at": "2026-09-30T00:00:00Z",
"amount_in_usd": 1630,
"card_settlement_date": "2026-09-30",
"card": {
"card_id": "card_xyz123",
"bin": "412345",
"network": "visa",
"original_user_credit_transaction_id": "user_credit_transaction_2JdQyVm8LpT4nWxZ7aBcEfGhKjR",
"network_transfer_type": "card",
"settlement": {
"amount": 1500,
"currency": "USD"
},
"authorization": {
"amount": 1500,
"currency": "USD"
},
"merchant": {
"name": "Acme Inc.",
"mcc": "5411",
"address": {
"line_1": "123 Main St",
"city": "Kansas City",
"state": "MO",
"postal_code": "64105",
"country": "US"
}
}
},
"funding_id": "funding_0o5Fs0EELR0fUjHjbCnEtdUwQe3",
"metadata": {}
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
user_credit_balance_id: 'user_credit_balance_1HCpXwx2EK9oYluWbacgeCnFcLf',
type: 'card',
description: 'Monthly card fee',
currency: 'USD',
amount: 1500,
amount_breakdown: {principal: 0, interest: 0, fees: 1500},
effective_at: '2026-09-30T00:00:00Z',
amount_in_usd: 1630,
card_settlement_date: '2026-09-30',
card: {
card_id: 'card_xyz123',
bin: '412345',
network: 'visa',
original_user_credit_transaction_id: 'user_credit_transaction_2JdQyVm8LpT4nWxZ7aBcEfGhKjR',
network_transfer_type: 'card',
settlement: {amount: 1500, currency: 'USD'},
authorization: {amount: 1500, currency: 'USD'},
merchant: {
name: 'Acme Inc.',
mcc: '5411',
address: {
line_1: '123 Main St',
city: 'Kansas City',
state: 'MO',
postal_code: '64105',
country: 'US'
}
}
},
funding_id: 'funding_0o5Fs0EELR0fUjHjbCnEtdUwQe3',
metadata: {}
})
};
fetch('https://api.sandbox.lead.bank/v2/user_credit_transactions', 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.sandbox.lead.bank/v2/user_credit_transactions",
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([
'user_credit_balance_id' => 'user_credit_balance_1HCpXwx2EK9oYluWbacgeCnFcLf',
'type' => 'card',
'description' => 'Monthly card fee',
'currency' => 'USD',
'amount' => 1500,
'amount_breakdown' => [
'principal' => 0,
'interest' => 0,
'fees' => 1500
],
'effective_at' => '2026-09-30T00:00:00Z',
'amount_in_usd' => 1630,
'card_settlement_date' => '2026-09-30',
'card' => [
'card_id' => 'card_xyz123',
'bin' => '412345',
'network' => 'visa',
'original_user_credit_transaction_id' => 'user_credit_transaction_2JdQyVm8LpT4nWxZ7aBcEfGhKjR',
'network_transfer_type' => 'card',
'settlement' => [
'amount' => 1500,
'currency' => 'USD'
],
'authorization' => [
'amount' => 1500,
'currency' => 'USD'
],
'merchant' => [
'name' => 'Acme Inc.',
'mcc' => '5411',
'address' => [
'line_1' => '123 Main St',
'city' => 'Kansas City',
'state' => 'MO',
'postal_code' => '64105',
'country' => 'US'
]
]
],
'funding_id' => 'funding_0o5Fs0EELR0fUjHjbCnEtdUwQe3',
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-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://api.sandbox.lead.bank/v2/user_credit_transactions"
payload := strings.NewReader("{\n \"user_credit_balance_id\": \"user_credit_balance_1HCpXwx2EK9oYluWbacgeCnFcLf\",\n \"type\": \"card\",\n \"description\": \"Monthly card fee\",\n \"currency\": \"USD\",\n \"amount\": 1500,\n \"amount_breakdown\": {\n \"principal\": 0,\n \"interest\": 0,\n \"fees\": 1500\n },\n \"effective_at\": \"2026-09-30T00:00:00Z\",\n \"amount_in_usd\": 1630,\n \"card_settlement_date\": \"2026-09-30\",\n \"card\": {\n \"card_id\": \"card_xyz123\",\n \"bin\": \"412345\",\n \"network\": \"visa\",\n \"original_user_credit_transaction_id\": \"user_credit_transaction_2JdQyVm8LpT4nWxZ7aBcEfGhKjR\",\n \"network_transfer_type\": \"card\",\n \"settlement\": {\n \"amount\": 1500,\n \"currency\": \"USD\"\n },\n \"authorization\": {\n \"amount\": 1500,\n \"currency\": \"USD\"\n },\n \"merchant\": {\n \"name\": \"Acme Inc.\",\n \"mcc\": \"5411\",\n \"address\": {\n \"line_1\": \"123 Main St\",\n \"city\": \"Kansas City\",\n \"state\": \"MO\",\n \"postal_code\": \"64105\",\n \"country\": \"US\"\n }\n }\n },\n \"funding_id\": \"funding_0o5Fs0EELR0fUjHjbCnEtdUwQe3\",\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.post("https://api.sandbox.lead.bank/v2/user_credit_transactions")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"user_credit_balance_id\": \"user_credit_balance_1HCpXwx2EK9oYluWbacgeCnFcLf\",\n \"type\": \"card\",\n \"description\": \"Monthly card fee\",\n \"currency\": \"USD\",\n \"amount\": 1500,\n \"amount_breakdown\": {\n \"principal\": 0,\n \"interest\": 0,\n \"fees\": 1500\n },\n \"effective_at\": \"2026-09-30T00:00:00Z\",\n \"amount_in_usd\": 1630,\n \"card_settlement_date\": \"2026-09-30\",\n \"card\": {\n \"card_id\": \"card_xyz123\",\n \"bin\": \"412345\",\n \"network\": \"visa\",\n \"original_user_credit_transaction_id\": \"user_credit_transaction_2JdQyVm8LpT4nWxZ7aBcEfGhKjR\",\n \"network_transfer_type\": \"card\",\n \"settlement\": {\n \"amount\": 1500,\n \"currency\": \"USD\"\n },\n \"authorization\": {\n \"amount\": 1500,\n \"currency\": \"USD\"\n },\n \"merchant\": {\n \"name\": \"Acme Inc.\",\n \"mcc\": \"5411\",\n \"address\": {\n \"line_1\": \"123 Main St\",\n \"city\": \"Kansas City\",\n \"state\": \"MO\",\n \"postal_code\": \"64105\",\n \"country\": \"US\"\n }\n }\n },\n \"funding_id\": \"funding_0o5Fs0EELR0fUjHjbCnEtdUwQe3\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.lead.bank/v2/user_credit_transactions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_credit_balance_id\": \"user_credit_balance_1HCpXwx2EK9oYluWbacgeCnFcLf\",\n \"type\": \"card\",\n \"description\": \"Monthly card fee\",\n \"currency\": \"USD\",\n \"amount\": 1500,\n \"amount_breakdown\": {\n \"principal\": 0,\n \"interest\": 0,\n \"fees\": 1500\n },\n \"effective_at\": \"2026-09-30T00:00:00Z\",\n \"amount_in_usd\": 1630,\n \"card_settlement_date\": \"2026-09-30\",\n \"card\": {\n \"card_id\": \"card_xyz123\",\n \"bin\": \"412345\",\n \"network\": \"visa\",\n \"original_user_credit_transaction_id\": \"user_credit_transaction_2JdQyVm8LpT4nWxZ7aBcEfGhKjR\",\n \"network_transfer_type\": \"card\",\n \"settlement\": {\n \"amount\": 1500,\n \"currency\": \"USD\"\n },\n \"authorization\": {\n \"amount\": 1500,\n \"currency\": \"USD\"\n },\n \"merchant\": {\n \"name\": \"Acme Inc.\",\n \"mcc\": \"5411\",\n \"address\": {\n \"line_1\": \"123 Main St\",\n \"city\": \"Kansas City\",\n \"state\": \"MO\",\n \"postal_code\": \"64105\",\n \"country\": \"US\"\n }\n }\n },\n \"funding_id\": \"funding_0o5Fs0EELR0fUjHjbCnEtdUwQe3\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "user_credit_transaction_2JdQyVm8LpT4nWxZ7aBcEfGhKjR",
"user_credit_balance_id": "user_credit_balance_1HCpXwx2EK9oYluWbacgeCnFcLf",
"type": "card",
"currency": "USD",
"amount": 1500,
"amount_breakdown": {
"principal": 0,
"interest": 0,
"fees": 1500
},
"effective_at": "2026-09-30T00:00:00Z",
"metadata": {},
"created_at": "2026-09-30T11:01:36Z",
"core_transaction_id": "core_transaction_xyz123",
"counterparty_core_transaction_id": "core_transaction_xyz123",
"description": "Monthly card fee",
"amount_in_usd": 1500,
"card_settlement_date": "2026-09-30",
"card": {
"card_id": "card_xyz123",
"bin": "412345",
"network": "visa",
"original_user_credit_transaction_id": "user_credit_transaction_2JdQyVm8LpT4nWxZ7aBcEfGhKjR",
"network_transfer_type": "card",
"settlement": {
"amount": 1500,
"currency": "USD"
},
"authorization": {
"amount": 1500,
"currency": "USD"
},
"merchant": {
"name": "Acme Inc.",
"mcc": "5411",
"address": {
"line_1": "123 Main St",
"city": "Kansas City",
"state": "MO",
"postal_code": "64105",
"country": "US"
}
}
},
"fee": {
"type": "card"
},
"rewards": {
"amount": 500,
"unit": "points"
},
"original_user_credit_transaction_id": "user_credit_transaction_2JdQyVm8LpT4nWxZ7aBcEfGhKjR",
"funding_id": "funding_0o5Fs0EELR0fUjHjbCnEtdUwQe3"
}{
"code": "authentication_missing",
"message": "The request has no authentication credentials. Send your API token in the Authorization header.",
"errors": [
{
"code": "authentication_missing",
"message": "The Authorization header is missing. Send your API token as a bearer token.",
"parameters": [
"Authorization"
]
}
]
}{
"code": "internal_server_error",
"message": "Internal server error. Retry with exponential backoff. For a POST, PATCH or DELETE, reuse the same Idempotency-Key so the request isn't processed twice. If it keeps failing, contact Lead with the Lead-Request-ID."
}Create a User Credit Transaction
Create a User Credit Transaction on a User Credit Balance. Send the User Credit Balance’s ID as user_credit_balance_id in the request body.
curl --request POST \
--url https://api.sandbox.lead.bank/v2/user_credit_transactions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"user_credit_balance_id": "user_credit_balance_1HCpXwx2EK9oYluWbacgeCnFcLf",
"type": "card",
"description": "Monthly card fee",
"currency": "USD",
"amount": 1500,
"amount_breakdown": {
"principal": 0,
"interest": 0,
"fees": 1500
},
"effective_at": "2026-09-30T00:00:00Z",
"amount_in_usd": 1630,
"card_settlement_date": "2026-09-30",
"card": {
"card_id": "card_xyz123",
"bin": "412345",
"network": "visa",
"original_user_credit_transaction_id": "user_credit_transaction_2JdQyVm8LpT4nWxZ7aBcEfGhKjR",
"network_transfer_type": "card",
"settlement": {
"amount": 1500,
"currency": "USD"
},
"authorization": {
"amount": 1500,
"currency": "USD"
},
"merchant": {
"name": "Acme Inc.",
"mcc": "5411",
"address": {
"line_1": "123 Main St",
"city": "Kansas City",
"state": "MO",
"postal_code": "64105",
"country": "US"
}
}
},
"funding_id": "funding_0o5Fs0EELR0fUjHjbCnEtdUwQe3",
"metadata": {}
}
'import requests
url = "https://api.sandbox.lead.bank/v2/user_credit_transactions"
payload = {
"user_credit_balance_id": "user_credit_balance_1HCpXwx2EK9oYluWbacgeCnFcLf",
"type": "card",
"description": "Monthly card fee",
"currency": "USD",
"amount": 1500,
"amount_breakdown": {
"principal": 0,
"interest": 0,
"fees": 1500
},
"effective_at": "2026-09-30T00:00:00Z",
"amount_in_usd": 1630,
"card_settlement_date": "2026-09-30",
"card": {
"card_id": "card_xyz123",
"bin": "412345",
"network": "visa",
"original_user_credit_transaction_id": "user_credit_transaction_2JdQyVm8LpT4nWxZ7aBcEfGhKjR",
"network_transfer_type": "card",
"settlement": {
"amount": 1500,
"currency": "USD"
},
"authorization": {
"amount": 1500,
"currency": "USD"
},
"merchant": {
"name": "Acme Inc.",
"mcc": "5411",
"address": {
"line_1": "123 Main St",
"city": "Kansas City",
"state": "MO",
"postal_code": "64105",
"country": "US"
}
}
},
"funding_id": "funding_0o5Fs0EELR0fUjHjbCnEtdUwQe3",
"metadata": {}
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
user_credit_balance_id: 'user_credit_balance_1HCpXwx2EK9oYluWbacgeCnFcLf',
type: 'card',
description: 'Monthly card fee',
currency: 'USD',
amount: 1500,
amount_breakdown: {principal: 0, interest: 0, fees: 1500},
effective_at: '2026-09-30T00:00:00Z',
amount_in_usd: 1630,
card_settlement_date: '2026-09-30',
card: {
card_id: 'card_xyz123',
bin: '412345',
network: 'visa',
original_user_credit_transaction_id: 'user_credit_transaction_2JdQyVm8LpT4nWxZ7aBcEfGhKjR',
network_transfer_type: 'card',
settlement: {amount: 1500, currency: 'USD'},
authorization: {amount: 1500, currency: 'USD'},
merchant: {
name: 'Acme Inc.',
mcc: '5411',
address: {
line_1: '123 Main St',
city: 'Kansas City',
state: 'MO',
postal_code: '64105',
country: 'US'
}
}
},
funding_id: 'funding_0o5Fs0EELR0fUjHjbCnEtdUwQe3',
metadata: {}
})
};
fetch('https://api.sandbox.lead.bank/v2/user_credit_transactions', 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.sandbox.lead.bank/v2/user_credit_transactions",
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([
'user_credit_balance_id' => 'user_credit_balance_1HCpXwx2EK9oYluWbacgeCnFcLf',
'type' => 'card',
'description' => 'Monthly card fee',
'currency' => 'USD',
'amount' => 1500,
'amount_breakdown' => [
'principal' => 0,
'interest' => 0,
'fees' => 1500
],
'effective_at' => '2026-09-30T00:00:00Z',
'amount_in_usd' => 1630,
'card_settlement_date' => '2026-09-30',
'card' => [
'card_id' => 'card_xyz123',
'bin' => '412345',
'network' => 'visa',
'original_user_credit_transaction_id' => 'user_credit_transaction_2JdQyVm8LpT4nWxZ7aBcEfGhKjR',
'network_transfer_type' => 'card',
'settlement' => [
'amount' => 1500,
'currency' => 'USD'
],
'authorization' => [
'amount' => 1500,
'currency' => 'USD'
],
'merchant' => [
'name' => 'Acme Inc.',
'mcc' => '5411',
'address' => [
'line_1' => '123 Main St',
'city' => 'Kansas City',
'state' => 'MO',
'postal_code' => '64105',
'country' => 'US'
]
]
],
'funding_id' => 'funding_0o5Fs0EELR0fUjHjbCnEtdUwQe3',
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-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://api.sandbox.lead.bank/v2/user_credit_transactions"
payload := strings.NewReader("{\n \"user_credit_balance_id\": \"user_credit_balance_1HCpXwx2EK9oYluWbacgeCnFcLf\",\n \"type\": \"card\",\n \"description\": \"Monthly card fee\",\n \"currency\": \"USD\",\n \"amount\": 1500,\n \"amount_breakdown\": {\n \"principal\": 0,\n \"interest\": 0,\n \"fees\": 1500\n },\n \"effective_at\": \"2026-09-30T00:00:00Z\",\n \"amount_in_usd\": 1630,\n \"card_settlement_date\": \"2026-09-30\",\n \"card\": {\n \"card_id\": \"card_xyz123\",\n \"bin\": \"412345\",\n \"network\": \"visa\",\n \"original_user_credit_transaction_id\": \"user_credit_transaction_2JdQyVm8LpT4nWxZ7aBcEfGhKjR\",\n \"network_transfer_type\": \"card\",\n \"settlement\": {\n \"amount\": 1500,\n \"currency\": \"USD\"\n },\n \"authorization\": {\n \"amount\": 1500,\n \"currency\": \"USD\"\n },\n \"merchant\": {\n \"name\": \"Acme Inc.\",\n \"mcc\": \"5411\",\n \"address\": {\n \"line_1\": \"123 Main St\",\n \"city\": \"Kansas City\",\n \"state\": \"MO\",\n \"postal_code\": \"64105\",\n \"country\": \"US\"\n }\n }\n },\n \"funding_id\": \"funding_0o5Fs0EELR0fUjHjbCnEtdUwQe3\",\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.post("https://api.sandbox.lead.bank/v2/user_credit_transactions")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"user_credit_balance_id\": \"user_credit_balance_1HCpXwx2EK9oYluWbacgeCnFcLf\",\n \"type\": \"card\",\n \"description\": \"Monthly card fee\",\n \"currency\": \"USD\",\n \"amount\": 1500,\n \"amount_breakdown\": {\n \"principal\": 0,\n \"interest\": 0,\n \"fees\": 1500\n },\n \"effective_at\": \"2026-09-30T00:00:00Z\",\n \"amount_in_usd\": 1630,\n \"card_settlement_date\": \"2026-09-30\",\n \"card\": {\n \"card_id\": \"card_xyz123\",\n \"bin\": \"412345\",\n \"network\": \"visa\",\n \"original_user_credit_transaction_id\": \"user_credit_transaction_2JdQyVm8LpT4nWxZ7aBcEfGhKjR\",\n \"network_transfer_type\": \"card\",\n \"settlement\": {\n \"amount\": 1500,\n \"currency\": \"USD\"\n },\n \"authorization\": {\n \"amount\": 1500,\n \"currency\": \"USD\"\n },\n \"merchant\": {\n \"name\": \"Acme Inc.\",\n \"mcc\": \"5411\",\n \"address\": {\n \"line_1\": \"123 Main St\",\n \"city\": \"Kansas City\",\n \"state\": \"MO\",\n \"postal_code\": \"64105\",\n \"country\": \"US\"\n }\n }\n },\n \"funding_id\": \"funding_0o5Fs0EELR0fUjHjbCnEtdUwQe3\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.lead.bank/v2/user_credit_transactions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_credit_balance_id\": \"user_credit_balance_1HCpXwx2EK9oYluWbacgeCnFcLf\",\n \"type\": \"card\",\n \"description\": \"Monthly card fee\",\n \"currency\": \"USD\",\n \"amount\": 1500,\n \"amount_breakdown\": {\n \"principal\": 0,\n \"interest\": 0,\n \"fees\": 1500\n },\n \"effective_at\": \"2026-09-30T00:00:00Z\",\n \"amount_in_usd\": 1630,\n \"card_settlement_date\": \"2026-09-30\",\n \"card\": {\n \"card_id\": \"card_xyz123\",\n \"bin\": \"412345\",\n \"network\": \"visa\",\n \"original_user_credit_transaction_id\": \"user_credit_transaction_2JdQyVm8LpT4nWxZ7aBcEfGhKjR\",\n \"network_transfer_type\": \"card\",\n \"settlement\": {\n \"amount\": 1500,\n \"currency\": \"USD\"\n },\n \"authorization\": {\n \"amount\": 1500,\n \"currency\": \"USD\"\n },\n \"merchant\": {\n \"name\": \"Acme Inc.\",\n \"mcc\": \"5411\",\n \"address\": {\n \"line_1\": \"123 Main St\",\n \"city\": \"Kansas City\",\n \"state\": \"MO\",\n \"postal_code\": \"64105\",\n \"country\": \"US\"\n }\n }\n },\n \"funding_id\": \"funding_0o5Fs0EELR0fUjHjbCnEtdUwQe3\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "user_credit_transaction_2JdQyVm8LpT4nWxZ7aBcEfGhKjR",
"user_credit_balance_id": "user_credit_balance_1HCpXwx2EK9oYluWbacgeCnFcLf",
"type": "card",
"currency": "USD",
"amount": 1500,
"amount_breakdown": {
"principal": 0,
"interest": 0,
"fees": 1500
},
"effective_at": "2026-09-30T00:00:00Z",
"metadata": {},
"created_at": "2026-09-30T11:01:36Z",
"core_transaction_id": "core_transaction_xyz123",
"counterparty_core_transaction_id": "core_transaction_xyz123",
"description": "Monthly card fee",
"amount_in_usd": 1500,
"card_settlement_date": "2026-09-30",
"card": {
"card_id": "card_xyz123",
"bin": "412345",
"network": "visa",
"original_user_credit_transaction_id": "user_credit_transaction_2JdQyVm8LpT4nWxZ7aBcEfGhKjR",
"network_transfer_type": "card",
"settlement": {
"amount": 1500,
"currency": "USD"
},
"authorization": {
"amount": 1500,
"currency": "USD"
},
"merchant": {
"name": "Acme Inc.",
"mcc": "5411",
"address": {
"line_1": "123 Main St",
"city": "Kansas City",
"state": "MO",
"postal_code": "64105",
"country": "US"
}
}
},
"fee": {
"type": "card"
},
"rewards": {
"amount": 500,
"unit": "points"
},
"original_user_credit_transaction_id": "user_credit_transaction_2JdQyVm8LpT4nWxZ7aBcEfGhKjR",
"funding_id": "funding_0o5Fs0EELR0fUjHjbCnEtdUwQe3"
}{
"code": "authentication_missing",
"message": "The request has no authentication credentials. Send your API token in the Authorization header.",
"errors": [
{
"code": "authentication_missing",
"message": "The Authorization header is missing. Send your API token as a bearer token.",
"parameters": [
"Authorization"
]
}
]
}{
"code": "internal_server_error",
"message": "Internal server error. Retry with exponential backoff. For a POST, PATCH or DELETE, reuse the same Idempotency-Key so the request isn't processed twice. If it keeps failing, contact Lead with the Lead-Request-ID."
}Authorizations
Headers
A unique key for this request, up to 255 characters. Retrying with the same key and request returns the original response instead of performing the operation again. See Idempotency. A unique key for this request, up to 255 characters. Retrying with the same key and body returns the original response instead of performing the operation again.
1 - 255"3f1c9a52-7d4e-4b8a-9c21-6e0f5d2a8b14"
Body
Request body for creating a new User Credit Transaction.
The type of the User Credit Transaction, which determines how the transaction affects the associated User Credit Balance.
card, funding, fee, fee_earned, dispute_provisional, dispute_won, dispute_lost, charge_off, charge_off_recovery, rewards_earned, rewards_spent, rewards_redeemed, interest_accrued, adjustment, reallocation, payment, cancellation, partner_credit "card"
The transaction amount, represented in minor units. Sign rules and amount_breakdown treatment depend on type:
- Non-negative (
>= 0), rule applies toamountand all ofamount_breakdown.principal/.interest/.fees:dispute_lost - Non-negative (
>= 0), rule applies toamountandamount_breakdown.interestonly;amount_breakdown.principaland.feesare forced to0:funding,interest_accrued - Non-negative (
>= 0);amount_breakdown.principaland.interestare forced to0:fee - Strictly positive (
> 0);amount_breakdown.principaland.interestare forced to0:fee_earned - Non-positive (
<= 0), rule applies toamountand all ofamount_breakdown.principal/.interest/.fees:payment,dispute_provisional,charge_off,rewards_redeemed,cancellation,partner_credit,dispute_won,charge_off_recovery - Exactly
0, and all ofamount_breakdown.principal/.interest/.feesforced to0:rewards_earned,rewards_spent(the signed rewards value instead lives inrewards.amount) - Exactly
0at the top level only;amount_breakdowncomponents may be nonzero as long as they sum to0:reallocation - Unconstrained:
card,adjustment
1500
Response
The created User Credit Transaction object.
The type of the User Credit Transaction, which determines how the transaction affects the associated User Credit Balance.
card, funding, fee, fee_earned, dispute_provisional, dispute_won, dispute_lost, charge_off, charge_off_recovery, rewards_earned, rewards_spent, rewards_redeemed, interest_accrued, adjustment, reallocation, payment, cancellation, partner_credit "card"
The core transaction on the counterparty side of this transaction's posting. Present once the transaction posts, and only when the counterparty is an account under your program; omitted otherwise.
^core_transaction_.+~\d+$"core_transaction_xyz123"
Was this page helpful?

