update-bank-account
Method: PUT
Path: /customers/{customer_id}/bank-accounts/{account_id}
Tags: Bank accounts
Summary
Update a bank account
Description
Updates a bank account and returns the updated CustomerBankAccount. Only is_default can change. Outbound accounts reject account-detail fields, whether verified or not; inbound accounts ignore them. Making an unverified account default or unsetting the current default returns 400. Requires a signed-in customer session.
Storefront SDK Usage
SDK Method: sdk.customer.updateBankAccount()
Example:
// Make an account the default
const { data, error } = await sdk.customer.updateBankAccount(
{ account_id: "acct_789" },
{
is_default: true
}
);
// Update an inbound account (only is_default can be changed)
const { data: inbound } = await sdk.customer.updateBankAccount(
{ account_id: "acct_inbound_001" },
{ account_type: "inbound", is_default: true }
);
if (error) {
console.error("Failed to update bank account:", error);
return;
}
console.log("Bank account updated:", data.bank_account);TypeScript Definition
"update-bank-account": {
parameters: {
query?: never;
header?: never;
path: {
/** @description Bank account id */
account_id: string;
/** @description Customer id */
customer_id: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["UpdateBankAccount"];
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
message: string;
success: boolean;
content: {
bank_account: components["schemas"]["CustomerBankAccount"];
};
};
};
};
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"]["UpdateBankAccount"] | UpdateBankAccount |
components["schemas"]["CustomerBankAccount"] | CustomerBankAccount |
components["responses"]["BadRequest"] | BadRequest |
components["responses"]["Unauthorized"] | Unauthorized |
components["responses"]["Forbidden"] | Forbidden |
components["responses"]["NotFound"] | NotFound |
components["responses"]["InternalServerError"] | InternalServerError |
components["responses"]["GatewayTimeout"] | GatewayTimeout |
Request Body
Content Types: application/json
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": [
"Bank accounts"
],
"operationId": "update-bank-account",
"summary": "Update a bank account",
"description": "Updates a bank account and returns the updated `CustomerBankAccount`. Only `is_default` can change. Outbound accounts reject account-detail fields, whether verified or not; inbound accounts ignore them. Making an unverified account default or unsetting the current default returns 400. Requires a signed-in customer session.",
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/operations/update-bank-account",
"description": "API reference for the update-bank-account operation"
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateBankAccount"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message",
"success",
"content"
],
"properties": {
"message": {
"type": "string"
},
"success": {
"type": "boolean"
},
"content": {
"properties": {
"bank_account": {
"$ref": "#/components/schemas/CustomerBankAccount"
}
},
"required": [
"bank_account"
],
"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": "updateBankAccount"
}Auto-generated from OpenAPI spec and TypeScript definitions