API Reference
Lightweight quick-reference for mypos-api-gateway. For full examples see Sample Code.
GatewayConfig
Passed to new MyPOSGateway(config):
| Option | Type | Description |
|---|---|---|
gatewayUrl | string | Base URL for the gateway (use DEMO_GATEWAY_URL or PRODUCTION_GATEWAY_URL) |
integration.clientId | string | OAuth client ID from Partner Portal |
integration.clientSecret | string | OAuth client secret from Partner Portal |
partnerId | string | Your partner identifier |
applicationId | string | Your application identifier |
timeout | number | Request timeout in milliseconds (optional) |
MerchantCredentials
Passed to gateway.createClient(credentials):
| Option | Type | Description |
|---|---|---|
clientId | string | Merchant client ID (prefixed cli_) |
clientSecret | string | Merchant client secret (prefixed sec_) |
Exported Constants
| Constant | Value | Description |
|---|---|---|
DEMO_GATEWAY_URL | Gateway demo base URL | Use in development and testing |
PRODUCTION_GATEWAY_URL | Gateway production base URL | Use in live environments |
Banking Methods (client.banking.*)
| Method | Parameters | Returns | Description |
|---|---|---|---|
getAccounts(opts) | { page, size } | Promise<Result<Paginated<Account>>> | List merchant accounts |
getTransactions(opts) | { fromDate, toDate, sign?, order?, page, size } | Promise<Result<Paginated<Transaction>>> | Filter transactions by date range |
getTransaction(ref) | string | Promise<Result<Transaction>> | Get single transaction by reference |
getMultipleTransactions(refs) | string[] | Promise<Result<Transaction[]>> | Batch retrieve transactions |
generateStatement(opts) | { accountNumber, documentType, date } | Promise<Result<Statement>> | Generate account statement |
Ecommerce Methods (client.ecommerce.*)
Payment Links (client.ecommerce.paymentLinks.*)
| Method | Parameters | Returns | Description |
|---|---|---|---|
create(opts) | CreatePaymentLinkOptions | Promise<Result<PaymentLink>> | Create a payment link |
list(opts) | { page, size } | Promise<Result<Paginated<PaymentLink>>> | List payment links |
listAll() | — | AsyncGenerator<PaymentLink> | Auto-paginate all payment links |
get(id) | string | Promise<Result<PaymentLink>> | Get a payment link |
update(id, opts) | string, UpdatePaymentLinkOptions | Promise<Result<PaymentLink>> | Update a payment link |
delete(id) | string | Promise<Result<void>> | Delete a payment link |
getTransactions(id) | string | Promise<Result<Transaction[]>> | Get transactions for a link |
Payment Buttons (client.ecommerce.paymentButtons.*)
| Method | Parameters | Returns | Description |
|---|---|---|---|
create(opts) | CreatePaymentButtonOptions | Promise<Result<PaymentButton>> | Create a payment button |
list(opts) | { page, size } | Promise<Result<Paginated<PaymentButton>>> | List payment buttons |
get(id) | string | Promise<Result<PaymentButton>> | Get a payment button |
Payment Requests (client.ecommerce.paymentRequests.*)
| Method | Parameters | Returns | Description |
|---|---|---|---|
create(opts) | CreatePaymentRequestOptions | Promise<Result<PaymentRequest>> | Create a payment request |
list(opts) | { status?, page, size } | Promise<Result<Paginated<PaymentRequest>>> | List payment requests |
get(id) | string | Promise<Result<PaymentRequest>> | Get a payment request |
sendReminder(id) | string | Promise<Result<void>> | Send reminder for a request |
Utilities (client.ecommerce.*)
| Method | Returns | Description |
|---|---|---|
getLanguages() | Promise<Result<Language[]>> | List supported languages |
getSettlementData() | Promise<Result<SettlementData>> | Get settlement information |
ePOS Methods (client.epos.*)
Payments (client.epos.payments.*)
| Method | Parameters | Returns | Description |
|---|---|---|---|
create(opts) | CreateEposPaymentOptions | Promise<Result<EposPayment>> | Create an ePOS payment |
get(id) | string | Promise<Result<EposPayment>> | Get a payment |
list(opts) | { terminalId, page, size } | Promise<Result<Paginated<EposPayment>>> | List payments by terminal |
cancel(id) | string | Promise<Result<void>> | Cancel a payment |
reverse(id, opts) | string, { description } | Promise<Result<void>> | Reverse a payment |
refund(id, opts) | string, { amount: AmountValue } | Promise<Result<void>> | Partially refund a payment |
Terminals (client.epos.terminals.*)
| Method | Parameters | Returns | Description |
|---|---|---|---|
list(opts) | { page, size } | Promise<Result<Paginated<Terminal>>> | List terminals |
get(id) | string | Promise<Result<Terminal>> | Get a terminal |
getTransactions(opts) | { terminalId, fromDate, toDate } | Promise<Result<Transaction[]>> | All transaction types for a terminal |
getTerminalTransactions(opts) | { terminalId, fromDate, toDate, page, size } | Promise<Result<Paginated<Transaction>>> | Per-terminal transactions with pagination |
getModels() | — | Promise<Result<TerminalModel[]>> | List available terminal models |
getOutlets() | — | Promise<Result<Outlet[]>> | List outlets |
activate(id, opts) | string, { activationCode } | Promise<Result<void>> | Activate a terminal |
deactivate(id, opts) | string, { activationCode } | Promise<Result<void>> | Deactivate a terminal |
getReceipt(paymentId) | string | Promise<Result<Receipt>> | Get payment receipt |
refund(id, opts) | string, TerminalRefundOptions | Promise<Result<void>> | Terminal-level refund |
Error Types
| Error type | Thrown | Condition |
|---|---|---|
GatewayConfigError | Yes (thrown) | Missing or invalid GatewayConfig |
GatewayAuthError | Yes (thrown) | Authentication failed; auto-retry exhausted |
All other API failures are returned as result.success === false — they do not throw.
AmountValue
All amount fields use minor currency units:
| Field | Type | Example |
|---|---|---|
value | number | 2500 (= €25.00) |
currencyCode | string | 'EUR' |