"""
    MONEI API v1

    <p>The MONEI API is organized around <a href=\"https://en.wikipedia.org/wiki/Representational_State_Transfer\">REST</a> principles. Our API is designed to be intuitive and developer-friendly.</p> <h3>Base URL</h3> <p>All API requests should be made to:</p> <pre><code>https://api.monei.com/v1 </code></pre> <h3>Environment</h3> <p>MONEI provides two environments:</p> <ul> <li><strong>Test Environment</strong>: For development and testing without processing real payments</li> <li><strong>Live Environment</strong>: For processing real transactions in production</li> </ul> <h3>Client Libraries</h3> <p>We provide official SDKs to simplify integration:</p> <ul> <li><a href=\"https://github.com/MONEI/monei-php-sdk\">PHP SDK</a></li> <li><a href=\"https://github.com/MONEI/monei-python-sdk\">Python SDK</a></li> <li><a href=\"https://github.com/MONEI/monei-node-sdk\">Node.js SDK</a></li> <li><a href=\"https://postman.monei.com/\">Postman Collection</a></li> </ul> <p>Our SDKs handle authentication, error handling, and request formatting automatically.</p> <p>You can download the OpenAPI specification from the <a href=\"https://js.monei.com/api/v1/openapi.json\">https://js.monei.com/api/v1/openapi.json</a> and generate your own client library using the <a href=\"https://openapi-generator.tech/\">OpenAPI Generator</a>.</p> <h3>Important Requirements</h3> <ul> <li>All API requests must be made over HTTPS</li> <li>If you are not using our official SDKs, you <strong>must provide a valid <code>User-Agent</code> header</strong> with each request</li> <li>Requests without proper authentication will return a <code>401 Unauthorized</code> error</li> </ul> <h3>Error Handling</h3> <p>The API returns consistent error codes and messages to help you troubleshoot issues. Each response includes a <code>statusCode</code> attribute indicating the outcome of your request.</p> <h3>Rate Limits</h3> <p>The API implements rate limiting to ensure stability. If you exceed the limits, requests will return a <code>429 Too Many Requests</code> status code.</p>   # noqa: E501

    The version of the OpenAPI document: 1.5.4
    Generated by: https://openapi-generator.tech
"""


import re  # noqa: F401
import sys  # noqa: F401

from Monei.api_client import ApiClient, Endpoint as _Endpoint
from Monei.model_utils import (  # noqa: F401
    check_allowed_values,
    check_validations,
    date,
    datetime,
    file_type,
    none_type,
    validate_and_convert_types
)
from Monei.model.apple_pay_domain_register400_response import ApplePayDomainRegister400Response
from Monei.model.apple_pay_domain_register401_response import ApplePayDomainRegister401Response
from Monei.model.apple_pay_domain_register404_response import ApplePayDomainRegister404Response
from Monei.model.apple_pay_domain_register422_response import ApplePayDomainRegister422Response
from Monei.model.apple_pay_domain_register500_response import ApplePayDomainRegister500Response
from Monei.model.apple_pay_domain_register503_response import ApplePayDomainRegister503Response
from Monei.model.cancel_payment_request import CancelPaymentRequest
from Monei.model.capture_payment_request import CapturePaymentRequest
from Monei.model.confirm_payment_request import ConfirmPaymentRequest
from Monei.model.create_payment_request import CreatePaymentRequest
from Monei.model.payment import Payment
from Monei.model.recurring_payment_request import RecurringPaymentRequest
from Monei.model.refund_payment_request import RefundPaymentRequest
from Monei.model.send_payment_link_request import SendPaymentLinkRequest
from Monei.model.send_payment_receipt_request import SendPaymentReceiptRequest
from Monei.model.send_payment_request_request import SendPaymentRequestRequest


