UNPKG

@monei-js/node-sdk

Version:

Node.js SDK for MONEI Digital Payment Gateway

413 lines (412 loc) 48 kB
/** * MONEI API v1 * The MONEI API is organized around REST principles. Our API is designed to be intuitive and developer-friendly. ### Base URL All API requests should be made to: ``` https://api.monei.com/v1 ``` ### Environment MONEI provides two environments: - **Test Environment**: For development and testing without processing real payments - **Live Environment**: For processing real transactions in production ### Client Libraries We provide official SDKs to simplify integration: - [PHP SDK](https://github.com/MONEI/monei-php-sdk) - [Python SDK](https://github.com/MONEI/monei-python-sdk) - [Node.js SDK](https://github.com/MONEI/monei-node-sdk) - [Postman Collection](https://postman.monei.com/) Our SDKs handle authentication, error handling, and request formatting automatically. You can download the OpenAPI specification from the https://js.monei.com/api/v1/openapi.json and generate your own client library using the [OpenAPI Generator](https://openapi-generator.tech/). ### Important Requirements - All API requests must be made over HTTPS - If you are not using our official SDKs, you **must provide a valid `User-Agent` header** with each request - Requests without proper authentication will return a `401 Unauthorized` error ### Error Handling The API returns consistent error codes and messages to help you troubleshoot issues. Each response includes a `statusCode` attribute indicating the outcome of your request. ### Rate Limits The API implements rate limiting to ensure stability. If you exceed the limits, requests will return a `429 Too Many Requests` status code. * * The version of the OpenAPI document: 1.8.3 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import type { Configuration } from '../configuration'; import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from '../axios'; import { type RequestArgs, BaseAPI } from '../base'; import type { CancelPaymentRequest } from '../model'; import type { CapturePaymentRequest } from '../model'; import type { ConfirmPaymentRequest } from '../model'; import type { CreatePaymentRequest } from '../model'; import type { Payment } from '../model'; import type { RecurringPaymentRequest } from '../model'; import type { RefundPaymentRequest } from '../model'; import type { SendPaymentLinkRequest } from '../model'; import type { SendPaymentReceiptRequest } from '../model'; import type { SendPaymentRequestRequest } from '../model'; /** * PaymentsApi - axios parameter creator * @export */ export declare const PaymentsApiAxiosParamCreator: (configuration?: Configuration) => { /** * Releases reserved funds from a previously authorized payment. This endpoint can only be used with payments in `AUTHORIZED` status. This operation is part of the two-step authorization flow: 1. **Authorize**: Create a payment with `transactionType: AUTH` to reserve funds 2. **Cancel**: Release the reserved funds if you decide not to capture the payment Cancellation makes the reserved funds available to the customer again and prevents you from being able to capture those funds in the future. Once cancelled, an authorization cannot be reactivated. * @summary Cancel Payment * @param {string} id The payment ID * @param {CancelPaymentRequest} [cancelPaymentRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ cancel: (id: string, cancelPaymentRequest?: CancelPaymentRequest, options?: RawAxiosRequestConfig) => Promise<RequestArgs>; /** * Captures funds from a previously authorized payment. This endpoint can only be used with payments in `AUTHORIZED` status. This operation completes the two-step authorization flow: 1. **Authorize**: Create a payment with `transactionType: AUTH` to reserve funds 2. **Capture**: Transfer the reserved funds to your account when ready to fulfill the order **Important**: Authorized payments expire after exactly seven days. After expiration, they will be marked as `EXPIRED` and can no longer be captured. Be sure to capture funds within this timeframe or communicate with your customer about a new payment. * @summary Capture Payment * @param {string} id The payment ID * @param {CapturePaymentRequest} [capturePaymentRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ capture: (id: string, capturePaymentRequest?: CapturePaymentRequest, options?: RawAxiosRequestConfig) => Promise<RequestArgs>; /** * Confirms a payment that was created without payment details. This endpoint can only be used with payments in `PENDING` status. The two-step payment flow: 1. **Create**: First, create a payment without payment details (status: `PENDING`) 2. **Confirm**: Then provide payment details to complete the transaction When confirming a payment, you can use: - A newly generated `paymentToken` from [monei.js Components](https://docs.monei.com/monei-js/overview/) - A permanent `paymentToken` from a previous payment (generated with `generatePaymentToken: true`) Using permanent payment tokens enables one-click checkout experiences for returning customers without requiring them to re-enter their payment information. You can provide additional customer information during confirmation, which will override any corresponding information originally passed in the payment creation request. * @summary Confirm Payment * @param {string} id The payment ID * @param {ConfirmPaymentRequest} [confirmPaymentRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ confirm: (id: string, confirmPaymentRequest?: ConfirmPaymentRequest, options?: RawAxiosRequestConfig) => Promise<RequestArgs>; /** * Creates a new payment with the specified parameters. You can create a payment in two ways: 1. **Immediate processing**: Provide a `paymentToken` or `paymentMethod` - The payment will be processed instantly 2. **Deferred processing**: Create without payment details - The payment remains in `PENDING` status until you confirm it later using the [confirm endpoint](https://docs.monei.com/apis/rest/payments-confirm/) When creating a payment without payment details, you can redirect customers to the hosted payment page where they can select their preferred payment method and complete the transaction. For immediate processing, use one of these token options: - A temporary `paymentToken` generated on the frontend using [monei.js Components](https://docs.monei.com/monei-js/overview/) - A permanent `paymentToken` from a previous successful payment (when `generatePaymentToken: true` was included) Permanent tokens enable one-click checkout experiences for returning customers by allowing you to securely store and reuse payment details without requiring customers to re-enter their information. * @summary Create Payment * @param {CreatePaymentRequest} createPaymentRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ create: (createPaymentRequest: CreatePaymentRequest, options?: RawAxiosRequestConfig) => Promise<RequestArgs>; /** * Retrieves the complete details of an existing payment by its unique ID. This endpoint returns all available information about the payment, including its current status, amount, customer details, timestamps, and transaction history. Use this to check the status of a payment, verify payment details, or retrieve information for your records. Supply the unique payment ID that was returned from your previous request. * @summary Get Payment * @param {string} id The payment ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ get: (id: string, options?: RawAxiosRequestConfig) => Promise<RequestArgs>; /** * Creates a subsequent charge using the payment details from a previous transaction. This endpoint enables recurring billing and subscription payments by: - Using the same payment method as the original payment - Charging the customer without requiring them to re-enter payment details - Supporting variable or fixed amounts (defaults to the original payment amount if not specified) **Prerequisites:** 1. The initial payment must be created with the `sequence` parameter 2. The initial payment will return a `sequenceId` in the response 3. This `sequenceId` must be provided in the URL path when making subsequent recurring charges Ideal for subscription services, membership renewals, and installment payments. **Need more advanced subscription management?** For comprehensive subscription management with features like billing cycles, trial periods, and automatic recurring billing, consider using the [Subscriptions API](https://docs.monei.com/apis/rest/subscriptions/) instead. It provides a complete solution for creating and managing subscription-based services. * @summary Recurring Payment * @param {string} sequenceId The sequence ID * @param {RecurringPaymentRequest} [recurringPaymentRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ recurring: (sequenceId: string, recurringPaymentRequest?: RecurringPaymentRequest, options?: RawAxiosRequestConfig) => Promise<RequestArgs>; /** * Returns funds from a completed payment back to the customer\'s original payment method. **Refund options:** - **Full refund**: Return the entire payment amount - **Partial refund**: Specify an amount less than the original payment - **Multiple partial refunds**: Issue several partial refunds until the total payment amount is reached **Limitations:** - You can only refund payments that have been successfully processed - A payment can only be refunded up to its original amount - Once fully refunded, a payment cannot be refunded again - Attempting to refund more than the remaining available amount will result in an error * @summary Refund Payment * @param {string} id The payment ID * @param {RefundPaymentRequest} [refundPaymentRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ refund: (id: string, refundPaymentRequest?: RefundPaymentRequest, options?: RawAxiosRequestConfig) => Promise<RequestArgs>; /** * Sends a payment link to the customer through their preferred communication channel. **This API can only be used for payments with the following status:** - Pending **Delivery channels are automatically selected based on available customer information:** - If customer email is available: Link is sent via email - If customer phone is available: Link is sent via WhatsApp - If WhatsApp delivery fails: Link is sent via SMS as a fallback The payment link allows customers to complete the payment at their convenience using their preferred payment method on the secure MONEI payment page. If no customer contact information is provided, the system will use the details stored in the payment record. * @summary Send Payment Link * @param {string} id The payment ID * @param {SendPaymentLinkRequest} [sendPaymentLinkRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ sendLink: (id: string, sendPaymentLinkRequest?: SendPaymentLinkRequest, options?: RawAxiosRequestConfig) => Promise<RequestArgs>; /** * Sends a payment receipt to the customer through their preferred communication channel. **This API can only be used for payments with the following status:** - Succeeded **Delivery channels are automatically selected based on available customer information:** - If customer email is available: Receipt is sent via email - If customer phone is available: Receipt is sent via WhatsApp - If WhatsApp delivery fails: Receipt is sent via SMS as a fallback The receipt includes payment details such as amount, date, transaction ID, and merchant information, providing customers with a record of their successful transaction. If no customer contact information is provided, the system will use the details stored in the payment record. * @summary Send Payment Receipt * @param {string} id The payment ID * @param {SendPaymentReceiptRequest} [sendPaymentReceiptRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ sendReceipt: (id: string, sendPaymentReceiptRequest?: SendPaymentReceiptRequest, options?: RawAxiosRequestConfig) => Promise<RequestArgs>; /** * Sends a direct payment request to the customer\'s phone with smart channel selection. **Smart delivery logic based on customer phone capabilities:** - If the phone number is registered with Bizum and that payment method is available: The customer receives a push notification in their banking app to instantly approve the payment - If Bizum is not available or the phone is not registered with Bizum: The customer receives a payment link via WhatsApp to complete the payment This endpoint provides a streamlined payment experience, especially for Spanish customers with Bizum integration, enabling quick and convenient mobile payments. * @summary Send Payment Request * @param {string} id The payment ID * @param {SendPaymentRequestRequest} sendPaymentRequestRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ sendRequest: (id: string, sendPaymentRequestRequest: SendPaymentRequestRequest, options?: RawAxiosRequestConfig) => Promise<RequestArgs>; }; /** * PaymentsApi - functional programming interface * @export */ export declare const PaymentsApiFp: (configuration?: Configuration) => { /** * Releases reserved funds from a previously authorized payment. This endpoint can only be used with payments in `AUTHORIZED` status. This operation is part of the two-step authorization flow: 1. **Authorize**: Create a payment with `transactionType: AUTH` to reserve funds 2. **Cancel**: Release the reserved funds if you decide not to capture the payment Cancellation makes the reserved funds available to the customer again and prevents you from being able to capture those funds in the future. Once cancelled, an authorization cannot be reactivated. * @summary Cancel Payment * @param {string} id The payment ID * @param {CancelPaymentRequest} [cancelPaymentRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ cancel(id: string, cancelPaymentRequest?: CancelPaymentRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Payment>>; /** * Captures funds from a previously authorized payment. This endpoint can only be used with payments in `AUTHORIZED` status. This operation completes the two-step authorization flow: 1. **Authorize**: Create a payment with `transactionType: AUTH` to reserve funds 2. **Capture**: Transfer the reserved funds to your account when ready to fulfill the order **Important**: Authorized payments expire after exactly seven days. After expiration, they will be marked as `EXPIRED` and can no longer be captured. Be sure to capture funds within this timeframe or communicate with your customer about a new payment. * @summary Capture Payment * @param {string} id The payment ID * @param {CapturePaymentRequest} [capturePaymentRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ capture(id: string, capturePaymentRequest?: CapturePaymentRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Payment>>; /** * Confirms a payment that was created without payment details. This endpoint can only be used with payments in `PENDING` status. The two-step payment flow: 1. **Create**: First, create a payment without payment details (status: `PENDING`) 2. **Confirm**: Then provide payment details to complete the transaction When confirming a payment, you can use: - A newly generated `paymentToken` from [monei.js Components](https://docs.monei.com/monei-js/overview/) - A permanent `paymentToken` from a previous payment (generated with `generatePaymentToken: true`) Using permanent payment tokens enables one-click checkout experiences for returning customers without requiring them to re-enter their payment information. You can provide additional customer information during confirmation, which will override any corresponding information originally passed in the payment creation request. * @summary Confirm Payment * @param {string} id The payment ID * @param {ConfirmPaymentRequest} [confirmPaymentRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ confirm(id: string, confirmPaymentRequest?: ConfirmPaymentRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Payment>>; /** * Creates a new payment with the specified parameters. You can create a payment in two ways: 1. **Immediate processing**: Provide a `paymentToken` or `paymentMethod` - The payment will be processed instantly 2. **Deferred processing**: Create without payment details - The payment remains in `PENDING` status until you confirm it later using the [confirm endpoint](https://docs.monei.com/apis/rest/payments-confirm/) When creating a payment without payment details, you can redirect customers to the hosted payment page where they can select their preferred payment method and complete the transaction. For immediate processing, use one of these token options: - A temporary `paymentToken` generated on the frontend using [monei.js Components](https://docs.monei.com/monei-js/overview/) - A permanent `paymentToken` from a previous successful payment (when `generatePaymentToken: true` was included) Permanent tokens enable one-click checkout experiences for returning customers by allowing you to securely store and reuse payment details without requiring customers to re-enter their information. * @summary Create Payment * @param {CreatePaymentRequest} createPaymentRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ create(createPaymentRequest: CreatePaymentRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Payment>>; /** * Retrieves the complete details of an existing payment by its unique ID. This endpoint returns all available information about the payment, including its current status, amount, customer details, timestamps, and transaction history. Use this to check the status of a payment, verify payment details, or retrieve information for your records. Supply the unique payment ID that was returned from your previous request. * @summary Get Payment * @param {string} id The payment ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ get(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Payment>>; /** * Creates a subsequent charge using the payment details from a previous transaction. This endpoint enables recurring billing and subscription payments by: - Using the same payment method as the original payment - Charging the customer without requiring them to re-enter payment details - Supporting variable or fixed amounts (defaults to the original payment amount if not specified) **Prerequisites:** 1. The initial payment must be created with the `sequence` parameter 2. The initial payment will return a `sequenceId` in the response 3. This `sequenceId` must be provided in the URL path when making subsequent recurring charges Ideal for subscription services, membership renewals, and installment payments. **Need more advanced subscription management?** For comprehensive subscription management with features like billing cycles, trial periods, and automatic recurring billing, consider using the [Subscriptions API](https://docs.monei.com/apis/rest/subscriptions/) instead. It provides a complete solution for creating and managing subscription-based services. * @summary Recurring Payment * @param {string} sequenceId The sequence ID * @param {RecurringPaymentRequest} [recurringPaymentRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ recurring(sequenceId: string, recurringPaymentRequest?: RecurringPaymentRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Payment>>; /** * Returns funds from a completed payment back to the customer\'s original payment method. **Refund options:** - **Full refund**: Return the entire payment amount - **Partial refund**: Specify an amount less than the original payment - **Multiple partial refunds**: Issue several partial refunds until the total payment amount is reached **Limitations:** - You can only refund payments that have been successfully processed - A payment can only be refunded up to its original amount - Once fully refunded, a payment cannot be refunded again - Attempting to refund more than the remaining available amount will result in an error * @summary Refund Payment * @param {string} id The payment ID * @param {RefundPaymentRequest} [refundPaymentRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ refund(id: string, refundPaymentRequest?: RefundPaymentRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Payment>>; /** * Sends a payment link to the customer through their preferred communication channel. **This API can only be used for payments with the following status:** - Pending **Delivery channels are automatically selected based on available customer information:** - If customer email is available: Link is sent via email - If customer phone is available: Link is sent via WhatsApp - If WhatsApp delivery fails: Link is sent via SMS as a fallback The payment link allows customers to complete the payment at their convenience using their preferred payment method on the secure MONEI payment page. If no customer contact information is provided, the system will use the details stored in the payment record. * @summary Send Payment Link * @param {string} id The payment ID * @param {SendPaymentLinkRequest} [sendPaymentLinkRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ sendLink(id: string, sendPaymentLinkRequest?: SendPaymentLinkRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Payment>>; /** * Sends a payment receipt to the customer through their preferred communication channel. **This API can only be used for payments with the following status:** - Succeeded **Delivery channels are automatically selected based on available customer information:** - If customer email is available: Receipt is sent via email - If customer phone is available: Receipt is sent via WhatsApp - If WhatsApp delivery fails: Receipt is sent via SMS as a fallback The receipt includes payment details such as amount, date, transaction ID, and merchant information, providing customers with a record of their successful transaction. If no customer contact information is provided, the system will use the details stored in the payment record. * @summary Send Payment Receipt * @param {string} id The payment ID * @param {SendPaymentReceiptRequest} [sendPaymentReceiptRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ sendReceipt(id: string, sendPaymentReceiptRequest?: SendPaymentReceiptRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Payment>>; /** * Sends a direct payment request to the customer\'s phone with smart channel selection. **Smart delivery logic based on customer phone capabilities:** - If the phone number is registered with Bizum and that payment method is available: The customer receives a push notification in their banking app to instantly approve the payment - If Bizum is not available or the phone is not registered with Bizum: The customer receives a payment link via WhatsApp to complete the payment This endpoint provides a streamlined payment experience, especially for Spanish customers with Bizum integration, enabling quick and convenient mobile payments. * @summary Send Payment Request * @param {string} id The payment ID * @param {SendPaymentRequestRequest} sendPaymentRequestRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ sendRequest(id: string, sendPaymentRequestRequest: SendPaymentRequestRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Payment>>; }; /** * PaymentsApi - factory interface * @export */ export declare const PaymentsApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => { /** * Releases reserved funds from a previously authorized payment. This endpoint can only be used with payments in `AUTHORIZED` status. This operation is part of the two-step authorization flow: 1. **Authorize**: Create a payment with `transactionType: AUTH` to reserve funds 2. **Cancel**: Release the reserved funds if you decide not to capture the payment Cancellation makes the reserved funds available to the customer again and prevents you from being able to capture those funds in the future. Once cancelled, an authorization cannot be reactivated. * @summary Cancel Payment * @param {string} id The payment ID * @param {CancelPaymentRequest} [cancelPaymentRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ cancel(id: string, cancelPaymentRequest?: CancelPaymentRequest, options?: RawAxiosRequestConfig): AxiosPromise<Payment>; /** * Captures funds from a previously authorized payment. This endpoint can only be used with payments in `AUTHORIZED` status. This operation completes the two-step authorization flow: 1. **Authorize**: Create a payment with `transactionType: AUTH` to reserve funds 2. **Capture**: Transfer the reserved funds to your account when ready to fulfill the order **Important**: Authorized payments expire after exactly seven days. After expiration, they will be marked as `EXPIRED` and can no longer be captured. Be sure to capture funds within this timeframe or communicate with your customer about a new payment. * @summary Capture Payment * @param {string} id The payment ID * @param {CapturePaymentRequest} [capturePaymentRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ capture(id: string, capturePaymentRequest?: CapturePaymentRequest, options?: RawAxiosRequestConfig): AxiosPromise<Payment>; /** * Confirms a payment that was created without payment details. This endpoint can only be used with payments in `PENDING` status. The two-step payment flow: 1. **Create**: First, create a payment without payment details (status: `PENDING`) 2. **Confirm**: Then provide payment details to complete the transaction When confirming a payment, you can use: - A newly generated `paymentToken` from [monei.js Components](https://docs.monei.com/monei-js/overview/) - A permanent `paymentToken` from a previous payment (generated with `generatePaymentToken: true`) Using permanent payment tokens enables one-click checkout experiences for returning customers without requiring them to re-enter their payment information. You can provide additional customer information during confirmation, which will override any corresponding information originally passed in the payment creation request. * @summary Confirm Payment * @param {string} id The payment ID * @param {ConfirmPaymentRequest} [confirmPaymentRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ confirm(id: string, confirmPaymentRequest?: ConfirmPaymentRequest, options?: RawAxiosRequestConfig): AxiosPromise<Payment>; /** * Creates a new payment with the specified parameters. You can create a payment in two ways: 1. **Immediate processing**: Provide a `paymentToken` or `paymentMethod` - The payment will be processed instantly 2. **Deferred processing**: Create without payment details - The payment remains in `PENDING` status until you confirm it later using the [confirm endpoint](https://docs.monei.com/apis/rest/payments-confirm/) When creating a payment without payment details, you can redirect customers to the hosted payment page where they can select their preferred payment method and complete the transaction. For immediate processing, use one of these token options: - A temporary `paymentToken` generated on the frontend using [monei.js Components](https://docs.monei.com/monei-js/overview/) - A permanent `paymentToken` from a previous successful payment (when `generatePaymentToken: true` was included) Permanent tokens enable one-click checkout experiences for returning customers by allowing you to securely store and reuse payment details without requiring customers to re-enter their information. * @summary Create Payment * @param {CreatePaymentRequest} createPaymentRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ create(createPaymentRequest: CreatePaymentRequest, options?: RawAxiosRequestConfig): AxiosPromise<Payment>; /** * Retrieves the complete details of an existing payment by its unique ID. This endpoint returns all available information about the payment, including its current status, amount, customer details, timestamps, and transaction history. Use this to check the status of a payment, verify payment details, or retrieve information for your records. Supply the unique payment ID that was returned from your previous request. * @summary Get Payment * @param {string} id The payment ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ get(id: string, options?: RawAxiosRequestConfig): AxiosPromise<Payment>; /** * Creates a subsequent charge using the payment details from a previous transaction. This endpoint enables recurring billing and subscription payments by: - Using the same payment method as the original payment - Charging the customer without requiring them to re-enter payment details - Supporting variable or fixed amounts (defaults to the original payment amount if not specified) **Prerequisites:** 1. The initial payment must be created with the `sequence` parameter 2. The initial payment will return a `sequenceId` in the response 3. This `sequenceId` must be provided in the URL path when making subsequent recurring charges Ideal for subscription services, membership renewals, and installment payments. **Need more advanced subscription management?** For comprehensive subscription management with features like billing cycles, trial periods, and automatic recurring billing, consider using the [Subscriptions API](https://docs.monei.com/apis/rest/subscriptions/) instead. It provides a complete solution for creating and managing subscription-based services. * @summary Recurring Payment * @param {string} sequenceId The sequence ID * @param {RecurringPaymentRequest} [recurringPaymentRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ recurring(sequenceId: string, recurringPaymentRequest?: RecurringPaymentRequest, options?: RawAxiosRequestConfig): AxiosPromise<Payment>; /** * Returns funds from a completed payment back to the customer\'s original payment method. **Refund options:** - **Full refund**: Return the entire payment amount - **Partial refund**: Specify an amount less than the original payment - **Multiple partial refunds**: Issue several partial refunds until the total payment amount is reached **Limitations:** - You can only refund payments that have been successfully processed - A payment can only be refunded up to its original amount - Once fully refunded, a payment cannot be refunded again - Attempting to refund more than the remaining available amount will result in an error * @summary Refund Payment * @param {string} id The payment ID * @param {RefundPaymentRequest} [refundPaymentRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ refund(id: string, refundPaymentRequest?: RefundPaymentRequest, options?: RawAxiosRequestConfig): AxiosPromise<Payment>; /** * Sends a payment link to the customer through their preferred communication channel. **This API can only be used for payments with the following status:** - Pending **Delivery channels are automatically selected based on available customer information:** - If customer email is available: Link is sent via email - If customer phone is available: Link is sent via WhatsApp - If WhatsApp delivery fails: Link is sent via SMS as a fallback The payment link allows customers to complete the payment at their convenience using their preferred payment method on the secure MONEI payment page. If no customer contact information is provided, the system will use the details stored in the payment record. * @summary Send Payment Link * @param {string} id The payment ID * @param {SendPaymentLinkRequest} [sendPaymentLinkRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ sendLink(id: string, sendPaymentLinkRequest?: SendPaymentLinkRequest, options?: RawAxiosRequestConfig): AxiosPromise<Payment>; /** * Sends a payment receipt to the customer through their preferred communication channel. **This API can only be used for payments with the following status:** - Succeeded **Delivery channels are automatically selected based on available customer information:** - If customer email is available: Receipt is sent via email - If customer phone is available: Receipt is sent via WhatsApp - If WhatsApp delivery fails: Receipt is sent via SMS as a fallback The receipt includes payment details such as amount, date, transaction ID, and merchant information, providing customers with a record of their successful transaction. If no customer contact information is provided, the system will use the details stored in the payment record. * @summary Send Payment Receipt * @param {string} id The payment ID * @param {SendPaymentReceiptRequest} [sendPaymentReceiptRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ sendReceipt(id: string, sendPaymentReceiptRequest?: SendPaymentReceiptRequest, options?: RawAxiosRequestConfig): AxiosPromise<Payment>; /** * Sends a direct payment request to the customer\'s phone with smart channel selection. **Smart delivery logic based on customer phone capabilities:** - If the phone number is registered with Bizum and that payment method is available: The customer receives a push notification in their banking app to instantly approve the payment - If Bizum is not available or the phone is not registered with Bizum: The customer receives a payment link via WhatsApp to complete the payment This endpoint provides a streamlined payment experience, especially for Spanish customers with Bizum integration, enabling quick and convenient mobile payments. * @summary Send Payment Request * @param {string} id The payment ID * @param {SendPaymentRequestRequest} sendPaymentRequestRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ sendRequest(id: string, sendPaymentRequestRequest: SendPaymentRequestRequest, options?: RawAxiosRequestConfig): AxiosPromise<Payment>; }; /** * PaymentsApi - object-oriented interface * @export * @class PaymentsApi * @extends {BaseAPI} */ export declare class PaymentsApi extends BaseAPI { /** * Releases reserved funds from a previously authorized payment. This endpoint can only be used with payments in `AUTHORIZED` status. This operation is part of the two-step authorization flow: 1. **Authorize**: Create a payment with `transactionType: AUTH` to reserve funds 2. **Cancel**: Release the reserved funds if you decide not to capture the payment Cancellation makes the reserved funds available to the customer again and prevents you from being able to capture those funds in the future. Once cancelled, an authorization cannot be reactivated. * @summary Cancel Payment * @param {string} id The payment ID * @param {CancelPaymentRequest} [cancelPaymentRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PaymentsApi */ cancel(id: string, cancelPaymentRequest?: CancelPaymentRequest, options?: RawAxiosRequestConfig): Promise<Payment>; /** * Captures funds from a previously authorized payment. This endpoint can only be used with payments in `AUTHORIZED` status. This operation completes the two-step authorization flow: 1. **Authorize**: Create a payment with `transactionType: AUTH` to reserve funds 2. **Capture**: Transfer the reserved funds to your account when ready to fulfill the order **Important**: Authorized payments expire after exactly seven days. After expiration, they will be marked as `EXPIRED` and can no longer be captured. Be sure to capture funds within this timeframe or communicate with your customer about a new payment. * @summary Capture Payment * @param {string} id The payment ID * @param {CapturePaymentRequest} [capturePaymentRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PaymentsApi */ capture(id: string, capturePaymentRequest?: CapturePaymentRequest, options?: RawAxiosRequestConfig): Promise<Payment>; /** * Confirms a payment that was created without payment details. This endpoint can only be used with payments in `PENDING` status. The two-step payment flow: 1. **Create**: First, create a payment without payment details (status: `PENDING`) 2. **Confirm**: Then provide payment details to complete the transaction When confirming a payment, you can use: - A newly generated `paymentToken` from [monei.js Components](https://docs.monei.com/monei-js/overview/) - A permanent `paymentToken` from a previous payment (generated with `generatePaymentToken: true`) Using permanent payment tokens enables one-click checkout experiences for returning customers without requiring them to re-enter their payment information. You can provide additional customer information during confirmation, which will override any corresponding information originally passed in the payment creation request. * @summary Confirm Payment * @param {string} id The payment ID * @param {ConfirmPaymentRequest} [confirmPaymentRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PaymentsApi */ confirm(id: string, confirmPaymentRequest?: ConfirmPaymentRequest, options?: RawAxiosRequestConfig): Promise<Payment>; /** * Creates a new payment with the specified parameters. You can create a payment in two ways: 1. **Immediate processing**: Provide a `paymentToken` or `paymentMethod` - The payment will be processed instantly 2. **Deferred processing**: Create without payment details - The payment remains in `PENDING` status until you confirm it later using the [confirm endpoint](https://docs.monei.com/apis/rest/payments-confirm/) When creating a payment without payment details, you can redirect customers to the hosted payment page where they can select their preferred payment method and complete the transaction. For immediate processing, use one of these token options: - A temporary `paymentToken` generated on the frontend using [monei.js Components](https://docs.monei.com/monei-js/overview/) - A permanent `paymentToken` from a previous successful payment (when `generatePaymentToken: true` was included) Permanent tokens enable one-click checkout experiences for returning customers by allowing you to securely store and reuse payment details without requiring customers to re-enter their information. * @summary Create Payment * @param {CreatePaymentRequest} createPaymentRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PaymentsApi */ create(createPaymentRequest: CreatePaymentRequest, options?: RawAxiosRequestConfig): Promise<Payment>; /** * Retrieves the complete details of an existing payment by its unique ID. This endpoint returns all available information about the payment, including its current status, amount, customer details, timestamps, and transaction history. Use this to check the status of a payment, verify payment details, or retrieve information for your records. Supply the unique payment ID that was returned from your previous request. * @summary Get Payment * @param {string} id The payment ID * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PaymentsApi */ get(id: string, options?: RawAxiosRequestConfig): Promise<Payment>; /** * Creates a subsequent charge using the payment details from a previous transaction. This endpoint enables recurring billing and subscription payments by: - Using the same payment method as the original payment - Charging the customer without requiring them to re-enter payment details - Supporting variable or fixed amounts (defaults to the original payment amount if not specified) **Prerequisites:** 1. The initial payment must be created with the `sequence` parameter 2. The initial payment will return a `sequenceId` in the response 3. This `sequenceId` must be provided in the URL path when making subsequent recurring charges Ideal for subscription services, membership renewals, and installment payments. **Need more advanced subscription management?** For comprehensive subscription management with features like billing cycles, trial periods, and automatic recurring billing, consider using the [Subscriptions API](https://docs.monei.com/apis/rest/subscriptions/) instead. It provides a complete solution for creating and managing subscription-based services. * @summary Recurring Payment * @param {string} sequenceId The sequence ID * @param {RecurringPaymentRequest} [recurringPaymentRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PaymentsApi */ recurring(sequenceId: string, recurringPaymentRequest?: RecurringPaymentRequest, options?: RawAxiosRequestConfig): Promise<Payment>; /** * Returns funds from a completed payment back to the customer\'s original payment method. **Refund options:** - **Full refund**: Return the entire payment amount - **Partial refund**: Specify an amount less than the original payment - **Multiple partial refunds**: Issue several partial refunds until the total payment amount is reached **Limitations:** - You can only refund payments that have been successfully processed - A payment can only be refunded up to its original amount - Once fully refunded, a payment cannot be refunded again - Attempting to refund more than the remaining available amount will result in an error * @summary Refund Payment * @param {string} id The payment ID * @param {RefundPaymentRequest} [refundPaymentRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PaymentsApi */ refund(id: string, refundPaymentRequest?: RefundPaymentRequest, options?: RawAxiosRequestConfig): Promise<Payment>; /** * Sends a payment link to the customer through their preferred communication channel. **This API can only be used for payments with the following status:** - Pending **Delivery channels are automatically selected based on available customer information:** - If customer email is available: Link is sent via email - If customer phone is available: Link is sent via WhatsApp - If WhatsApp delivery fails: Link is sent via SMS as a fallback The payment link allows customers to complete the payment at their convenience using their preferred payment method on the secure MONEI payment page. If no customer contact information is provided, the system will use the details stored in the payment record. * @summary Send Payment Link * @param {string} id The payment ID * @param {SendPaymentLinkRequest} [sendPaymentLinkRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PaymentsApi */ sendLink(id: string, sendPaymentLinkRequest?: SendPaymentLinkRequest, options?: RawAxiosRequestConfig): Promise<Payment>; /** * Sends a payment receipt to the customer through their preferred communication channel. **This API can only be used for payments with the following status:** - Succeeded **Delivery channels are automatically selected based on available customer information:** - If customer email is available: Receipt is sent via email - If customer phone is available: Receipt is sent via WhatsApp - If WhatsApp delivery fails: Receipt is sent via SMS as a fallback The receipt includes payment details such as amount, date, transaction ID, and merchant information, providing customers with a record of their successful transaction. If no customer contact information is provided, the system will use the details stored in the payment record. * @summary Send Payment Receipt * @param {string} id The payment ID * @param {SendPaymentReceiptRequest} [sendPaymentReceiptRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PaymentsApi */ sendReceipt(id: string, sendPaymentReceiptRequest?: SendPaymentReceiptRequest, options?: RawAxiosRequestConfig): Promise<Payment>; /** * Sends a direct payment request to the customer\'s phone with smart channel selection. **Smart delivery logic based on customer phone capabilities:** - If the phone number is registered with Bizum and that payment method is available: The customer receives a push notification in their banking app to instantly approve the payment - If Bizum is not available or the phone is not registered with Bizum: The customer receives a payment link via WhatsApp to complete the payment This endpoint provides a streamlined payment experience, especially for Spanish customers with Bizum integration, enabling quick and convenient mobile payments. * @summary Send Payment Request * @param {string} id The payment ID * @param {SendPaymentRequestRequest} sendPaymentRequestRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PaymentsApi */ sendRequest(id: string, sendPaymentRequestRequest: SendPaymentRequestRequest, options?: RawAxiosRequestConfig): Promise<Payment>; }