Saltar al contenido principal
GET
/
credit-entitlements
/
{credit_entitlement_id}
/
balances
/
{customer_id}
JavaScript
import DodoPayments from 'dodopayments';

const client = new DodoPayments({
  bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted
});

const customerCreditBalance = await client.creditEntitlements.balances.retrieve(
  'cus_TV52uJWWXt2yIoBBxpjaa',
  { credit_entitlement_id: 'cde_ztxm5XJsKxWucRWA3rjdM' },
);

console.log(customerCreditBalance.id);
import os
from dodopayments import DodoPayments

client = DodoPayments(
bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"), # This is the default and can be omitted
)
customer_credit_balance = client.credit_entitlements.balances.retrieve(
customer_id="cus_TV52uJWWXt2yIoBBxpjaa",
credit_entitlement_id="cde_ztxm5XJsKxWucRWA3rjdM",
)
print(customer_credit_balance.id)
package main

import (
"context"
"fmt"

"github.com/dodopayments/dodopayments-go"
"github.com/dodopayments/dodopayments-go/option"
)

func main() {
client := dodopayments.NewClient(
option.WithBearerToken("My Bearer Token"),
)
customerCreditBalance, err := client.CreditEntitlements.Balances.Get(
context.TODO(),
"cde_ztxm5XJsKxWucRWA3rjdM",
"cus_TV52uJWWXt2yIoBBxpjaa",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", customerCreditBalance.ID)
}
package com.dodopayments.api.example;

import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.creditentitlements.balances.BalanceRetrieveParams;
import com.dodopayments.api.models.creditentitlements.balances.CustomerCreditBalance;

public final class Main {
private Main() {}

public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();

BalanceRetrieveParams params = BalanceRetrieveParams.builder()
.creditEntitlementId("cde_ztxm5XJsKxWucRWA3rjdM")
.customerId("cus_TV52uJWWXt2yIoBBxpjaa")
.build();
CustomerCreditBalance customerCreditBalance = client.creditEntitlements().balances().retrieve(params);
}
}
package com.dodopayments.api.example

import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.creditentitlements.balances.BalanceRetrieveParams
import com.dodopayments.api.models.creditentitlements.balances.CustomerCreditBalance

fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()

val params: BalanceRetrieveParams = BalanceRetrieveParams.builder()
.creditEntitlementId("cde_ztxm5XJsKxWucRWA3rjdM")
.customerId("cus_TV52uJWWXt2yIoBBxpjaa")
.build()
val customerCreditBalance: CustomerCreditBalance = client.creditEntitlements().balances().retrieve(params)
}
require "dodopayments"

dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)

customer_credit_balance = dodo_payments.credit_entitlements.balances.retrieve(
"cus_TV52uJWWXt2yIoBBxpjaa",
credit_entitlement_id: "cde_ztxm5XJsKxWucRWA3rjdM"
)

puts(customer_credit_balance)
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Dodopayments\Client;
use Dodopayments\Core\Exceptions\APIException;

$client = new Client(
bearerToken: getenv('DODO_PAYMENTS_API_KEY') ?: 'My Bearer Token',
environment: 'test_mode',
);

try {
$customerCreditBalance = $client->creditEntitlements->balances->retrieve(
'cus_TV52uJWWXt2yIoBBxpjaa',
creditEntitlementID: 'cde_ztxm5XJsKxWucRWA3rjdM',
);

var_dump($customerCreditBalance);
} catch (APIException $e) {
echo $e->getMessage();
}
using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.CreditEntitlements.Balances;

DodoPaymentsClient client = new();

BalanceRetrieveParams parameters = new()
{
CreditEntitlementID = "cde_ztxm5XJsKxWucRWA3rjdM",
CustomerID = "cus_TV52uJWWXt2yIoBBxpjaa",
};

var customerCreditBalance = await client.CreditEntitlements.Balances.Retrieve(parameters);

Console.WriteLine(customerCreditBalance);
use dodopayments::Client;

#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let credit_entitlement_id = "credit_entitlement_id";
let customer_id = "customer_id";
let result = client
.credit_entitlements()
.balances()
.retrieve()
.credit_entitlement_id(credit_entitlement_id)
.customer_id(customer_id)
.await?;
println!("{result:?}");
Ok(())
}
curl --request GET \
--url https://test.dodopayments.com/credit-entitlements/{credit_entitlement_id}/balances/{customer_id} \
--header 'Authorization: Bearer <token>'
{
  "balance": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "credit_entitlement_id": "<string>",
  "customer_id": "<string>",
  "id": "<string>",
  "overage": "<string>",
  "updated_at": "2023-11-07T05:31:56Z",
  "last_transaction_at": "2023-11-07T05:31:56Z"
}

Autorizaciones

Authorization
string
header
requerido

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Parámetros de ruta

credit_entitlement_id
string
requerido

Credit Entitlement ID

customer_id
string
requerido

Customer ID

Respuesta

Customer balance details

Response for a customer's credit balance

balance
string
requerido
created_at
string<date-time>
requerido
credit_entitlement_id
string
requerido
customer_id
string
requerido
id
string
requerido
overage
string
requerido
updated_at
string<date-time>
requerido
last_transaction_at
string<date-time> | null
Última modificación el 1 de abril de 2026