class PaymentsApi(object):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client
        self.cancel_endpoint = _Endpoint(
            settings={
                'response_type': (Payment,),
                'auth': [
                    'APIKey'
                ],
                'endpoint_path': '/payments/{id}/cancel',
                'operation_id': 'cancel',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'id',
                    'cancel_payment_request',
                ],
                'required': [
                    'id',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'id':
                        (str,),
                    'cancel_payment_request':
                        (CancelPaymentRequest,),
                },
                'attribute_map': {
                    'id': 'id',
                },
                'location_map': {
                    'id': 'path',
                    'cancel_payment_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client
        )
        self.capture_endpoint = _Endpoint(
            settings={
                'response_type': (Payment,),
                'auth': [
                    'APIKey'
                ],
                'endpoint_path': '/payments/{id}/capture',
                'operation_id': 'capture',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'id',
                    'capture_payment_request',
                ],
                'required': [
                    'id',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'id':
                        (str,),
                    'capture_payment_request':
                        (CapturePaymentRequest,),
                },
                'attribute_map': {
                    'id': 'id',
                },
                'location_map': {
                    'id': 'path',
                    'capture_payment_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client
        )
        self.confirm_endpoint = _Endpoint(
            settings={
                'response_type': (Payment,),
                'auth': [
                    'APIKey'
                ],
                'endpoint_path': '/payments/{id}/confirm',
                'operation_id': 'confirm',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'id',
                    'confirm_payment_request',
                ],
                'required': [
                    'id',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'id':
                        (str,),
                    'confirm_payment_request':
                        (ConfirmPaymentRequest,),
                },
                'attribute_map': {
                    'id': 'id',
                },
                'location_map': {
                    'id': 'path',
                    'confirm_payment_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client
        )
        self.create_endpoint = _Endpoint(
            settings={
                'response_type': (Payment,),
                'auth': [
                    'APIKey'
                ],
                'endpoint_path': '/payments',
                'operation_id': 'create',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'create_payment_request',
                ],
                'required': [
                    'create_payment_request',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'create_payment_request':
                        (CreatePaymentRequest,),
                },
                'attribute_map': {
                },
                'location_map': {
                    'create_payment_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client
        )
        self.get_endpoint = _Endpoint(
            settings={
                'response_type': (Payment,),
                'auth': [
                    'APIKey'
                ],
                'endpoint_path': '/payments/{id}',
                'operation_id': 'get',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'id',
                ],
                'required': [
                    'id',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'id':
                        (str,),
                },
                'attribute_map': {
                    'id': 'id',
                },
                'location_map': {
                    'id': 'path',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client
        )
        self.recurring_endpoint = _Endpoint(
            settings={
                'response_type': (Payment,),
                'auth': [
                    'APIKey'
                ],
                'endpoint_path': '/payments/{sequenceId}/recurring',
                'operation_id': 'recurring',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'sequence_id',
                    'recurring_payment_request',
                ],
                'required': [
                    'sequence_id',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'sequence_id':
                        (str,),
                    'recurring_payment_request':
                        (RecurringPaymentRequest,),
                },
                'attribute_map': {
                    'sequence_id': 'sequenceId',
                },
                'location_map': {
                    'sequence_id': 'path',
                    'recurring_payment_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client
        )
        self.refund_endpoint = _Endpoint(
            settings={
                'response_type': (Payment,),
                'auth': [
                    'APIKey'
                ],
                'endpoint_path': '/payments/{id}/refund',
                'operation_id': 'refund',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'id',
                    'refund_payment_request',
                ],
                'required': [
                    'id',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'id':
                        (str,),
                    'refund_payment_request':
                        (RefundPaymentRequest,),
                },
                'attribute_map': {
                    'id': 'id',
                },
                'location_map': {
                    'id': 'path',
                    'refund_payment_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client
        )
        self.send_link_endpoint = _Endpoint(
            settings={
                'response_type': (Payment,),
                'auth': [
                    'APIKey'
                ],
                'endpoint_path': '/payments/{id}/link',
                'operation_id': 'send_link',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'id',
                    'send_payment_link_request',
                ],
                'required': [
                    'id',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'id':
                        (str,),
                    'send_payment_link_request':
                        (SendPaymentLinkRequest,),
                },
                'attribute_map': {
                    'id': 'id',
                },
                'location_map': {
                    'id': 'path',
                    'send_payment_link_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client
        )
        self.send_receipt_endpoint = _Endpoint(
            settings={
                'response_type': (Payment,),
                'auth': [
                    'APIKey'
                ],
                'endpoint_path': '/payments/{id}/receipt',
                'operation_id': 'send_receipt',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'id',
                    'send_payment_receipt_request',
                ],
                'required': [
                    'id',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'id':
                        (str,),
                    'send_payment_receipt_request':
                        (SendPaymentReceiptRequest,),
                },
                'attribute_map': {
                    'id': 'id',
                },
                'location_map': {
                    'id': 'path',
                    'send_payment_receipt_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client
        )
        self.send_request_endpoint = _Endpoint(
            settings={
                'response_type': (Payment,),
                'auth': [
                    'APIKey'
                ],
                'endpoint_path': '/payments/{id}/rtp',
                'operation_id': 'send_request',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'id',
                    'send_payment_request_request',
                ],
                'required': [
                    'id',
                    'send_payment_request_request',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'id':
                        (str,),
                    'send_payment_request_request':
                        (SendPaymentRequestRequest,),
                },
                'attribute_map': {
                    'id': 'id',
                },
                'location_map': {
                    'id': 'path',
                    'send_payment_request_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client
        )

    def cancel(
        self,
        id,
        **kwargs
    ):
        """Cancel Payment  # noqa: E501

        <p>Releases reserved funds from a previously authorized payment. This endpoint can only be used with payments in <code>AUTHORIZED</code> status.</p> <p>This operation is part of the two-step authorization flow:</p> <ol> <li><strong>Authorize</strong>: Create a payment with <code>transactionType: AUTH</code> to reserve funds</li> <li><strong>Cancel</strong>: Release the reserved funds if you decide not to capture the payment</li> </ol> <p>Cancellation makes the reserved funds available to the customer again and prevents you from being able to capture those funds in the future. Once cancelled, an authorization cannot be reactivated.</p>   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.cancel(id, async_req=True)
        >>> result = thread.get()

        Args:
            id (str): The payment ID

        Keyword Args:
            cancel_payment_request (CancelPaymentRequest): [optional]
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            _request_auths (list): set to override the auth_settings for an a single
                request; this effectively ignores the authentication
                in the spec for a single request.
                Default is None
            async_req (bool): execute request asynchronously

        Returns:
            Payment
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['_request_auths'] = kwargs.get('_request_auths', None)
        kwargs['id'] = \
            id
        return self.cancel_endpoint.call_with_http_info(**kwargs)

    def capture(
        self,
        id,
        **kwargs
    ):
        """Capture Payment  # noqa: E501

        <p>Captures funds from a previously authorized payment. This endpoint can only be used with payments in <code>AUTHORIZED</code> status.</p> <p>This operation completes the two-step authorization flow:</p> <ol> <li><strong>Authorize</strong>: Create a payment with <code>transactionType: AUTH</code> to reserve funds</li> <li><strong>Capture</strong>: Transfer the reserved funds to your account when ready to fulfill the order</li> </ol> <p><strong>Important</strong>: Authorized payments expire after exactly seven days. After expiration, they will be marked as <code>EXPIRED</code> and can no longer be captured. Be sure to capture funds within this timeframe or communicate with your customer about a new payment.</p>   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.capture(id, async_req=True)
        >>> result = thread.get()

        Args:
            id (str): The payment ID

        Keyword Args:
            capture_payment_request (CapturePaymentRequest): [optional]
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            _request_auths (list): set to override the auth_settings for an a single
                request; this effectively ignores the authentication
                in the spec for a single request.
                Default is None
            async_req (bool): execute request asynchronously

        Returns:
            Payment
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['_request_auths'] = kwargs.get('_request_auths', None)
        kwargs['id'] = \
            id
        return self.capture_endpoint.call_with_http_info(**kwargs)

    def confirm(
        self,
        id,
        **kwargs
    ):
        """Confirm Payment  # noqa: E501

        <p>Confirms a payment that was created without payment details. This endpoint can only be used with payments in <code>PENDING</code> status.</p> <p>The two-step payment flow:</p> <ol> <li><strong>Create</strong>: First, create a payment without payment details (status: <code>PENDING</code>)</li> <li><strong>Confirm</strong>: Then provide payment details to complete the transaction</li> </ol> <p>When confirming a payment, you can use:</p> <ul> <li>A newly generated <code>paymentToken</code> from <a href=\"https://docs.monei.com/docs/monei-js-overview\">monei.js Components</a></li> <li>A permanent <code>paymentToken</code> from a previous payment (generated with <code>generatePaymentToken: true</code>)</li> </ul> <p>Using permanent payment tokens enables one-click checkout experiences for returning customers without requiring them to re-enter their payment information.</p> <p>You can provide additional customer information during confirmation, which will override any corresponding information originally passed in the payment creation request.</p>   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.confirm(id, async_req=True)
        >>> result = thread.get()

        Args:
            id (str): The payment ID

        Keyword Args:
            confirm_payment_request (ConfirmPaymentRequest): [optional]
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            _request_auths (list): set to override the auth_settings for an a single
                request; this effectively ignores the authentication
                in the spec for a single request.
                Default is None
            async_req (bool): execute request asynchronously

        Returns:
            Payment
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['_request_auths'] = kwargs.get('_request_auths', None)
        kwargs['id'] = \
            id
        return self.confirm_endpoint.call_with_http_info(**kwargs)

    def create(
        self,
        create_payment_request,
        **kwargs
    ):
        """Create Payment  # noqa: E501

        <p>Creates a new payment with the specified parameters.</p> <p>You can create a payment in two ways:</p> <ol> <li><strong>Immediate processing</strong>: Provide a <code>paymentToken</code> or <code>paymentMethod</code> - The payment will be processed instantly</li> <li><strong>Deferred processing</strong>: Create without payment details - The payment remains in <code>PENDING</code> status until you confirm it later using the <a href=\"#operation/payments_confirm\">confirm endpoint</a></li> </ol> <p>When creating a payment without payment details, you can redirect customers to the hosted payment page where they can select their preferred payment method and complete the transaction.</p> <p>For immediate processing, use one of these token options:</p> <ul> <li>A temporary <code>paymentToken</code> generated on the frontend using <a href=\"https://docs.monei.com/docs/monei-js-overview\">monei.js Components</a></li> <li>A permanent <code>paymentToken</code> from a previous successful payment (when <code>generatePaymentToken: true</code> was included)</li> </ul> <p>Permanent tokens enable one-click checkout experiences for returning customers by allowing you to securely store and reuse payment details without requiring customers to re-enter their information.</p>   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.create(create_payment_request, async_req=True)
        >>> result = thread.get()

        Args:
            create_payment_request (CreatePaymentRequest):

        Keyword Args:
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            _request_auths (list): set to override the auth_settings for an a single
                request; this effectively ignores the authentication
                in the spec for a single request.
                Default is None
            async_req (bool): execute request asynchronously

        Returns:
            Payment
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['_request_auths'] = kwargs.get('_request_auths', None)
        kwargs['create_payment_request'] = \
            create_payment_request
        return self.create_endpoint.call_with_http_info(**kwargs)

    def get(
        self,
        id,
        **kwargs
    ):
        """Get Payment  # noqa: E501

        <p>Retrieves the complete details of an existing payment by its unique ID.</p> <p>This endpoint returns all available information about the payment, including its current status, amount, customer details, timestamps, and transaction history. Use this to check the status of a payment, verify payment details, or retrieve information for your records.</p> <p>Supply the unique payment ID that was returned from your previous request.</p>   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.get(id, async_req=True)
        >>> result = thread.get()

        Args:
            id (str): The payment ID

        Keyword Args:
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            _request_auths (list): set to override the auth_settings for an a single
                request; this effectively ignores the authentication
                in the spec for a single request.
                Default is None
            async_req (bool): execute request asynchronously

        Returns:
            Payment
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['_request_auths'] = kwargs.get('_request_auths', None)
        kwargs['id'] = \
            id
        return self.get_endpoint.call_with_http_info(**kwargs)

    def recurring(
        self,
        sequence_id,
        **kwargs
    ):
        """Recurring Payment  # noqa: E501

        <p>Creates a subsequent charge using the payment details from a previous transaction.</p> <p>This endpoint enables recurring billing and subscription payments by:</p> <ul> <li>Using the same payment method as the original payment</li> <li>Charging the customer without requiring them to re-enter payment details</li> <li>Supporting variable or fixed amounts (defaults to the original payment amount if not specified)</li> </ul> <p><strong>Prerequisites:</strong></p> <ol> <li>The initial payment must be created with the <code>sequence</code> parameter</li> <li>The initial payment will return a <code>sequenceId</code> in the response</li> <li>This <code>sequenceId</code> must be provided in the URL path when making subsequent recurring charges</li> </ol> <p>Ideal for subscription services, membership renewals, and installment payments.</p> <p><strong>Need more advanced subscription management?</strong> For comprehensive subscription management with features like billing cycles, trial periods, and automatic recurring billing, consider using the <a href=\"#tag/Subscriptions\">Subscriptions API</a> instead. It provides a complete solution for creating and managing subscription-based services.</p>   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.recurring(sequence_id, async_req=True)
        >>> result = thread.get()

        Args:
            sequence_id (str): The sequence ID

        Keyword Args:
            recurring_payment_request (RecurringPaymentRequest): [optional]
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            _request_auths (list): set to override the auth_settings for an a single
                request; this effectively ignores the authentication
                in the spec for a single request.
                Default is None
            async_req (bool): execute request asynchronously

        Returns:
            Payment
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['_request_auths'] = kwargs.get('_request_auths', None)
        kwargs['sequence_id'] = \
            sequence_id
        return self.recurring_endpoint.call_with_http_info(**kwargs)

    def refund(
        self,
        id,
        **kwargs
    ):
        """Refund Payment  # noqa: E501

        <p>Returns funds from a completed payment back to the customer&#39;s original payment method.</p> <p><strong>Refund options:</strong></p> <ul> <li><strong>Full refund</strong>: Return the entire payment amount</li> <li><strong>Partial refund</strong>: Specify an amount less than the original payment</li> <li><strong>Multiple partial refunds</strong>: Issue several partial refunds until the total payment amount is reached</li> </ul> <p><strong>Limitations:</strong></p> <ul> <li>You can only refund payments that have been successfully processed</li> <li>A payment can only be refunded up to its original amount</li> <li>Once fully refunded, a payment cannot be refunded again</li> <li>Attempting to refund more than the remaining available amount will result in an error</li> </ul>   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.refund(id, async_req=True)
        >>> result = thread.get()

        Args:
            id (str): The payment ID

        Keyword Args:
            refund_payment_request (RefundPaymentRequest): [optional]
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            _request_auths (list): set to override the auth_settings for an a single
                request; this effectively ignores the authentication
                in the spec for a single request.
                Default is None
            async_req (bool): execute request asynchronously

        Returns:
            Payment
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['_request_auths'] = kwargs.get('_request_auths', None)
        kwargs['id'] = \
            id
        return self.refund_endpoint.call_with_http_info(**kwargs)

    def send_link(
        self,
        id,
        **kwargs
    ):
        """Send Payment Link  # noqa: E501

        <p>Sends a payment link to the customer through their preferred communication channel.</p> <p><strong>This API can only be used for payments with the following status:</strong></p> <ul> <li>Pending</li> </ul> <p><strong>Delivery channels are automatically selected based on available customer information:</strong></p> <ul> <li>If customer email is available: Link is sent via email</li> <li>If customer phone is available: Link is sent via WhatsApp</li> <li>If WhatsApp delivery fails: Link is sent via SMS as a fallback</li> </ul> <p>The payment link allows customers to complete the payment at their convenience using their preferred payment method on the secure MONEI payment page. If no customer contact information is provided, the system will use the details stored in the payment record.</p>   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.send_link(id, async_req=True)
        >>> result = thread.get()

        Args:
            id (str): The payment ID

        Keyword Args:
            send_payment_link_request (SendPaymentLinkRequest): [optional]
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            _request_auths (list): set to override the auth_settings for an a single
                request; this effectively ignores the authentication
                in the spec for a single request.
                Default is None
            async_req (bool): execute request asynchronously

        Returns:
            Payment
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['_request_auths'] = kwargs.get('_request_auths', None)
        kwargs['id'] = \
            id
        return self.send_link_endpoint.call_with_http_info(**kwargs)

    def send_receipt(
        self,
        id,
        **kwargs
    ):
        """Send Payment Receipt  # noqa: E501

        <p>Sends a payment receipt to the customer through their preferred communication channel.</p> <p><strong>This API can only be used for payments with the following status:</strong></p> <ul> <li>Succeeded</li> </ul> <p><strong>Delivery channels are automatically selected based on available customer information:</strong></p> <ul> <li>If customer email is available: Receipt is sent via email</li> <li>If customer phone is available: Receipt is sent via WhatsApp</li> <li>If WhatsApp delivery fails: Receipt is sent via SMS as a fallback</li> </ul> <p>The receipt includes payment details such as amount, date, transaction ID, and merchant information, providing customers with a record of their successful transaction. If no customer contact information is provided, the system will use the details stored in the payment record.</p>   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.send_receipt(id, async_req=True)
        >>> result = thread.get()

        Args:
            id (str): The payment ID

        Keyword Args:
            send_payment_receipt_request (SendPaymentReceiptRequest): [optional]
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            _request_auths (list): set to override the auth_settings for an a single
                request; this effectively ignores the authentication
                in the spec for a single request.
                Default is None
            async_req (bool): execute request asynchronously

        Returns:
            Payment
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['_request_auths'] = kwargs.get('_request_auths', None)
        kwargs['id'] = \
            id
        return self.send_receipt_endpoint.call_with_http_info(**kwargs)

    def send_request(
        self,
        id,
        send_payment_request_request,
        **kwargs
    ):
        """Send Payment Request  # noqa: E501

        <p>Sends a direct payment request to the customer&#39;s phone with smart channel selection.</p> <p><strong>Smart delivery logic based on customer phone capabilities:</strong></p> <ul> <li>If the phone number is registered with Bizum and that payment method is available: The customer receives a push notification in their banking app to instantly approve the payment</li> <li>If Bizum is not available or the phone is not registered with Bizum: The customer receives a payment link via WhatsApp to complete the payment</li> </ul> <p>This endpoint provides a streamlined payment experience, especially for Spanish customers with Bizum integration, enabling quick and convenient mobile payments.</p>   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.send_request(id, send_payment_request_request, async_req=True)
        >>> result = thread.get()

        Args:
            id (str): The payment ID
            send_payment_request_request (SendPaymentRequestRequest):

        Keyword Args:
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            _request_auths (list): set to override the auth_settings for an a single
                request; this effectively ignores the authentication
                in the spec for a single request.
                Default is None
            async_req (bool): execute request asynchronously

        Returns:
            Payment
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['_request_auths'] = kwargs.get('_request_auths', None)
        kwargs['id'] = \
            id
        kwargs['send_payment_request_request'] = \
            send_payment_request_request
        return self.send_request_endpoint.call_with_http_info(**kwargs)

