get-customer-credit-balance
Method: GET
Path: /customers/{customer_id}/credit-balance
Tags: Credit
Summary
Retrieve customer credit balance
Description
Retrieves the customer's bank-transfer credit balance. Returns a CustomerCreditBalance with received_amount, settled_amount, and spendable balance_amount. Use this before applying credit at checkout.
Storefront SDK Usage
SDK Method: sdk.customer.getCreditBalance()
Example:
typescript
const { data, error } = await sdk.customer.getCreditBalance();
// With explicit customer_id
const { data: explicit } = await sdk.customer.getCreditBalance({
customer_id: "customer_123"
});
if (error) {
console.error("Failed to get credit balance:", error);
return;
}
console.log("Received:", data.received_amount);
console.log("Settled:", data.settled_amount);
console.log("Spendable balance:", data.balance_amount);TypeScript Definition
typescript
"get-customer-credit-balance": {
parameters: {
query?: never;
header?: never;
path: {
/** @description Customer Id */
customer_id: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
message: string;
success: boolean;
content: components["schemas"]["CustomerCreditBalance"];
};
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
404: components["responses"]["NotFound"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["schemas"]["CustomerCreditBalance"] | CustomerCreditBalance |
components["responses"]["BadRequest"] | BadRequest |
components["responses"]["Unauthorized"] | Unauthorized |
components["responses"]["NotFound"] | NotFound |
Responses
200
OK
400
Bad request
401
Not authorized for given operation on the Resource
404
Requested resource not found
OpenAPI Definition
json
{
"tags": [
"Credit"
],
"operationId": "get-customer-credit-balance",
"summary": "Retrieve customer credit balance",
"description": "Retrieves the customer's bank-transfer credit balance. Returns a `CustomerCreditBalance` with `received_amount`, `settled_amount`, and spendable `balance_amount`. Use this before applying credit at checkout.",
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/operations/get-customer-credit-balance",
"description": "API reference for the get-customer-credit-balance operation"
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message",
"success",
"content"
],
"properties": {
"message": {
"type": "string"
},
"success": {
"type": "boolean"
},
"content": {
"$ref": "#/components/schemas/CustomerCreditBalance"
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"404": {
"$ref": "#/components/responses/NotFound"
}
},
"security": [
{
"Authorization": []
}
],
"x-speakeasy-group": "customers",
"x-speakeasy-ignore": false,
"x-speakeasy-name-override": "getCustomerCreditBalance"
}Auto-generated from OpenAPI spec and TypeScript definitions