get-customer-credit-line-balance
Method: GET
Path: /customers/{customer_id}/credit-line-balance
Tags: Credit
Summary
Get credit line balance
Description
Retrieves the customer's credit-line eligibility, their latest CustomerCreditLineBalance, and all currently active CustomerMandate records usable for credit-line debits.
Storefront SDK Usage
SDK Method: sdk.customer.getCreditLineBalance()
Example:
const { data, error } = await sdk.customer.getCreditLineBalance();
if (error) {
console.error("Failed to get credit line balance:", error);
return;
}
console.log("Eligible:", data.is_eligible);
console.log("Balance:", data.credit_line_balance?.balance_amount);
console.log("Active mandates:", data.active_mandates);TypeScript Definition
"get-customer-credit-line-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: {
/** @description Whether the customer is currently approved to use the credit line. `false` blocks new mandate creation and credit-line checkouts. */
is_eligible: boolean;
/** @description The customer's latest credit-line balance. `null` when no balance has been provisioned yet. */
credit_line_balance: components["schemas"]["CustomerCreditLineBalance"] | null;
/** @description Customer mandates currently usable for credit-line debits. Only mandates whose `status` is `active` are returned. */
active_mandates: (components["schemas"]["CustomerMandate"] & {
external_reference_id: string | null;
})[];
};
};
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
404: components["responses"]["NotFound"];
500: components["responses"]["InternalServerError"];
504: components["responses"]["GatewayTimeout"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["schemas"]["CustomerCreditLineBalance"] | CustomerCreditLineBalance |
components["schemas"]["CustomerMandate"] | CustomerMandate |
components["responses"]["BadRequest"] | BadRequest |
components["responses"]["Unauthorized"] | Unauthorized |
components["responses"]["Forbidden"] | Forbidden |
components["responses"]["NotFound"] | NotFound |
components["responses"]["InternalServerError"] | InternalServerError |
components["responses"]["GatewayTimeout"] | GatewayTimeout |
Responses
200
OK
400
Bad request
401
Authentication failed. Codes include token-required, token-expired and token_not_valid for an invalid or expired token.
403
Access denied. token-required requires an authenticated session; permission-denied means the caller cannot access this resource. On POS, session-expired requires signing in again.
404
Requested resource not found
500
The request failed because of an unexpected error.
504
The request timed out.
OpenAPI Definition
{
"tags": [
"Credit"
],
"operationId": "get-customer-credit-line-balance",
"summary": "Get credit line balance",
"description": "Retrieves the customer's credit-line eligibility, their latest `CustomerCreditLineBalance`, and all currently `active` `CustomerMandate` records usable for credit-line debits.",
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/operations/get-customer-credit-line-balance",
"description": "API reference for the get-customer-credit-line-balance operation"
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message",
"success",
"content"
],
"properties": {
"message": {
"type": "string"
},
"success": {
"type": "boolean"
},
"content": {
"properties": {
"is_eligible": {
"description": "Whether the customer is currently approved to use the credit line. `false` blocks new mandate creation and credit-line checkouts.",
"type": "boolean"
},
"credit_line_balance": {
"description": "The customer's latest credit-line balance. `null` when no balance has been provisioned yet.",
"oneOf": [
{
"$ref": "#/components/schemas/CustomerCreditLineBalance"
},
{
"type": "null"
}
]
},
"active_mandates": {
"description": "Customer mandates currently usable for credit-line debits. Only mandates whose `status` is `active` are returned.",
"type": "array",
"items": {
"allOf": [
{
"$ref": "#/components/schemas/CustomerMandate"
},
{
"type": "object",
"properties": {
"external_reference_id": {
"type": [
"string",
"null"
]
}
},
"required": [
"external_reference_id"
]
}
]
}
}
},
"required": [
"is_eligible",
"credit_line_balance",
"active_mandates"
],
"type": "object"
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"500": {
"$ref": "#/components/responses/InternalServerError"
},
"504": {
"$ref": "#/components/responses/GatewayTimeout"
}
},
"security": [
{
"Authorization": []
}
],
"x-speakeasy-group": "customers",
"x-speakeasy-ignore": false,
"x-speakeasy-name-override": "getCustomerCreditLineBalance"
}Auto-generated from OpenAPI spec and TypeScript definitions