create-bank-account
Method: POST
Path: /customers/{customer_id}/bank-accounts
Tags: Bank accounts
Summary
Create a bank account
Description
Add a new bank account for a customer. Returns the created CustomerBankAccount object.
Storefront SDK Usage
SDK Method: sdk.customer.createBankAccount()
Example:
typescript
// Outbound account (for receiving refunds/payouts)
const { data, error } = await sdk.customer.createBankAccount({
account_type: "outbound",
account_name: "Jane Doe",
account_number: "123456789012",
ifsc_code: "HDFC0001234",
bank_name: "HDFC Bank",
is_default: true
});
// Inbound account (for collecting payments via a provider)
const { data: inbound } = await sdk.customer.createBankAccount({
account_type: "inbound",
service_provider_slug: "razorpay",
is_default: false
});
if (error) {
console.error("Failed to create bank account:", error);
return;
}
console.log("Bank account created:", data.bank_account);TypeScript Definition
typescript
"create-bank-account": {
parameters: {
query?: never;
header?: never;
path: {
/** @description Customer id */
customer_id: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["CreateBankAccount"];
};
};
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"]["CreateBankAccount"] | CreateBankAccount |
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
json
{
"tags": [
"Bank accounts"
],
"operationId": "create-bank-account",
"summary": "Create a bank account",
"description": "Add a new bank account for a customer. Returns the created `CustomerBankAccount` object.",
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/operations/create-bank-account",
"description": "API reference for the create-bank-account operation"
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateBankAccount"
}
}
}
},
"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": "createBankAccount"
}Auto-generated from OpenAPI spec and TypeScript definitions