@monei-js/node-sdk
Version:
Node.js SDK for MONEI Digital Payment Gateway
371 lines (370 loc) • 45.5 kB
TypeScript
/**
* 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.7.0
*
*
* 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 { ActivateSubscriptionRequest } from '../model';
import type { CancelSubscriptionRequest } from '../model';
import type { CreateSubscriptionRequest } from '../model';
import type { PauseSubscriptionRequest } from '../model';
import type { Payment } from '../model';
import type { SendSubscriptionLinkRequest } from '../model';
import type { SendSubscriptionStatusRequest } from '../model';
import type { Subscription } from '../model';
import type { UpdateSubscriptionRequest } from '../model';
/**
* SubscriptionsApi - axios parameter creator
* @export
*/
export declare const SubscriptionsApiAxiosParamCreator: (configuration?: Configuration) => {
/**
* Activates a subscription by attaching a payment method and initiating the billing cycle. **Activation Process**: 1. This endpoint transitions a `PENDING` subscription to `ACTIVE` status 2. An initial payment is created to validate the payment method: - For regular subscriptions: First billing cycle payment is processed immediately - For trial subscriptions: A zero-amount payment is created to verify the payment method **Payment Method Updates**: If the subscription is already active, this endpoint can be used to update the payment method. The update process creates a zero-amount payment to verify the new payment method works correctly. **Important Notes**: - Subscription billing begins immediately upon successful activation (unless in trial period) - The payment method provided will be used for all future recurring charges - Activation failures (due to invalid payment method) will keep the subscription in `PENDING` status
* @summary Activate Subscription
* @param {string} id The subscription ID
* @param {ActivateSubscriptionRequest} [activateSubscriptionRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
activate: (id: string, activateSubscriptionRequest?: ActivateSubscriptionRequest, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
/**
* Cancels an active subscription, permanently stopping the billing cycle. **Cancellation Effects**: - The subscription status changes to `CANCELED` - No further charges will be processed - Access to subscription services typically ends immediately or at period end (depending on your business rules) **Important Notes**: - Cancellation is permanent and cannot be undone - To restart service, a new subscription must be created - Consider using `pauseAtPeriodEnd` or `cancelAtPeriodEnd` for softer transitions Use this endpoint when a customer wishes to completely terminate their subscription.
* @summary Cancel Subscription
* @param {string} id The subscription ID
* @param {CancelSubscriptionRequest} [cancelSubscriptionRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
cancel: (id: string, cancelSubscriptionRequest?: CancelSubscriptionRequest, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
/**
* Creates a new subscription with the specified parameters. **Subscription Lifecycle**: 1. When first created, the subscription has a `PENDING` status 2. To initiate billing, you must call the [activate endpoint](https://docs.monei.com/apis/rest/subscriptions-activate/) with payment details 3. Once activated, the subscription will automatically bill according to the configured interval **Key Configuration Parameters**: - **Billing settings**: Amount, currency, interval (daily, weekly, monthly, yearly) - **Schedule customization**: Interval count, trial period duration - **Customer information**: Contact details, billing and shipping addresses - **Communication**: Callback URLs for webhook notifications about subscription events **Best Practices**: - Set clear, descriptive names for subscriptions to help with identification - Configure appropriate webhook notifications to monitor subscription status changes - Consider offering trial periods to increase customer conversion rates - Use metadata to store additional information relevant to your business logic
* @summary Create Subscription
* @param {CreateSubscriptionRequest} createSubscriptionRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
create: (createSubscriptionRequest: CreateSubscriptionRequest, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
/**
* Retrieves the complete details of an existing subscription by its unique ID. This endpoint returns comprehensive information about the subscription, including: - Current status and lifecycle details (active, paused, canceled) - Billing configuration (amount, currency, interval) - Schedule information (current period, next payment date) - Customer and payment method details - Payment history (including last payment status) - Trial period information (if applicable) Use this endpoint to check subscription status, verify billing details, or retrieve information needed for customer support inquiries.
* @summary Get Subscription
* @param {string} id The subscription ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
get: (id: string, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
/**
* Pauses an active subscription, temporarily halting the billing cycle. **Pause Effects**: - Billing is immediately suspended - The subscription status changes to `PAUSED` - No charges will be processed while the subscription remains paused - The current billing period end date remains unchanged **Use Cases**: - Temporary service interruptions - Customer vacation or absence periods - Account maintenance or dispute resolution To resume billing, use the [resume endpoint](https://docs.monei.com/apis/rest/subscriptions-resume/).
* @summary Pause Subscription
* @param {string} id The subscription ID
* @param {PauseSubscriptionRequest} [pauseSubscriptionRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
pause: (id: string, pauseSubscriptionRequest?: PauseSubscriptionRequest, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
/**
* Resumes a previously paused subscription, reactivating the billing cycle. **Resume Effects**: - Billing is immediately reactivated - The subscription status changes from `PAUSED` to `ACTIVE` - The next billing date is recalculated based on the current date - Regular charging schedule resumes according to the subscription interval **Important Notes**: - No immediate charge is created when resuming (billing continues on next scheduled date) - Any pause duration is added to the current billing period, maintaining the expected number of billing cycles - If a significant time has passed, verify that the payment method is still valid
* @summary Resume Subscription
* @param {string} id The subscription ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
resume: (id: string, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
/**
* Sends a subscription activation link to the customer through their preferred communication channel. **This API can only be used for subscriptions 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 subscription activation link allows customers to complete their subscription setup by providing payment details on the secure MONEI payment page. If no customer contact information is provided, the system will use the details stored in the subscription record.
* @summary Send Subscription Link
* @param {string} id The subscription ID
* @param {SendSubscriptionLinkRequest} [sendSubscriptionLinkRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
sendLink: (id: string, sendSubscriptionLinkRequest?: SendSubscriptionLinkRequest, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
/**
* Sends subscription status information to the customer through their preferred communication channel. **This API can only be used for subscriptions with the following statuses:** - Active - Trialing - Past due **Delivery channels are automatically selected based on available customer information:** - If customer email is available: Status is sent via email - If customer phone is available: Status is sent via WhatsApp - If WhatsApp delivery fails: Status is sent via SMS as a fallback The status notification includes subscription details such as current status, upcoming payments, and recent changes. If no customer contact information is provided, the system will use the details stored in the subscription record. **Email notifications include contextual action links based on subscription status:** - For past due subscriptions: A link to reactivate the subscription - For active and trialing subscriptions: A link to update the payment method You can specify the customer\'s email or phone number, the preferred communication channel (email or SMS), and the language for the message.
* @summary Send Subscription Status
* @param {string} id The subscription ID
* @param {SendSubscriptionStatusRequest} [sendSubscriptionStatusRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
sendStatus: (id: string, sendSubscriptionStatusRequest?: SendSubscriptionStatusRequest, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
/**
* Updates the configuration of an existing subscription. **Modifiable Parameters**: - Billing information (amount, description) - Customer details (contact information, billing/shipping addresses) - Subscription settings (cancelAtPeriodEnd, pauseAtPeriodEnd) - Metadata (for your internal tracking) **Update Effects**: - Amount changes apply to the next billing cycle - Customer information updates take effect immediately - Setting `cancelAtPeriodEnd` to true will end the subscription after the current period - Setting `pauseAtPeriodEnd` to true will pause billing after the current period **Note**: Some fundamental properties cannot be changed once a subscription is created, including currency and billing interval. To modify these, you would need to cancel the existing subscription and create a new one.
* @summary Update Subscription
* @param {string} id The subscription ID
* @param {UpdateSubscriptionRequest} updateSubscriptionRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
update: (id: string, updateSubscriptionRequest: UpdateSubscriptionRequest, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
};
/**
* SubscriptionsApi - functional programming interface
* @export
*/
export declare const SubscriptionsApiFp: (configuration?: Configuration) => {
/**
* Activates a subscription by attaching a payment method and initiating the billing cycle. **Activation Process**: 1. This endpoint transitions a `PENDING` subscription to `ACTIVE` status 2. An initial payment is created to validate the payment method: - For regular subscriptions: First billing cycle payment is processed immediately - For trial subscriptions: A zero-amount payment is created to verify the payment method **Payment Method Updates**: If the subscription is already active, this endpoint can be used to update the payment method. The update process creates a zero-amount payment to verify the new payment method works correctly. **Important Notes**: - Subscription billing begins immediately upon successful activation (unless in trial period) - The payment method provided will be used for all future recurring charges - Activation failures (due to invalid payment method) will keep the subscription in `PENDING` status
* @summary Activate Subscription
* @param {string} id The subscription ID
* @param {ActivateSubscriptionRequest} [activateSubscriptionRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
activate(id: string, activateSubscriptionRequest?: ActivateSubscriptionRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Payment>>;
/**
* Cancels an active subscription, permanently stopping the billing cycle. **Cancellation Effects**: - The subscription status changes to `CANCELED` - No further charges will be processed - Access to subscription services typically ends immediately or at period end (depending on your business rules) **Important Notes**: - Cancellation is permanent and cannot be undone - To restart service, a new subscription must be created - Consider using `pauseAtPeriodEnd` or `cancelAtPeriodEnd` for softer transitions Use this endpoint when a customer wishes to completely terminate their subscription.
* @summary Cancel Subscription
* @param {string} id The subscription ID
* @param {CancelSubscriptionRequest} [cancelSubscriptionRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
cancel(id: string, cancelSubscriptionRequest?: CancelSubscriptionRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Subscription>>;
/**
* Creates a new subscription with the specified parameters. **Subscription Lifecycle**: 1. When first created, the subscription has a `PENDING` status 2. To initiate billing, you must call the [activate endpoint](https://docs.monei.com/apis/rest/subscriptions-activate/) with payment details 3. Once activated, the subscription will automatically bill according to the configured interval **Key Configuration Parameters**: - **Billing settings**: Amount, currency, interval (daily, weekly, monthly, yearly) - **Schedule customization**: Interval count, trial period duration - **Customer information**: Contact details, billing and shipping addresses - **Communication**: Callback URLs for webhook notifications about subscription events **Best Practices**: - Set clear, descriptive names for subscriptions to help with identification - Configure appropriate webhook notifications to monitor subscription status changes - Consider offering trial periods to increase customer conversion rates - Use metadata to store additional information relevant to your business logic
* @summary Create Subscription
* @param {CreateSubscriptionRequest} createSubscriptionRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
create(createSubscriptionRequest: CreateSubscriptionRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Subscription>>;
/**
* Retrieves the complete details of an existing subscription by its unique ID. This endpoint returns comprehensive information about the subscription, including: - Current status and lifecycle details (active, paused, canceled) - Billing configuration (amount, currency, interval) - Schedule information (current period, next payment date) - Customer and payment method details - Payment history (including last payment status) - Trial period information (if applicable) Use this endpoint to check subscription status, verify billing details, or retrieve information needed for customer support inquiries.
* @summary Get Subscription
* @param {string} id The subscription ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
get(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Subscription>>;
/**
* Pauses an active subscription, temporarily halting the billing cycle. **Pause Effects**: - Billing is immediately suspended - The subscription status changes to `PAUSED` - No charges will be processed while the subscription remains paused - The current billing period end date remains unchanged **Use Cases**: - Temporary service interruptions - Customer vacation or absence periods - Account maintenance or dispute resolution To resume billing, use the [resume endpoint](https://docs.monei.com/apis/rest/subscriptions-resume/).
* @summary Pause Subscription
* @param {string} id The subscription ID
* @param {PauseSubscriptionRequest} [pauseSubscriptionRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
pause(id: string, pauseSubscriptionRequest?: PauseSubscriptionRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Subscription>>;
/**
* Resumes a previously paused subscription, reactivating the billing cycle. **Resume Effects**: - Billing is immediately reactivated - The subscription status changes from `PAUSED` to `ACTIVE` - The next billing date is recalculated based on the current date - Regular charging schedule resumes according to the subscription interval **Important Notes**: - No immediate charge is created when resuming (billing continues on next scheduled date) - Any pause duration is added to the current billing period, maintaining the expected number of billing cycles - If a significant time has passed, verify that the payment method is still valid
* @summary Resume Subscription
* @param {string} id The subscription ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
resume(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Subscription>>;
/**
* Sends a subscription activation link to the customer through their preferred communication channel. **This API can only be used for subscriptions 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 subscription activation link allows customers to complete their subscription setup by providing payment details on the secure MONEI payment page. If no customer contact information is provided, the system will use the details stored in the subscription record.
* @summary Send Subscription Link
* @param {string} id The subscription ID
* @param {SendSubscriptionLinkRequest} [sendSubscriptionLinkRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
sendLink(id: string, sendSubscriptionLinkRequest?: SendSubscriptionLinkRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Subscription>>;
/**
* Sends subscription status information to the customer through their preferred communication channel. **This API can only be used for subscriptions with the following statuses:** - Active - Trialing - Past due **Delivery channels are automatically selected based on available customer information:** - If customer email is available: Status is sent via email - If customer phone is available: Status is sent via WhatsApp - If WhatsApp delivery fails: Status is sent via SMS as a fallback The status notification includes subscription details such as current status, upcoming payments, and recent changes. If no customer contact information is provided, the system will use the details stored in the subscription record. **Email notifications include contextual action links based on subscription status:** - For past due subscriptions: A link to reactivate the subscription - For active and trialing subscriptions: A link to update the payment method You can specify the customer\'s email or phone number, the preferred communication channel (email or SMS), and the language for the message.
* @summary Send Subscription Status
* @param {string} id The subscription ID
* @param {SendSubscriptionStatusRequest} [sendSubscriptionStatusRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
sendStatus(id: string, sendSubscriptionStatusRequest?: SendSubscriptionStatusRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Subscription>>;
/**
* Updates the configuration of an existing subscription. **Modifiable Parameters**: - Billing information (amount, description) - Customer details (contact information, billing/shipping addresses) - Subscription settings (cancelAtPeriodEnd, pauseAtPeriodEnd) - Metadata (for your internal tracking) **Update Effects**: - Amount changes apply to the next billing cycle - Customer information updates take effect immediately - Setting `cancelAtPeriodEnd` to true will end the subscription after the current period - Setting `pauseAtPeriodEnd` to true will pause billing after the current period **Note**: Some fundamental properties cannot be changed once a subscription is created, including currency and billing interval. To modify these, you would need to cancel the existing subscription and create a new one.
* @summary Update Subscription
* @param {string} id The subscription ID
* @param {UpdateSubscriptionRequest} updateSubscriptionRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
update(id: string, updateSubscriptionRequest: UpdateSubscriptionRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Subscription>>;
};
/**
* SubscriptionsApi - factory interface
* @export
*/
export declare const SubscriptionsApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
/**
* Activates a subscription by attaching a payment method and initiating the billing cycle. **Activation Process**: 1. This endpoint transitions a `PENDING` subscription to `ACTIVE` status 2. An initial payment is created to validate the payment method: - For regular subscriptions: First billing cycle payment is processed immediately - For trial subscriptions: A zero-amount payment is created to verify the payment method **Payment Method Updates**: If the subscription is already active, this endpoint can be used to update the payment method. The update process creates a zero-amount payment to verify the new payment method works correctly. **Important Notes**: - Subscription billing begins immediately upon successful activation (unless in trial period) - The payment method provided will be used for all future recurring charges - Activation failures (due to invalid payment method) will keep the subscription in `PENDING` status
* @summary Activate Subscription
* @param {string} id The subscription ID
* @param {ActivateSubscriptionRequest} [activateSubscriptionRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
activate(id: string, activateSubscriptionRequest?: ActivateSubscriptionRequest, options?: RawAxiosRequestConfig): AxiosPromise<Payment>;
/**
* Cancels an active subscription, permanently stopping the billing cycle. **Cancellation Effects**: - The subscription status changes to `CANCELED` - No further charges will be processed - Access to subscription services typically ends immediately or at period end (depending on your business rules) **Important Notes**: - Cancellation is permanent and cannot be undone - To restart service, a new subscription must be created - Consider using `pauseAtPeriodEnd` or `cancelAtPeriodEnd` for softer transitions Use this endpoint when a customer wishes to completely terminate their subscription.
* @summary Cancel Subscription
* @param {string} id The subscription ID
* @param {CancelSubscriptionRequest} [cancelSubscriptionRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
cancel(id: string, cancelSubscriptionRequest?: CancelSubscriptionRequest, options?: RawAxiosRequestConfig): AxiosPromise<Subscription>;
/**
* Creates a new subscription with the specified parameters. **Subscription Lifecycle**: 1. When first created, the subscription has a `PENDING` status 2. To initiate billing, you must call the [activate endpoint](https://docs.monei.com/apis/rest/subscriptions-activate/) with payment details 3. Once activated, the subscription will automatically bill according to the configured interval **Key Configuration Parameters**: - **Billing settings**: Amount, currency, interval (daily, weekly, monthly, yearly) - **Schedule customization**: Interval count, trial period duration - **Customer information**: Contact details, billing and shipping addresses - **Communication**: Callback URLs for webhook notifications about subscription events **Best Practices**: - Set clear, descriptive names for subscriptions to help with identification - Configure appropriate webhook notifications to monitor subscription status changes - Consider offering trial periods to increase customer conversion rates - Use metadata to store additional information relevant to your business logic
* @summary Create Subscription
* @param {CreateSubscriptionRequest} createSubscriptionRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
create(createSubscriptionRequest: CreateSubscriptionRequest, options?: RawAxiosRequestConfig): AxiosPromise<Subscription>;
/**
* Retrieves the complete details of an existing subscription by its unique ID. This endpoint returns comprehensive information about the subscription, including: - Current status and lifecycle details (active, paused, canceled) - Billing configuration (amount, currency, interval) - Schedule information (current period, next payment date) - Customer and payment method details - Payment history (including last payment status) - Trial period information (if applicable) Use this endpoint to check subscription status, verify billing details, or retrieve information needed for customer support inquiries.
* @summary Get Subscription
* @param {string} id The subscription ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
get(id: string, options?: RawAxiosRequestConfig): AxiosPromise<Subscription>;
/**
* Pauses an active subscription, temporarily halting the billing cycle. **Pause Effects**: - Billing is immediately suspended - The subscription status changes to `PAUSED` - No charges will be processed while the subscription remains paused - The current billing period end date remains unchanged **Use Cases**: - Temporary service interruptions - Customer vacation or absence periods - Account maintenance or dispute resolution To resume billing, use the [resume endpoint](https://docs.monei.com/apis/rest/subscriptions-resume/).
* @summary Pause Subscription
* @param {string} id The subscription ID
* @param {PauseSubscriptionRequest} [pauseSubscriptionRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
pause(id: string, pauseSubscriptionRequest?: PauseSubscriptionRequest, options?: RawAxiosRequestConfig): AxiosPromise<Subscription>;
/**
* Resumes a previously paused subscription, reactivating the billing cycle. **Resume Effects**: - Billing is immediately reactivated - The subscription status changes from `PAUSED` to `ACTIVE` - The next billing date is recalculated based on the current date - Regular charging schedule resumes according to the subscription interval **Important Notes**: - No immediate charge is created when resuming (billing continues on next scheduled date) - Any pause duration is added to the current billing period, maintaining the expected number of billing cycles - If a significant time has passed, verify that the payment method is still valid
* @summary Resume Subscription
* @param {string} id The subscription ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
resume(id: string, options?: RawAxiosRequestConfig): AxiosPromise<Subscription>;
/**
* Sends a subscription activation link to the customer through their preferred communication channel. **This API can only be used for subscriptions 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 subscription activation link allows customers to complete their subscription setup by providing payment details on the secure MONEI payment page. If no customer contact information is provided, the system will use the details stored in the subscription record.
* @summary Send Subscription Link
* @param {string} id The subscription ID
* @param {SendSubscriptionLinkRequest} [sendSubscriptionLinkRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
sendLink(id: string, sendSubscriptionLinkRequest?: SendSubscriptionLinkRequest, options?: RawAxiosRequestConfig): AxiosPromise<Subscription>;
/**
* Sends subscription status information to the customer through their preferred communication channel. **This API can only be used for subscriptions with the following statuses:** - Active - Trialing - Past due **Delivery channels are automatically selected based on available customer information:** - If customer email is available: Status is sent via email - If customer phone is available: Status is sent via WhatsApp - If WhatsApp delivery fails: Status is sent via SMS as a fallback The status notification includes subscription details such as current status, upcoming payments, and recent changes. If no customer contact information is provided, the system will use the details stored in the subscription record. **Email notifications include contextual action links based on subscription status:** - For past due subscriptions: A link to reactivate the subscription - For active and trialing subscriptions: A link to update the payment method You can specify the customer\'s email or phone number, the preferred communication channel (email or SMS), and the language for the message.
* @summary Send Subscription Status
* @param {string} id The subscription ID
* @param {SendSubscriptionStatusRequest} [sendSubscriptionStatusRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
sendStatus(id: string, sendSubscriptionStatusRequest?: SendSubscriptionStatusRequest, options?: RawAxiosRequestConfig): AxiosPromise<Subscription>;
/**
* Updates the configuration of an existing subscription. **Modifiable Parameters**: - Billing information (amount, description) - Customer details (contact information, billing/shipping addresses) - Subscription settings (cancelAtPeriodEnd, pauseAtPeriodEnd) - Metadata (for your internal tracking) **Update Effects**: - Amount changes apply to the next billing cycle - Customer information updates take effect immediately - Setting `cancelAtPeriodEnd` to true will end the subscription after the current period - Setting `pauseAtPeriodEnd` to true will pause billing after the current period **Note**: Some fundamental properties cannot be changed once a subscription is created, including currency and billing interval. To modify these, you would need to cancel the existing subscription and create a new one.
* @summary Update Subscription
* @param {string} id The subscription ID
* @param {UpdateSubscriptionRequest} updateSubscriptionRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
update(id: string, updateSubscriptionRequest: UpdateSubscriptionRequest, options?: RawAxiosRequestConfig): AxiosPromise<Subscription>;
};
/**
* SubscriptionsApi - object-oriented interface
* @export
* @class SubscriptionsApi
* @extends {BaseAPI}
*/
export declare class SubscriptionsApi extends BaseAPI {
/**
* Activates a subscription by attaching a payment method and initiating the billing cycle. **Activation Process**: 1. This endpoint transitions a `PENDING` subscription to `ACTIVE` status 2. An initial payment is created to validate the payment method: - For regular subscriptions: First billing cycle payment is processed immediately - For trial subscriptions: A zero-amount payment is created to verify the payment method **Payment Method Updates**: If the subscription is already active, this endpoint can be used to update the payment method. The update process creates a zero-amount payment to verify the new payment method works correctly. **Important Notes**: - Subscription billing begins immediately upon successful activation (unless in trial period) - The payment method provided will be used for all future recurring charges - Activation failures (due to invalid payment method) will keep the subscription in `PENDING` status
* @summary Activate Subscription
* @param {string} id The subscription ID
* @param {ActivateSubscriptionRequest} [activateSubscriptionRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof SubscriptionsApi
*/
activate(id: string, activateSubscriptionRequest?: ActivateSubscriptionRequest, options?: RawAxiosRequestConfig): Promise<Payment>;
/**
* Cancels an active subscription, permanently stopping the billing cycle. **Cancellation Effects**: - The subscription status changes to `CANCELED` - No further charges will be processed - Access to subscription services typically ends immediately or at period end (depending on your business rules) **Important Notes**: - Cancellation is permanent and cannot be undone - To restart service, a new subscription must be created - Consider using `pauseAtPeriodEnd` or `cancelAtPeriodEnd` for softer transitions Use this endpoint when a customer wishes to completely terminate their subscription.
* @summary Cancel Subscription
* @param {string} id The subscription ID
* @param {CancelSubscriptionRequest} [cancelSubscriptionRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof SubscriptionsApi
*/
cancel(id: string, cancelSubscriptionRequest?: CancelSubscriptionRequest, options?: RawAxiosRequestConfig): Promise<Subscription>;
/**
* Creates a new subscription with the specified parameters. **Subscription Lifecycle**: 1. When first created, the subscription has a `PENDING` status 2. To initiate billing, you must call the [activate endpoint](https://docs.monei.com/apis/rest/subscriptions-activate/) with payment details 3. Once activated, the subscription will automatically bill according to the configured interval **Key Configuration Parameters**: - **Billing settings**: Amount, currency, interval (daily, weekly, monthly, yearly) - **Schedule customization**: Interval count, trial period duration - **Customer information**: Contact details, billing and shipping addresses - **Communication**: Callback URLs for webhook notifications about subscription events **Best Practices**: - Set clear, descriptive names for subscriptions to help with identification - Configure appropriate webhook notifications to monitor subscription status changes - Consider offering trial periods to increase customer conversion rates - Use metadata to store additional information relevant to your business logic
* @summary Create Subscription
* @param {CreateSubscriptionRequest} createSubscriptionRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof SubscriptionsApi
*/
create(createSubscriptionRequest: CreateSubscriptionRequest, options?: RawAxiosRequestConfig): Promise<Subscription>;
/**
* Retrieves the complete details of an existing subscription by its unique ID. This endpoint returns comprehensive information about the subscription, including: - Current status and lifecycle details (active, paused, canceled) - Billing configuration (amount, currency, interval) - Schedule information (current period, next payment date) - Customer and payment method details - Payment history (including last payment status) - Trial period information (if applicable) Use this endpoint to check subscription status, verify billing details, or retrieve information needed for customer support inquiries.
* @summary Get Subscription
* @param {string} id The subscription ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof SubscriptionsApi
*/
get(id: string, options?: RawAxiosRequestConfig): Promise<Subscription>;
/**
* Pauses an active subscription, temporarily halting the billing cycle. **Pause Effects**: - Billing is immediately suspended - The subscription status changes to `PAUSED` - No charges will be processed while the subscription remains paused - The current billing period end date remains unchanged **Use Cases**: - Temporary service interruptions - Customer vacation or absence periods - Account maintenance or dispute resolution To resume billing, use the [resume endpoint](https://docs.monei.com/apis/rest/subscriptions-resume/).
* @summary Pause Subscription
* @param {string} id The subscription ID
* @param {PauseSubscriptionRequest} [pauseSubscriptionRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof SubscriptionsApi
*/
pause(id: string, pauseSubscriptionRequest?: PauseSubscriptionRequest, options?: RawAxiosRequestConfig): Promise<Subscription>;
/**
* Resumes a previously paused subscription, reactivating the billing cycle. **Resume Effects**: - Billing is immediately reactivated - The subscription status changes from `PAUSED` to `ACTIVE` - The next billing date is recalculated based on the current date - Regular charging schedule resumes according to the subscription interval **Important Notes**: - No immediate charge is created when resuming (billing continues on next scheduled date) - Any pause duration is added to the current billing period, maintaining the expected number of billing cycles - If a significant time has passed, verify that the payment method is still valid
* @summary Resume Subscription
* @param {string} id The subscription ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof SubscriptionsApi
*/
resume(id: string, options?: RawAxiosRequestConfig): Promise<Subscription>;
/**
* Sends a subscription activation link to the customer through their preferred communication channel. **This API can only be used for subscriptions 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 subscription activation link allows customers to complete their subscription setup by providing payment details on the secure MONEI payment page. If no customer contact information is provided, the system will use the details stored in the subscription record.
* @summary Send Subscription Link
* @param {string} id The subscription ID
* @param {SendSubscriptionLinkRequest} [sendSubscriptionLinkRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof SubscriptionsApi
*/
sendLink(id: string, sendSubscriptionLinkRequest?: SendSubscriptionLinkRequest, options?: RawAxiosRequestConfig): Promise<Subscription>;
/**
* Sends subscription status information to the customer through their preferred communication channel. **This API can only be used for subscriptions with the following statuses:** - Active - Trialing - Past due **Delivery channels are automatically selected based on available customer information:** - If customer email is available: Status is sent via email - If customer phone is available: Status is sent via WhatsApp - If WhatsApp delivery fails: Status is sent via SMS as a fallback The status notification includes subscription details such as current status, upcoming payments, and recent changes. If no customer contact information is provided, the system will use the details stored in the subscription record. **Email notifications include contextual action links based on subscription status:** - For past due subscriptions: A link to reactivate the subscription - For active and trialing subscriptions: A link to update the payment method You can specify the customer\'s email or phone number, the preferred communication channel (email or SMS), and the language for the message.
* @summary Send Subscription Status
* @param {string} id The subscription ID
* @param {SendSubscriptionStatusRequest} [sendSubscriptionStatusRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof SubscriptionsApi
*/
sendStatus(id: string, sendSubscriptionStatusRequest?: SendSubscriptionStatusRequest, options?: RawAxiosRequestConfig): Promise<Subscription>;
/**
* Updates the configuration of an existing subscription. **Modifiable Parameters**: - Billing information (amount, description) - Customer details (contact information, billing/shipping addresses) - Subscription settings (cancelAtPeriodEnd, pauseAtPeriodEnd) - Metadata (for your internal tracking) **Update Effects**: - Amount changes apply to the next billing cycle - Customer information updates take effect immediately - Setting `cancelAtPeriodEnd` to true will end the subscription after the current period - Setting `pauseAtPeriodEnd` to true will pause billing after the current period **Note**: Some fundamental properties cannot be changed once a subscription is created, including currency and billing interval. To modify these, you would need to cancel the existing subscription and create a new one.
* @summary Update Subscription
* @param {string} id The subscription ID
* @param {UpdateSubscriptionRequest} updateSubscriptionRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof SubscriptionsApi
*/
update(id: string, updateSubscriptionRequest: UpdateSubscriptionRequest, options?: RawAxiosRequestConfig): Promise<Subscription>;
}