getAccountById
Get a payment account by its id.
Description
Fetches a payment account by its id. Resolves to an IAccountsEntity.
.getAccountById(
);
Parameters schema
Schema
id(required): number
Payment account ID.
example: 12345
Examples
Minimal example
const response = await Payments.getAccountById(1);
Account settings for Stripe
The settings field of the returned account depends on the account type. For a Stripe account it can look like this:
const account = await Payments.getAccountById(3);
if ('statusCode' in account) throw new Error(account.message);
console.log(account.settings);
// {
// "status": "connected",
// "stripeAccountId": "acct_...",
// "stripeOnboardingComplete": true,
// "stripePublishableKey": "pk_test_51OO...Y7MS3",
// "successUrl": "https://example.com/success",
// "cancelUrl": "https://example.com/cancel",
// "sessionTimeout": 15
// }
Account settings for YooKassa
const account = await Payments.getAccountById(4); // a YooKassa account
if ('statusCode' in account) throw new Error(account.message);
console.log(account.settings);
// {
// "status": "connected",
// "shopId": "1234567",
// "successUrl": "https://example.com/success",
// "cancelUrl": "https://example.com/cancel",
// "sessionTimeout": 15
// }
These provider fields aren't part of the IPaymentAccountSettings type, which declares only status. Provider credentials are server-side secrets: don't rely on or expose any key fields in this response, because they may be removed.
Example response
{
"id": 1,
"identifier": "cash",
"isVisible": true,
"localizeInfos": {
"title": "Cash"
},
"type": "custom",
"isUsed": true,
"testMode": true,
"settings": {
"status": "connected"
},
"testSettings": {
"status": "connected"
},
"updatedDate": "2025-02-25T08:55:43.957Z"
}
Response schema
Schema: IAccountsEntity
id: number
Object ID.
example: 12345
localizeInfos: ILocalizeInfo
Localized name and description of the payment account.
identifier: string
Marker of the payment account.
example: "payment_12345"
type: 'stripe' | 'yookassa' | 'midtrans' | 'xendit' | 'custom'
Payment provider type.
example: 'stripe'
isVisible: boolean
Whether the payment account is visible.
example: true
isUsed: boolean
Whether the payment account is in use.
example: false
testMode: boolean
Whether the payment account is in test mode.
example: true
settings: IPaymentAccountSettings
Payment account settings.
example:
{ "status": "connected" }
settings.status: string
Connection status of the live (non-test) payment account.
example: "connected"
testSettings: object
Test mode settings for the payment account.
updatedDate: string
Date the object was last modified.
example: "2025-02-26T10:13:16.839Z"