create-bank-account
Method: POST
Path: /customers/{customer_id}/bank-accounts
Tags: Customers
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"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["schemas"]["CreateBankAccount"] | CreateBankAccount |
components["schemas"]["CustomerBankAccount"] | CustomerBankAccount |
components["responses"]["BadRequest"] | BadRequest |
components["responses"]["Unauthorized"] | Unauthorized |
Request Body
Content Types: application/json
Responses
200
OK
400
Bad request
401
Not authorized for given operation on the Resource
OpenAPI Definition
json
{
"tags": [
"Customers"
],
"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",
"properties": {
"message": {
"type": "string"
},
"success": {
"type": "boolean"
},
"content": {
"properties": {
"bank_account": {
"$ref": "#/components/schemas/CustomerBankAccount"
}
},
"type": "object"
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
}
},
"security": [
{
"Authorization": []
}
],
"x-speakeasy-group": "customers",
"x-speakeasy-ignore": false,
"x-speakeasy-name-override": "createBankAccount"
}Auto-generated from OpenAPI spec and TypeScript definitions