Skip to content

get-customer-credit-line-balance

Method: GET
Path: /customers/{customer_id}/credit-line-balance

Tags: Customers

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:

typescript
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

typescript
"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"][];
                        };
                    };
                };
            };
            400: components["responses"]["BadRequest"];
            401: components["responses"]["Unauthorized"];
            404: components["responses"]["NotFound"];
        };
    };

Component References

ReferenceResolves To
components["schemas"]["CustomerCreditLineBalance"]CustomerCreditLineBalance
components["schemas"]["CustomerMandate"]CustomerMandate
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": [
    "Customers"
  ],
  "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": {
                      "$ref": "#/components/schemas/CustomerMandate"
                    }
                  }
                },
                "required": [
                  "is_eligible",
                  "credit_line_balance",
                  "active_mandates"
                ],
                "type": "object"
              }
            }
          }
        }
      }
    },
    "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": "getCustomerCreditLineBalance"
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: