Skip to content

AmeriaClient

Defined in: src/client.ts:105

Client for the Ameriabank vPOS REST API.

import { AmeriaClient } from "@ameria/vpos-sdk";
const ameria = new AmeriaClient({
clientId: process.env.AMERIA_CLIENT_ID!,
username: process.env.AMERIA_USERNAME!,
password: process.env.AMERIA_PASSWORD!,
isTest: true,
});

new AmeriaClient(params): AmeriaClient

Defined in: src/client.ts:116

AmeriaClientParams

AmeriaClient

readonly host: string

Defined in: src/client.ts:114

Base URL of the bank API this client talks to.

get clientId(): string

Defined in: src/client.ts:131

The client ID this client was created with.

string

getUrl(paymentId, lang?): string

Defined in: src/client.ts:168

Build the bank’s payment page URL for a payment ID. AmeriaClient.initPayment already returns it as url.

string

"en" | "am" | "hy" | "ru"

string


initPayment(params): Promise<InitPaymentResponse & object>

Defined in: src/client.ts:186

Register a payment and get the URL of the bank’s card page.

Redirect the payer to url. After paying they come back to backUrl; that redirect is not signed, so confirm the result with AmeriaClient.verifyPayment before fulfilling the order.

InitPaymentParams

Promise<InitPaymentResponse & object>

The bank’s response plus url, which is null unless ResponseCode is 1.


getPaymentId(orderId): Promise<GetPaymentIdResponse>

Defined in: src/client.ts:209

Look up the bank’s payment ID for one of your order IDs.

string | number

Promise<GetPaymentIdResponse>


confirmPayment(paymentId, amount): Promise<ConfirmPaymentResponse>

Defined in: src/client.ts:218

Deposit a payment that was only approved (two-step payments).

string

number

Amount to deposit; up to the approved amount.

Promise<ConfirmPaymentResponse>


getPaymentDetails(paymentId): Promise<PaymentDetailsResponse>

Defined in: src/client.ts:231

Get the raw status and details of a payment. To decide whether to fulfil an order, prefer AmeriaClient.verifyPayment.

string

Promise<PaymentDetailsResponse>


verifyPayment(paymentId, expected): Promise<PaymentVerification>

Defined in: src/client.ts:255

Ask the bank whether a payment really succeeded for the amount you expect. Use it when the payer comes back to your backUrl: that redirect is not signed and can be forged.

paid is true only if the bank approved the payment, the amount, currency and order ID match what you expect, the money was deposited (or, with twoStep, approved) and nothing was refunded.

string

VerifyPaymentExpected

Promise<PaymentVerification>

const { paid, reason } = await ameria.verifyPayment(paymentId, {
amount: order.total,
currency: "AMD",
orderId: order.id,
});
if (paid) await fulfil(order);

getPendingTransactions(params): Promise<GetPendingTransactionsResponse>

Defined in: src/client.ts:289

List transactions that were started but not completed in a date range.

GetPendingTransactionsParams

Promise<GetPendingTransactionsResponse>


refundPayment(paymentId, amount): Promise<RefundPaymentResponse>

Defined in: src/client.ts:303

Refund a completed payment, fully or partly.

string

number

Amount to refund; up to the deposited amount.

Promise<RefundPaymentResponse>


cancelPayment(paymentId): Promise<CancelPaymentResponse>

Defined in: src/client.ts:316

Cancel (reverse) a payment. For two-step payments this releases an approved amount that was never confirmed.

string

Promise<CancelPaymentResponse>


getBindings(paymentType): Promise<GetBindingsResponse>

Defined in: src/client.ts:322

List the saved cards (bindings) of your merchant account.

PaymentType

Promise<GetBindingsResponse>


activateBinding(cardHolderId, paymentType): Promise<ActivateBindingResponse>

Defined in: src/client.ts:328

Re-enable a saved card that was deactivated.

string

PaymentType

Promise<ActivateBindingResponse>


deactivateBinding(cardHolderId, paymentType): Promise<DeactivateBindingResponse>

Defined in: src/client.ts:340

Disable a saved card so it can no longer be charged.

string

PaymentType

Promise<DeactivateBindingResponse>


makeBindingPayment(params): Promise<MakeBindingPaymentResponse>

Defined in: src/client.ts:357

Charge a saved card without the payer entering card details.

If the response has AcsUrl set, the card issuer requires 3-D Secure and the payment is not complete until the payer passes it.

MakeBindingPaymentParams

Promise<MakeBindingPaymentResponse>


ssnCheck(paymentId, ssn, identifierType): Promise<SsnCheckResponse>

Defined in: src/client.ts:378

Submit the payer’s national identifier for a payment (SSNCheck). The identifier is personal data: do not log it.

string

string

SsnIdentifierType

Promise<SsnCheckResponse>