Get Customer Credit Balance

Get a specific customer's balance for a credit entitlement.

Request

use dodopayments_rust::{to_pretty_json, DodoPaymentsClientBuilder};


#[tokio::main]

async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let api_key = std::env::var("DODO_API_KEY")?;

    let client = DodoPaymentsClientBuilder::new()
        .bearer_token(&api_key)
        .enviroment("test_mode")
        .build()?;

    let entitlement_id = "ent_xxxxxxxxxx";
    let customer_id = "cus_xxxxxxxxxx";

    let resp = client
        .credit_entitlements()
        .id(entitlement_id)
        .customer_id(customer_id)
        .retrieve_customer_balance()
        .send()
        .await?;

    println!("{}", to_pretty_json(&resp)?);

    Ok(())
}

Path Parameters

ParameterTypeDescription
credit_entitlement_idstringCredit Entitlement ID
customer_idstringCustomer ID

Responses

200 Status

FieldTypeDescription
balancestring
created_atstring
credit_entitlement_idstring
customer_idstring
idstring
last_transaction_atobject
overagestring
updated_atstring

Customer balance details

404 Status

Credit entitlement or balance not found

500 Status

Something went wrong :(