UNPKG

@monei-js/node-sdk

Version:

Node.js SDK for MONEI Digital Payment Gateway

243 lines (242 loc) 26 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 { ActivateApplePayCertificateRequest } from '../model'; import type { ApplePayCertificate } from '../model'; import type { ApplePayCertificatesRemove200Response } from '../model'; import type { UpdateApplePayCertificateRequest } from '../model'; /** * ApplePayCertificateApi - axios parameter creator * @export */ export declare const ApplePayCertificateApiAxiosParamCreator: (configuration?: Configuration) => { /** * Activates an Apple Pay certificate by uploading the signed certificate from Apple. After creating a certificate in the Apple Developer Portal using your CSR, download the signed certificate and upload it here to activate payment processing. ## Activation process 1. Ensure you have downloaded the signed certificate (`.cer` file) from Apple Developer Portal. 2. Convert the certificate to base64: ```bash base64 -i apple_pay.cer ``` 3. Call this endpoint with the base64-encoded certificate in the `cert` field. ## Validation The certificate is validated to ensure: - It matches the private key generated when creating the CSR - It has a valid expiration date Once activated, the certificate becomes available for decrypting Apple Pay payment tokens in your iOS app. ## Notes - A certificate can only be activated once. - The CSR is cleared after successful activation. - The expiration date is extracted and stored for monitoring. * @summary Activate Certificate * @param {string} id The unique identifier of the certificate. * @param {ActivateApplePayCertificateRequest} activateApplePayCertificateRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ activate: (id: string, activateApplePayCertificateRequest: ActivateApplePayCertificateRequest, options?: RawAxiosRequestConfig) => Promise<RequestArgs>; /** * Creates a new Apple Pay certificate by generating a Certificate Signing Request (CSR). Use this endpoint to start the certificate creation process for accepting Apple Pay in your iOS app. ## Setup workflow 1. **Call this endpoint** to generate a CSR. The response includes the `csr` field in base64 format. 2. **Decode the CSR** and save it as a `.certSigningRequest` file: ```bash echo \"CSR_VALUE\" | base64 -d > apple_pay.certSigningRequest ``` 3. **Go to [Apple Developer Portal](https://developer.apple.com/account/resources/certificates/list)**: - Navigate to Certificates, Identifiers & Profiles - Select your Merchant ID under Identifiers - In the \"Apple Pay Payment Processing Certificate\" section, click \"Create Certificate\" - Upload the `.certSigningRequest` file from step 2 - Download the signed certificate (`.cer` file) 4. **Convert the certificate to base64**: ```bash base64 -i apple_pay.cer ``` 5. **Activate the certificate** using the [Activate Certificate](https://docs.monei.com/apis/rest/apple-pay-certificates-activate/) endpoint with the base64 value. ## Important notes - **CSRs expire after 24 hours.** Complete the certificate creation in Apple Developer Portal within this window, or generate a new CSR. - Each CSR can only be used once. If you need a new certificate, create a new CSR. - The private key is securely generated and stored by MONEI. You never need to handle private keys directly. - You must be enrolled in the [Apple Developer Program](https://developer.apple.com/programs/) to create certificates. - The CSR is cleared from the response after the certificate is activated. * @summary Create Certificate * @param {*} [options] Override http request option. * @throws {RequiredError} */ create: (options?: RawAxiosRequestConfig) => Promise<RequestArgs>; /** * Retrieves a specific Apple Pay certificate by its ID. Returns the certificate object with its current status, CSR (if not yet activated), and expiration date (if activated). * @summary Get Certificate * @param {string} id The unique identifier of the certificate. * @param {*} [options] Override http request option. * @throws {RequiredError} */ get: (id: string, options?: RawAxiosRequestConfig) => Promise<RequestArgs>; /** * Retrieves all Apple Pay certificates for your account. Returns an array of certificate objects, including both active and inactive certificates. Use this to view all certificates and their status. * @summary List Certificates * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAll: (options?: RawAxiosRequestConfig) => Promise<RequestArgs>; /** * Deletes an Apple Pay certificate. This permanently removes the certificate and its associated private key. The certificate will no longer be available for payment processing. **Warning**: This action cannot be undone. If you only want to temporarily disable a certificate, use the [Update Certificate](https://docs.monei.com/apis/rest/apple-pay-certificates-update/) endpoint instead. * @summary Delete Certificate * @param {string} id The unique identifier of the certificate. * @param {*} [options] Override http request option. * @throws {RequiredError} */ remove: (id: string, options?: RawAxiosRequestConfig) => Promise<RequestArgs>; /** * Updates an Apple Pay certificate\'s active status. Use this endpoint to enable or disable a certificate. Disabling a certificate prevents it from being used for payment token decryption while keeping it available for future use. * @summary Update Certificate * @param {string} id The unique identifier of the certificate. * @param {UpdateApplePayCertificateRequest} updateApplePayCertificateRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ update: (id: string, updateApplePayCertificateRequest: UpdateApplePayCertificateRequest, options?: RawAxiosRequestConfig) => Promise<RequestArgs>; }; /** * ApplePayCertificateApi - functional programming interface * @export */ export declare const ApplePayCertificateApiFp: (configuration?: Configuration) => { /** * Activates an Apple Pay certificate by uploading the signed certificate from Apple. After creating a certificate in the Apple Developer Portal using your CSR, download the signed certificate and upload it here to activate payment processing. ## Activation process 1. Ensure you have downloaded the signed certificate (`.cer` file) from Apple Developer Portal. 2. Convert the certificate to base64: ```bash base64 -i apple_pay.cer ``` 3. Call this endpoint with the base64-encoded certificate in the `cert` field. ## Validation The certificate is validated to ensure: - It matches the private key generated when creating the CSR - It has a valid expiration date Once activated, the certificate becomes available for decrypting Apple Pay payment tokens in your iOS app. ## Notes - A certificate can only be activated once. - The CSR is cleared after successful activation. - The expiration date is extracted and stored for monitoring. * @summary Activate Certificate * @param {string} id The unique identifier of the certificate. * @param {ActivateApplePayCertificateRequest} activateApplePayCertificateRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ activate(id: string, activateApplePayCertificateRequest: ActivateApplePayCertificateRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApplePayCertificate>>; /** * Creates a new Apple Pay certificate by generating a Certificate Signing Request (CSR). Use this endpoint to start the certificate creation process for accepting Apple Pay in your iOS app. ## Setup workflow 1. **Call this endpoint** to generate a CSR. The response includes the `csr` field in base64 format. 2. **Decode the CSR** and save it as a `.certSigningRequest` file: ```bash echo \"CSR_VALUE\" | base64 -d > apple_pay.certSigningRequest ``` 3. **Go to [Apple Developer Portal](https://developer.apple.com/account/resources/certificates/list)**: - Navigate to Certificates, Identifiers & Profiles - Select your Merchant ID under Identifiers - In the \"Apple Pay Payment Processing Certificate\" section, click \"Create Certificate\" - Upload the `.certSigningRequest` file from step 2 - Download the signed certificate (`.cer` file) 4. **Convert the certificate to base64**: ```bash base64 -i apple_pay.cer ``` 5. **Activate the certificate** using the [Activate Certificate](https://docs.monei.com/apis/rest/apple-pay-certificates-activate/) endpoint with the base64 value. ## Important notes - **CSRs expire after 24 hours.** Complete the certificate creation in Apple Developer Portal within this window, or generate a new CSR. - Each CSR can only be used once. If you need a new certificate, create a new CSR. - The private key is securely generated and stored by MONEI. You never need to handle private keys directly. - You must be enrolled in the [Apple Developer Program](https://developer.apple.com/programs/) to create certificates. - The CSR is cleared from the response after the certificate is activated. * @summary Create Certificate * @param {*} [options] Override http request option. * @throws {RequiredError} */ create(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApplePayCertificate>>; /** * Retrieves a specific Apple Pay certificate by its ID. Returns the certificate object with its current status, CSR (if not yet activated), and expiration date (if activated). * @summary Get Certificate * @param {string} id The unique identifier of the certificate. * @param {*} [options] Override http request option. * @throws {RequiredError} */ get(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApplePayCertificate>>; /** * Retrieves all Apple Pay certificates for your account. Returns an array of certificate objects, including both active and inactive certificates. Use this to view all certificates and their status. * @summary List Certificates * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAll(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<ApplePayCertificate>>>; /** * Deletes an Apple Pay certificate. This permanently removes the certificate and its associated private key. The certificate will no longer be available for payment processing. **Warning**: This action cannot be undone. If you only want to temporarily disable a certificate, use the [Update Certificate](https://docs.monei.com/apis/rest/apple-pay-certificates-update/) endpoint instead. * @summary Delete Certificate * @param {string} id The unique identifier of the certificate. * @param {*} [options] Override http request option. * @throws {RequiredError} */ remove(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApplePayCertificatesRemove200Response>>; /** * Updates an Apple Pay certificate\'s active status. Use this endpoint to enable or disable a certificate. Disabling a certificate prevents it from being used for payment token decryption while keeping it available for future use. * @summary Update Certificate * @param {string} id The unique identifier of the certificate. * @param {UpdateApplePayCertificateRequest} updateApplePayCertificateRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ update(id: string, updateApplePayCertificateRequest: UpdateApplePayCertificateRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApplePayCertificate>>; }; /** * ApplePayCertificateApi - factory interface * @export */ export declare const ApplePayCertificateApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => { /** * Activates an Apple Pay certificate by uploading the signed certificate from Apple. After creating a certificate in the Apple Developer Portal using your CSR, download the signed certificate and upload it here to activate payment processing. ## Activation process 1. Ensure you have downloaded the signed certificate (`.cer` file) from Apple Developer Portal. 2. Convert the certificate to base64: ```bash base64 -i apple_pay.cer ``` 3. Call this endpoint with the base64-encoded certificate in the `cert` field. ## Validation The certificate is validated to ensure: - It matches the private key generated when creating the CSR - It has a valid expiration date Once activated, the certificate becomes available for decrypting Apple Pay payment tokens in your iOS app. ## Notes - A certificate can only be activated once. - The CSR is cleared after successful activation. - The expiration date is extracted and stored for monitoring. * @summary Activate Certificate * @param {string} id The unique identifier of the certificate. * @param {ActivateApplePayCertificateRequest} activateApplePayCertificateRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ activate(id: string, activateApplePayCertificateRequest: ActivateApplePayCertificateRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApplePayCertificate>; /** * Creates a new Apple Pay certificate by generating a Certificate Signing Request (CSR). Use this endpoint to start the certificate creation process for accepting Apple Pay in your iOS app. ## Setup workflow 1. **Call this endpoint** to generate a CSR. The response includes the `csr` field in base64 format. 2. **Decode the CSR** and save it as a `.certSigningRequest` file: ```bash echo \"CSR_VALUE\" | base64 -d > apple_pay.certSigningRequest ``` 3. **Go to [Apple Developer Portal](https://developer.apple.com/account/resources/certificates/list)**: - Navigate to Certificates, Identifiers & Profiles - Select your Merchant ID under Identifiers - In the \"Apple Pay Payment Processing Certificate\" section, click \"Create Certificate\" - Upload the `.certSigningRequest` file from step 2 - Download the signed certificate (`.cer` file) 4. **Convert the certificate to base64**: ```bash base64 -i apple_pay.cer ``` 5. **Activate the certificate** using the [Activate Certificate](https://docs.monei.com/apis/rest/apple-pay-certificates-activate/) endpoint with the base64 value. ## Important notes - **CSRs expire after 24 hours.** Complete the certificate creation in Apple Developer Portal within this window, or generate a new CSR. - Each CSR can only be used once. If you need a new certificate, create a new CSR. - The private key is securely generated and stored by MONEI. You never need to handle private keys directly. - You must be enrolled in the [Apple Developer Program](https://developer.apple.com/programs/) to create certificates. - The CSR is cleared from the response after the certificate is activated. * @summary Create Certificate * @param {*} [options] Override http request option. * @throws {RequiredError} */ create(options?: RawAxiosRequestConfig): AxiosPromise<ApplePayCertificate>; /** * Retrieves a specific Apple Pay certificate by its ID. Returns the certificate object with its current status, CSR (if not yet activated), and expiration date (if activated). * @summary Get Certificate * @param {string} id The unique identifier of the certificate. * @param {*} [options] Override http request option. * @throws {RequiredError} */ get(id: string, options?: RawAxiosRequestConfig): AxiosPromise<ApplePayCertificate>; /** * Retrieves all Apple Pay certificates for your account. Returns an array of certificate objects, including both active and inactive certificates. Use this to view all certificates and their status. * @summary List Certificates * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAll(options?: RawAxiosRequestConfig): AxiosPromise<Array<ApplePayCertificate>>; /** * Deletes an Apple Pay certificate. This permanently removes the certificate and its associated private key. The certificate will no longer be available for payment processing. **Warning**: This action cannot be undone. If you only want to temporarily disable a certificate, use the [Update Certificate](https://docs.monei.com/apis/rest/apple-pay-certificates-update/) endpoint instead. * @summary Delete Certificate * @param {string} id The unique identifier of the certificate. * @param {*} [options] Override http request option. * @throws {RequiredError} */ remove(id: string, options?: RawAxiosRequestConfig): AxiosPromise<ApplePayCertificatesRemove200Response>; /** * Updates an Apple Pay certificate\'s active status. Use this endpoint to enable or disable a certificate. Disabling a certificate prevents it from being used for payment token decryption while keeping it available for future use. * @summary Update Certificate * @param {string} id The unique identifier of the certificate. * @param {UpdateApplePayCertificateRequest} updateApplePayCertificateRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ update(id: string, updateApplePayCertificateRequest: UpdateApplePayCertificateRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApplePayCertificate>; }; /** * ApplePayCertificateApi - object-oriented interface * @export * @class ApplePayCertificateApi * @extends {BaseAPI} */ export declare class ApplePayCertificateApi extends BaseAPI { /** * Activates an Apple Pay certificate by uploading the signed certificate from Apple. After creating a certificate in the Apple Developer Portal using your CSR, download the signed certificate and upload it here to activate payment processing. ## Activation process 1. Ensure you have downloaded the signed certificate (`.cer` file) from Apple Developer Portal. 2. Convert the certificate to base64: ```bash base64 -i apple_pay.cer ``` 3. Call this endpoint with the base64-encoded certificate in the `cert` field. ## Validation The certificate is validated to ensure: - It matches the private key generated when creating the CSR - It has a valid expiration date Once activated, the certificate becomes available for decrypting Apple Pay payment tokens in your iOS app. ## Notes - A certificate can only be activated once. - The CSR is cleared after successful activation. - The expiration date is extracted and stored for monitoring. * @summary Activate Certificate * @param {string} id The unique identifier of the certificate. * @param {ActivateApplePayCertificateRequest} activateApplePayCertificateRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ApplePayCertificateApi */ activate(id: string, activateApplePayCertificateRequest: ActivateApplePayCertificateRequest, options?: RawAxiosRequestConfig): Promise<ApplePayCertificate>; /** * Creates a new Apple Pay certificate by generating a Certificate Signing Request (CSR). Use this endpoint to start the certificate creation process for accepting Apple Pay in your iOS app. ## Setup workflow 1. **Call this endpoint** to generate a CSR. The response includes the `csr` field in base64 format. 2. **Decode the CSR** and save it as a `.certSigningRequest` file: ```bash echo \"CSR_VALUE\" | base64 -d > apple_pay.certSigningRequest ``` 3. **Go to [Apple Developer Portal](https://developer.apple.com/account/resources/certificates/list)**: - Navigate to Certificates, Identifiers & Profiles - Select your Merchant ID under Identifiers - In the \"Apple Pay Payment Processing Certificate\" section, click \"Create Certificate\" - Upload the `.certSigningRequest` file from step 2 - Download the signed certificate (`.cer` file) 4. **Convert the certificate to base64**: ```bash base64 -i apple_pay.cer ``` 5. **Activate the certificate** using the [Activate Certificate](https://docs.monei.com/apis/rest/apple-pay-certificates-activate/) endpoint with the base64 value. ## Important notes - **CSRs expire after 24 hours.** Complete the certificate creation in Apple Developer Portal within this window, or generate a new CSR. - Each CSR can only be used once. If you need a new certificate, create a new CSR. - The private key is securely generated and stored by MONEI. You never need to handle private keys directly. - You must be enrolled in the [Apple Developer Program](https://developer.apple.com/programs/) to create certificates. - The CSR is cleared from the response after the certificate is activated. * @summary Create Certificate * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ApplePayCertificateApi */ create(options?: RawAxiosRequestConfig): Promise<ApplePayCertificate>; /** * Retrieves a specific Apple Pay certificate by its ID. Returns the certificate object with its current status, CSR (if not yet activated), and expiration date (if activated). * @summary Get Certificate * @param {string} id The unique identifier of the certificate. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ApplePayCertificateApi */ get(id: string, options?: RawAxiosRequestConfig): Promise<ApplePayCertificate>; /** * Retrieves all Apple Pay certificates for your account. Returns an array of certificate objects, including both active and inactive certificates. Use this to view all certificates and their status. * @summary List Certificates * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ApplePayCertificateApi */ getAll(options?: RawAxiosRequestConfig): Promise<ApplePayCertificate[]>; /** * Deletes an Apple Pay certificate. This permanently removes the certificate and its associated private key. The certificate will no longer be available for payment processing. **Warning**: This action cannot be undone. If you only want to temporarily disable a certificate, use the [Update Certificate](https://docs.monei.com/apis/rest/apple-pay-certificates-update/) endpoint instead. * @summary Delete Certificate * @param {string} id The unique identifier of the certificate. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ApplePayCertificateApi */ remove(id: string, options?: RawAxiosRequestConfig): Promise<ApplePayCertificatesRemove200Response>; /** * Updates an Apple Pay certificate\'s active status. Use this endpoint to enable or disable a certificate. Disabling a certificate prevents it from being used for payment token decryption while keeping it available for future use. * @summary Update Certificate * @param {string} id The unique identifier of the certificate. * @param {UpdateApplePayCertificateRequest} updateApplePayCertificateRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ApplePayCertificateApi */ update(id: string, updateApplePayCertificateRequest: UpdateApplePayCertificateRequest, options?: RawAxiosRequestConfig): Promise<ApplePayCertificate>; }