UNPKG

@monei-js/node-sdk

Version:

Node.js SDK for MONEI Digital Payment Gateway

1 lines 387 kB
{"version":3,"file":"index.cjs","sources":["../src/base.ts","../src/common.ts","../src/api/apple-pay-certificate-api.ts","../src/api/apple-pay-domain-api.ts","../src/api/bizum-api.ts","../src/api/payment-methods-api.ts","../src/api/payments-api.ts","../src/api/subscriptions-api.ts","../src/configuration.ts","../src/model/payment-cancellation-reason.ts","../src/model/payment-last-refund-reason.ts","../src/model/payment-message-channel.ts","../src/model/payment-message-language.ts","../src/model/payment-next-action.ts","../src/model/payment-payment-method.ts","../src/model/payment-payment-method-card.ts","../src/model/payment-payment-method-klarna.ts","../src/model/payment-refund-reason.ts","../src/model/payment-sequence.ts","../src/model/payment-status.ts","../src/model/payment-transaction-type.ts","../src/model/send-subscription-link-request.ts","../src/model/send-subscription-status-request.ts","../src/model/subscription-interval.ts","../src/model/subscription-payment-method.ts","../src/model/subscription-payment-method-card.ts","../src/model/subscription-retry-schedule-inner.ts","../src/model/subscription-status.ts","../index.ts"],"sourcesContent":["/* tslint:disable */\n/* eslint-disable */\n/**\n * MONEI API v1\n * 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.\n *\n * The version of the OpenAPI document: 1.8.3\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\nimport type {Configuration} from './configuration';\n// Some imports not used depending on template conditions\n// @ts-ignore\nimport type {AxiosPromise, AxiosInstance, RawAxiosRequestConfig} from './axios';\nimport globalAxios from 'axios';\n\nexport const BASE_PATH = 'https://api.monei.com/v1'.replace(/\\/+$/, '');\n\n/**\n *\n * @export\n */\nexport const COLLECTION_FORMATS = {\n csv: ',',\n ssv: ' ',\n tsv: '\\t',\n pipes: '|'\n};\n\n/**\n *\n * @export\n * @interface RequestArgs\n */\nexport interface RequestArgs {\n url: string;\n options: RawAxiosRequestConfig;\n}\n\n/**\n *\n * @export\n * @class BaseAPI\n */\nexport class BaseAPI {\n protected configuration: Configuration | undefined;\n\n constructor(\n configuration?: Configuration,\n protected basePath: string = BASE_PATH,\n protected axios: AxiosInstance = globalAxios\n ) {\n if (configuration) {\n this.configuration = configuration;\n this.basePath = configuration.basePath ?? basePath;\n }\n }\n}\n\n/**\n *\n * @export\n * @class RequiredError\n * @extends {Error}\n */\nexport class RequiredError extends Error {\n constructor(\n public field: string,\n msg?: string\n ) {\n super(msg);\n this.name = 'RequiredError';\n }\n}\n\ninterface ServerMap {\n [key: string]: {\n url: string;\n description: string;\n }[];\n}\n\n/**\n *\n * @export\n */\nexport const operationServerMap: ServerMap = {};\n","/* tslint:disable */\n/* eslint-disable */\n/**\n * MONEI API v1\n * 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.\n *\n * The version of the OpenAPI document: 1.8.3\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\nimport type {Configuration} from './configuration';\nimport type {RequestArgs} from './base';\nimport type {AxiosInstance, AxiosResponse} from 'axios';\nimport {RequiredError} from './base';\n\n/**\n *\n * @export\n */\nexport const DUMMY_BASE_URL = 'https://example.com';\n\n/**\n *\n * @throws {RequiredError}\n * @export\n */\nexport const assertParamExists = function (\n functionName: string,\n paramName: string,\n paramValue: unknown\n) {\n if (paramValue === null || paramValue === undefined) {\n throw new RequiredError(\n paramName,\n `Required parameter ${paramName} was null or undefined when calling ${functionName}.`\n );\n }\n};\n\n/**\n *\n * @export\n */\nexport const setApiKeyToObject = async function (\n object: any,\n keyParamName: string,\n configuration?: Configuration\n) {\n if (configuration && configuration.apiKey) {\n const localVarApiKeyValue =\n typeof configuration.apiKey === 'function'\n ? await configuration.apiKey(keyParamName)\n : await configuration.apiKey;\n object[keyParamName] = localVarApiKeyValue;\n }\n};\n\n/**\n *\n * @export\n */\nexport const setBasicAuthToObject = function (object: any, configuration?: Configuration) {\n if (configuration && (configuration.username || configuration.password)) {\n object['auth'] = {username: configuration.username, password: configuration.password};\n }\n};\n\n/**\n *\n * @export\n */\nexport const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {\n if (configuration && configuration.accessToken) {\n const accessToken =\n typeof configuration.accessToken === 'function'\n ? await configuration.accessToken()\n : await configuration.accessToken;\n object['Authorization'] = 'Bearer ' + accessToken;\n }\n};\n\n/**\n *\n * @export\n */\nexport const setOAuthToObject = async function (\n object: any,\n name: string,\n scopes: string[],\n configuration?: Configuration\n) {\n if (configuration && configuration.accessToken) {\n const localVarAccessTokenValue =\n typeof configuration.accessToken === 'function'\n ? await configuration.accessToken(name, scopes)\n : await configuration.accessToken;\n object['Authorization'] = 'Bearer ' + localVarAccessTokenValue;\n }\n};\n\nfunction setFlattenedQueryParams(\n urlSearchParams: URLSearchParams,\n parameter: any,\n key: string = ''\n): void {\n if (parameter == null) return;\n if (typeof parameter === 'object') {\n if (Array.isArray(parameter)) {\n (parameter as any[]).forEach((item) => setFlattenedQueryParams(urlSearchParams, item, key));\n } else {\n Object.keys(parameter).forEach((currentKey) =>\n setFlattenedQueryParams(\n urlSearchParams,\n parameter[currentKey],\n `${key}${key !== '' ? '.' : ''}${currentKey}`\n )\n );\n }\n } else {\n if (urlSearchParams.has(key)) {\n urlSearchParams.append(key, parameter);\n } else {\n urlSearchParams.set(key, parameter);\n }\n }\n}\n\n/**\n *\n * @export\n */\nexport const setSearchParams = function (url: URL, ...objects: any[]) {\n const searchParams = new URLSearchParams(url.search);\n setFlattenedQueryParams(searchParams, objects);\n url.search = searchParams.toString();\n};\n\n/**\n *\n * @export\n */\nexport const serializeDataIfNeeded = function (\n value: any,\n requestOptions: any,\n configuration?: Configuration\n) {\n const nonString = typeof value !== 'string';\n const needsSerialization =\n nonString && configuration && configuration.isJsonMime\n ? configuration.isJsonMime(requestOptions.headers['Content-Type'])\n : nonString;\n return needsSerialization ? JSON.stringify(value !== undefined ? value : {}) : value || '';\n};\n\n/**\n *\n * @export\n */\nexport const toPathString = function (url: URL) {\n return url.pathname + url.search + url.hash;\n};\n\n/**\n *\n * @export\n */\nexport const createRequestFunction = function (\n axiosArgs: RequestArgs,\n globalAxios: AxiosInstance,\n BASE_PATH: string,\n configuration?: Configuration\n) {\n return <T = unknown, R = AxiosResponse<T>>(\n axios: AxiosInstance = globalAxios,\n basePath: string = BASE_PATH\n ) => {\n const axiosRequestArgs = {\n ...axiosArgs.options,\n url: (axios.defaults.baseURL ? '' : (configuration?.basePath ?? basePath)) + axiosArgs.url\n };\n return axios.request<T, R>(axiosRequestArgs);\n };\n};\n","/* tslint:disable */\n/* eslint-disable */\n/**\n * MONEI API v1\n * 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.\n *\n * The version of the OpenAPI document: 1.8.3\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\nimport type {Configuration} from '../configuration';\nimport type {AxiosPromise, AxiosInstance, RawAxiosRequestConfig} from '../axios';\nimport globalAxios from 'axios';\n// Some imports not used depending on template conditions\n// @ts-ignore\nimport {\n DUMMY_BASE_URL,\n assertParamExists,\n setApiKeyToObject,\n setBasicAuthToObject,\n setBearerAuthToObject,\n setOAuthToObject,\n setSearchParams,\n serializeDataIfNeeded,\n toPathString,\n createRequestFunction\n} from '../common';\n// @ts-ignore\nimport {\n BASE_PATH,\n COLLECTION_FORMATS,\n type RequestArgs,\n BaseAPI,\n RequiredError,\n operationServerMap\n} from '../base';\n// @ts-ignore\nimport type {ActivateApplePayCertificateRequest} from '../model';\n// @ts-ignore\nimport type {ApplePayCertificate} from '../model';\n// @ts-ignore\nimport type {ApplePayCertificatesRemove200Response} from '../model';\n// @ts-ignore\nimport type {BadRequestError} from '../model';\n// @ts-ignore\nimport type {InternalServerError} from '../model';\n// @ts-ignore\nimport type {NotFoundError} from '../model';\n// @ts-ignore\nimport type {ServiceUnavailableError} from '../model';\n// @ts-ignore\nimport type {UnauthorizedError} from '../model';\n// @ts-ignore\nimport type {UnprocessableEntityError} from '../model';\n// @ts-ignore\nimport type {UpdateApplePayCertificateRequest} from '../model';\n/**\n * ApplePayCertificateApi - axios parameter creator\n * @export\n */\nexport const ApplePayCertificateApiAxiosParamCreator = function (configuration?: Configuration) {\n return {\n /**\n * 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.\n * @summary Activate Certificate\n * @param {string} id The unique identifier of the certificate.\n * @param {ActivateApplePayCertificateRequest} activateApplePayCertificateRequest\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n */\n activate: async (\n id: string,\n activateApplePayCertificateRequest: ActivateApplePayCertificateRequest,\n options: RawAxiosRequestConfig = {}\n ): Promise<RequestArgs> => {\n // verify required parameter 'id' is not null or undefined\n assertParamExists('activate', 'id', id);\n // verify required parameter 'activateApplePayCertificateRequest' is not null or undefined\n assertParamExists(\n 'activate',\n 'activateApplePayCertificateRequest',\n activateApplePayCertificateRequest\n );\n const localVarPath = `/apple-pay/certificates/{id}/activate`.replace(\n `{${'id'}}`,\n encodeURIComponent(String(id))\n );\n // use dummy base URL string because the URL constructor only accepts absolute URLs.\n const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);\n let baseOptions;\n if (configuration) {\n baseOptions = configuration.baseOptions;\n }\n\n const localVarRequestOptions = {method: 'POST', ...baseOptions, ...options};\n const localVarHeaderParameter = {} as any;\n const localVarQueryParameter = {} as any;\n\n // authentication APIKey required\n await setApiKeyToObject(localVarHeaderParameter, 'Authorization', configuration);\n\n localVarHeaderParameter['Content-Type'] = 'application/json';\n\n setSearchParams(localVarUrlObj, localVarQueryParameter);\n let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};\n localVarRequestOptions.headers = {\n ...localVarHeaderParameter,\n ...headersFromBaseOptions,\n ...options.headers\n };\n localVarRequestOptions.data = serializeDataIfNeeded(\n activateApplePayCertificateRequest,\n localVarRequestOptions,\n configuration\n );\n\n return {\n url: toPathString(localVarUrlObj),\n options: localVarRequestOptions\n };\n },\n /**\n * 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.\n * @summary Create Certificate\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n */\n create: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {\n const localVarPath = `/apple-pay/certificates`;\n // use dummy base URL string because the URL constructor only accepts absolute URLs.\n const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);\n let baseOptions;\n if (configuration) {\n baseOptions = configuration.baseOptions;\n }\n\n const localVarRequestOptions = {method: 'POST', ...baseOptions, ...options};\n const localVarHeaderParameter = {} as any;\n const localVarQueryParameter = {} as any;\n\n // authentication APIKey required\n await setApiKeyToObject(localVarHeaderParameter, 'Authorization', configuration);\n\n setSearchParams(localVarUrlObj, localVarQueryParameter);\n let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};\n localVarRequestOptions.headers = {\n ...localVarHeaderParameter,\n ...headersFromBaseOptions,\n ...options.headers\n };\n\n return {\n url: toPathString(localVarUrlObj),\n options: localVarRequestOptions\n };\n },\n /**\n * 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).\n * @summary Get Certificate\n * @param {string} id The unique identifier of the certificate.\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n */\n get: async (id: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {\n // verify required parameter 'id' is not null or undefined\n assertParamExists('get', 'id', id);\n const localVarPath = `/apple-pay/certificates/{id}`.replace(\n `{${'id'}}`,\n encodeURIComponent(String(id))\n );\n // use dummy base URL string because the URL constructor only accepts absolute URLs.\n const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);\n let baseOptions;\n if (configuration) {\n baseOptions = configuration.baseOptions;\n }\n\n const localVarRequestOptions = {method: 'GET', ...baseOptions, ...options};\n const localVarHeaderParameter = {} as any;\n const localVarQueryParameter = {} as any;\n\n // authentication APIKey required\n await setApiKeyToObject(localVarHeaderParameter, 'Authorization', configuration);\n\n setSearchParams(localVarUrlObj, localVarQueryParameter);\n let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};\n localVarRequestOptions.headers = {\n ...localVarHeaderParameter,\n ...headersFromBaseOptions,\n ...options.headers\n };\n\n return {\n url: toPathString(localVarUrlObj),\n options: localVarRequestOptions\n };\n },\n /**\n * 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.\n * @summary List Certificates\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n */\n getAll: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {\n const localVarPath = `/apple-pay/certificates`;\n // use dummy base URL string because the URL constructor only accepts absolute URLs.\n const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);\n let baseOptions;\n if (configuration) {\n baseOptions = configuration.baseOptions;\n }\n\n const localVarRequestOptions = {method: 'GET', ...baseOptions, ...options};\n const localVarHeaderParameter = {} as any;\n const localVarQueryParameter = {} as any;\n\n // authentication APIKey required\n await setApiKeyToObject(localVarHeaderParameter, 'Authorization', configuration);\n\n setSearchParams(localVarUrlObj, localVarQueryParameter);\n let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};\n localVarRequestOptions.headers = {\n ...localVarHeaderParameter,\n ...headersFromBaseOptions,\n ...options.headers\n };\n\n return {\n url: toPathString(localVarUrlObj),\n options: localVarRequestOptions\n };\n },\n /**\n * 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.\n * @summary Delete Certificate\n * @param {string} id The unique identifier of the certificate.\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n */\n remove: async (id: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {\n // verify required parameter 'id' is not null or undefined\n assertParamExists('remove', 'id', id);\n const localVarPath = `/apple-pay/certificates/{id}`.replace(\n `{${'id'}}`,\n encodeURIComponent(String(id))\n );\n // use dummy base URL string because the URL constructor only accepts absolute URLs.\n const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);\n let baseOptions;\n if (configuration) {\n baseOptions = configuration.baseOptions;\n }\n\n const localVarRequestOptions = {method: 'DELETE', ...baseOptions, ...options};\n const localVarHeaderParameter = {} as any;\n const localVarQueryParameter = {} as any;\n\n // authentication APIKey required\n await setApiKeyToObject(localVarHeaderParameter, 'Authorization', configuration);\n\n setSearchParams(localVarUrlObj, localVarQueryParameter);\n let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};\n localVarRequestOptions.headers = {\n ...localVarHeaderParameter,\n ...headersFromBaseOptions,\n ...options.headers\n };\n\n return {\n url: toPathString(localVarUrlObj),\n options: localVarRequestOptions\n };\n },\n /**\n * 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.\n * @summary Update Certificate\n * @param {string} id The unique identifier of the certificate.\n * @param {UpdateApplePayCertificateRequest} updateApplePayCertificateRequest\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n */\n update: async (\n id: string,\n updateApplePayCertificateRequest: UpdateApplePayCertificateRequest,\n options: RawAxiosRequestConfig = {}\n ): Promise<RequestArgs> => {\n // verify required parameter 'id' is not null or undefined\n assertParamExists('update', 'id', id);\n // verify required parameter 'updateApplePayCertificateRequest' is not null or undefined\n assertParamExists(\n 'update',\n 'updateApplePayCertificateRequest',\n updateApplePayCertificateRequest\n );\n const localVarPath = `/apple-pay/certificates/{id}`.replace(\n `{${'id'}}`,\n encodeURIComponent(String(id))\n );\n // use dummy base URL string because the URL constructor only accepts absolute URLs.\n const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);\n let baseOptions;\n if (configuration) {\n baseOptions = configuration.baseOptions;\n }\n\n const localVarRequestOptions = {method: 'POST', ...baseOptions, ...options};\n const localVarHeaderParameter = {} as any;\n const localVarQueryParameter = {} as any;\n\n // authentication APIKey required\n await setApiKeyToObject(localVarHeaderParameter, 'Authorization', configuration);\n\n localVarHeaderParameter['Content-Type'] = 'application/json';\n\n setSearchParams(localVarUrlObj, localVarQueryParameter);\n let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};\n localVarRequestOptions.headers = {\n ...localVarHeaderParameter,\n ...headersFromBaseOptions,\n ...options.headers\n };\n localVarRequestOptions.data = serializeDataIfNeeded(\n updateApplePayCertificateRequest,\n localVarRequestOptions,\n configuration\n );\n\n return {\n url: toPathString(localVarUrlObj),\n options: localVarRequestOptions\n };\n }\n };\n};\n\n/**\n * ApplePayCertificateApi - functional programming interface\n * @export\n */\nexport const ApplePayCertificateApiFp = function (configuration?: Configuration) {\n const localVarAxiosParamCreator = ApplePayCertificateApiAxiosParamCreator(configuration);\n return {\n /**\n * 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.\n * @summary Activate Certificate\n * @param {string} id The unique identifier of the certificate.\n * @param {ActivateApplePayCertificateRequest} activateApplePayCertificateRequest\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n */\n async activate(\n id: string,\n activateApplePayCertificateRequest: ActivateApplePayCertificateRequest,\n options?: RawAxiosRequestConfig\n ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApplePayCertificate>> {\n const localVarAxiosArgs = await localVarAxiosParamCreator.activate(\n id,\n activateApplePayCertificateRequest,\n options\n );\n const localVarOperationServerIndex = configuration?.serverIndex ?? 0;\n const localVarOperationServerBasePath =\n operationServerMap['ApplePayCertificateApi.activate']?.[localVarOperationServerIndex]?.url;\n return (axios, basePath) =>\n createRequestFunction(\n localVarAxiosArgs,\n globalAxios,\n BASE_PATH,\n configuration\n )(axios, localVarOperationServerBasePath || basePath);\n },\n /**\n * 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.\n * @summary Create Certificate\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n */\n async create(\n options?: RawAxiosRequestConfig\n ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApplePayCertificate>> {\n const localVarAxiosArgs = await localVarAxiosParamCreator.create(options);\n const localVarOperationServerIndex = configuration?.serverIndex ?? 0;\n const localVarOperationServerBasePath =\n operationServerMap['ApplePayCertificateApi.create']?.[localVarOperationServerIndex]?.url;\n return (axios, basePath) =>\n createRequestFunction(\n localVarAxiosArgs,\n globalAxios,\n BASE_PATH,\n configuration\n )(axios, localVarOperationServerBasePath || basePath);\n },\n /**\n * 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).\n * @summary Get Certificate\n * @param {string} id The unique identifier of the certificate.\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n */\n async get(\n id: string,\n options?: RawAxiosRequestConfig\n ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApplePayCertificate>> {\n const localVarAxiosArgs = await localVarAxiosParamCreator.get(id, options);\n const localVarOperationServerIndex = configuration?.serverIndex ?? 0;\n const localVarOperationServerBasePath =\n operationServerMap['ApplePayCertificateApi.get']?.[localVarOperationServerIndex]?.url;\n return (axios, basePath) =>\n createRequestFunction(\n localVarAxiosArgs,\n globalAxios,\n BASE_PATH,\n configuration\n )(axios, localVarOperationServerBasePath || basePath);\n },\n /**\n * 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.\n * @summary List Certificates\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n */\n async getAll(\n options?: RawAxiosRequestConfig\n ): Promise<\n (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<ApplePayCertificate>>\n > {\n const localVarAxiosArgs = await localVarAxiosParamCreator.getAll(options);\n const localVarOperationServerIndex = configuration?.serverIndex ?? 0;\n const localVarOperationServerBasePath =\n operationServerMap['ApplePayCertificateApi.getAll']?.[localVarOperationServerIndex]?.url;\n return (axios, basePath) =>\n createRequestFunction(\n localVarAxiosArgs,\n globalAxios,\n BASE_PATH,\n configuration\n )(axios, localVarOperationServerBasePath || basePath);\n },\n /**\n * 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.\n * @summary Delete Certificate\n * @param {string} id The unique identifier of the certificate.\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n */\n async remove(\n id: string,\n options?: RawAxiosRequestConfig\n ): Promise<\n (\n axios?: AxiosInstance,\n basePath?: string\n ) => AxiosPromise<ApplePayCertificatesRemove200Response>\n > {\n const localVarAxiosArgs = await localVarAxiosParamCreator.remove(id, options);\n const localVarOperationServerIndex = configuration?.serverIndex ?? 0;\n const localVarOperationServerBasePath =\n operationServerMap['ApplePayCertificateApi.remove']?.[localVarOperationServerIndex]?.url;\n return (axios, basePath) =>\n createRequestFunction(\n localVarAxiosArgs,\n globalAxios,\n BASE_PATH,\n configuration\n )(axios, localVarOperationServerBasePath || basePath);\n },\n /**\n * 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.\n * @summary Update Certificate\n * @param {string} id The unique identifier of the certificate.\n * @param {UpdateApplePayCertificateRequest} updateApplePayCertificateRequest\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n */\n async update(\n id: string,\n updateApplePayCertificateRequest: UpdateApplePayCertificateRequest,\n options?: RawAxiosRequestConfig\n ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApplePayCertificate>> {\n const localVarAxiosArgs = await localVarAxiosParamCreator.update(\n id,\n updateApplePayCertificateRequest,\n options\n );\n const localVarOperationServerIndex = configuration?.serverIndex ?? 0;\n const localVarOperationServerBasePath =\n operationServerMap['ApplePayCertificateApi.update']?.[localVarOperationServerIndex]?.url;\n return (axios, basePath) =>\n createRequestFunction(\n localVarAxiosArgs,\n globalAxios,\n BASE_PATH,\n configuration\n )(axios, localVarOperationServerBasePath || basePath);\n }\n };\n};\n\n/**\n * ApplePayCertificateApi - factory interface\n * @export\n */\nexport const ApplePayCertificateApiFactory = function (\n configuration?: Configuration,\n basePath?: string,\n axios?: AxiosInstance\n) {\n const localVarFp = ApplePayCertificateApiFp(configuration);\n return {\n /**\n * 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.\n * @summary Activate Certificate\n * @param {string} id The unique identifier of the certificate.\n * @param {ActivateApplePayCertificateRequest} activateApplePayCertificateRequest\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n */\n activate(\n id: string,\n activateApplePayCertificateRequest: ActivateApplePayCertificateRequest,\n options?: RawAxiosRequestConfig\n ): AxiosPromise<ApplePayCertificate> {\n return localVarFp\n .activate(id, activateApplePayCertificateRequest, options)\n .then((request) => request(axios, basePath));\n },\n /**\n * 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.\n * @summary Create Certificate\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n */\n create(options?: RawAxiosRequestConfig): AxiosPromise<ApplePayCertificate> {\n return localVarFp.create(options).then((request) => request(axios, basePath));\n },\n /**\n * 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).\n * @summary Get Certificate\n * @param {string} id The unique identifier of the certificate.\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n */\n get(id: string, options?: RawAxiosRequestConfig): AxiosPromise<ApplePayCertificate> {\n return localVarFp.get(id, options).then((request) => request(axios, basePath));\n },\n /**\n * 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.\n * @summary List Certificates\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n */\n getAll(options?: RawAxiosRequestConfig): AxiosPromise<Array<ApplePayCertificate>> {\n return localVarFp.getAll(options).then((request) => request(axios, basePath));\n },\n /**\n * 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.\n * @summary Delete Certificate\n * @param {string} id The unique identifier of the certificate.\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n */\n remove(\n id: string,\n options?: RawAxiosRequestConfig\n ): AxiosPromise<ApplePayCertificatesRemove200Response> {\n return localVarFp.remove(id, options).then((request) => request(axios, basePath));\n },\n /**\n * 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.\n * @summary Update Certificate\n * @param {string} id The unique identifier of the certificate.\n * @param {UpdateApplePayCertificateRequest} updateApplePayCertificateRequest\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n */\n update(\n id: string,\n updateApplePayCertificateRequest: UpdateApplePayCertificateRequest,\n options?: RawAxiosRequestConfig\n ): AxiosPromise<ApplePayCertificate> {\n return localVarFp\n .update(id, updateApplePayCertificateRequest, options)\n .then((request) => request(axios, basePath));\n }\n };\n};\n\n/**\n * ApplePayCertificateApi - object-oriented interface\n * @export\n * @class ApplePayCertificateApi\n * @extends {BaseAPI}\n */\nexport class ApplePayCertificateApi extends BaseAPI {\n /**\n * 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.\n * @summary Activate Certificate\n * @param {string} id The unique identifier of the certificate.\n * @param {ActivateApplePayCertificateRequest} activateApplePayCertificateRequest\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n * @memberof ApplePayCertificateApi\n */\n public activate(\n id: string,\n activateApplePayCertificateRequest: ActivateApplePayCertificateRequest,\n options?: RawAxiosRequestConfig\n ) {\n return ApplePayCertificateApiFp(this.configuration)\n .activate(id, activateApplePayCertificateRequest, options)\n .then((request) => request(this.axios, this.basePath));\n }\n\n /**\n * 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.\n * @summary Create Certificate\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n * @memberof ApplePayCertificateApi\n */\n public create(options?: RawAxiosRequestConfig) {\n return ApplePayCertificateApiFp(this.configuration)\n .create(options)\n .then((request) => request(this.axios, this.basePath));\n }\n\n /**\n * 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).\n * @summary Get Certificate\n * @param {string} id The unique identifier of the certificate.\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n * @memberof ApplePayCertificateApi\n */\n public get(id: string, options?: RawAxiosRequestConfig) {\n return ApplePayCertificateApiFp(this.configuration)\n .get(id, options)\n .then((request) => request(this.axios, this.basePath));\n }\n\n /**\n * 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.\n * @summary List Certificates\n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n * @memberof ApplePayCertificateApi\n */\n public getAll(options?: RawAxiosRequestConfig) {\n return ApplePay