> ## Documentation Index
> Fetch the complete documentation index at: https://primer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel a payment

> <p/>

Provided the payment has not reached `SETTLED` status, Primer will send a "void" request to the payment processor, thereby cancelling the payment and releasing the hold on customer funds. 

Upon success, the payment will transition to `CANCELLED`. 

The payload is optional.

**Failed request limit:** Primer limits how many failed requests a single
payment can have. Failed capture, cancel and refund requests all count towards
the same limit, which is currently 100 per payment. Once a payment reaches the
limit, any further capture, cancel or refund request for that payment is
rejected with a `409` and the error ID `PaymentRequestLimitExceeded`. The
rejected request is not sent to the processor. Do not retry after this error:
retrieve the payment to see why its previous requests failed, and contact Primer
support if you need the payment unblocked.




## OpenAPI

````yaml https://api.schemas.primer.io/api-reference/v2/openapi.yaml post /payments/{id}/cancel
openapi: 3.0.2
info:
  x-logo:
    url: https://apidocs.primer.io/docs/assets/images/primer-logo.svg
  title: Primer API
  version: 2.0.0
  description: Primer API v2 specification
servers:
  - url: https://api.sandbox.primer.io
  - url: https://api.primer.io
security:
  - ApiKeyAuth: []
tags:
  - name: Client Session API
  - name: Payments API
  - name: Payment Methods API
paths:
  /payments/{id}/cancel:
    post:
      tags:
        - Payments API
      summary: Cancel a payment
      description: >
        <p/>


        Provided the payment has not reached `SETTLED` status, Primer will send
        a "void" request to the payment processor, thereby cancelling the
        payment and releasing the hold on customer funds. 


        Upon success, the payment will transition to `CANCELLED`. 


        The payload is optional.


        **Failed request limit:** Primer limits how many failed requests a
        single

        payment can have. Failed capture, cancel and refund requests all count
        towards

        the same limit, which is currently 100 per payment. Once a payment
        reaches the

        limit, any further capture, cancel or refund request for that payment is

        rejected with a `409` and the error ID `PaymentRequestLimitExceeded`.
        The

        rejected request is not sent to the processor. Do not retry after this
        error:

        retrieve the payment to see why its previous requests failed, and
        contact Primer

        support if you need the payment unblocked.
      operationId: cancel_payment_payments__id__cancel_post
      parameters:
        - required: true
          schema:
            title: Payment ID
            type: string
          name: id
          description: ID of payment to cancel.
          in: path
        - $ref: '#/components/parameters/IdempotencyHeader'
      requestBody:
        content:
          application/json:
            schema:
              title: Data
              allOf:
                - $ref: '#/components/schemas/PaymentCancelAPIRequest'
              default: {}
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentAPIResponse'
              example:
                id: kHdEw9EG
                date: '2021-02-21T15:36:16.367687'
                status: CANCELLED
                orderId: order-abc
                customerId: customer-123
                currencyCode: EUR
                amount: 42
                paymentMethod:
                  paymentMethodToken: heNwnqaeRiqvY1UcslfQc3wxNjEzOTIxNjc4
                  vaultedPaymentMethodToken: _xlXlmBcTnuFxc2N3HAI73wxNjE1NTU5ODY5
                  descriptor: 'Purchase: Socks'
                  analyticsId: VtkMDAxZW5isH0HsbbNxZ3lo
                  paymentMethodType: PAYMENT_CARD
                  paymentMethodData:
                    first6Digits: '411111'
                    firstDigits: '41111111'
                    last4Digits: '1111'
                    expirationMonth: '12'
                    expirationYear: '2030'
                    cardholderName: John Biggins
                    network: Visa
                    isNetworkTokenized: false
                    binData:
                      network: VISA
                      regionalRestriction: UNKNOWN
                      accountNumberType: UNKNOWN
                      accountFundingType: UNKNOWN
                      prepaidReloadableIndicator: NOT_APPLICABLE
                      productUsageType: UNKNOWN
                      productCode: VISA
                      productName: VISA
                processor:
                  name: STRIPE
                  processor_merchant_id: acct_stripe_1234
                  amountCaptured: 0
                  amountRefunded: 0
                transactions:
                  - type: SALE
                    processorStatus: CANCELLED
                    processorName: STRIPE
                    processorMerchantId: acct_stripe_1234
                    processorTransactionId: 54c4eb5b3ef8a
                    reason: 'Customer cancelled order #1234.'
                customer:
                  email: customer123@gmail.com
                metadata:
                  productId: 123
                  merchantId: a13bsd62s
        '400':
          description: Error Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/400ErrorResponse'
              example:
                error:
                  errorId: PaymentError
                  description: The payment could not be found
                  diagnosticsId: '1234567898'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/409ErrorResponse'
              examples:
                PaymentRequestLimitExceeded:
                  summary: Failed request limit reached for this payment
                  value:
                    error:
                      errorId: PaymentRequestLimitExceeded
                      description: >-
                        Payment has exceeded the maximum number of request
                        attempts.
                      recoverySuggestion: >-
                        This payment has many failed requests, which indicates
                        the requests are invalid or the payment is in an
                        unrecoverable state. Retrieve the payment or view it in
                        the dashboard for more details.
                      diagnosticsId: '1234567898'
components:
  parameters:
    IdempotencyHeader:
      required: false
      schema:
        title: X-Idempotency-Key
        type: string
      name: X-Idempotency-Key
      description: >-
        Optional key to make the request idempotent. Enables a safe retry of a
        request without risking the user being charged or refunded multiple
        times. The idempotency key must be generated by the client and needs to
        be unique for every new request.
      in: header
  schemas:
    PaymentCancelAPIRequest:
      title: PaymentCancelAPIRequest
      type: object
      properties:
        reason:
          title: Cancellation reason
          type: string
          description: >-
            You can optionally specify a reason for the cancellation. This is
            for your own records.
      additionalProperties: false
      example:
        reason: 'Customer cancelled order #1234.'
    PaymentAPIResponse:
      title: PaymentAPIResponse
      type: object
      properties:
        id:
          title: Payment identifier
          type: string
          description: >
            The unique payment ID.


            You can use this ID to retrieve the payment details, or perform
            downstream

            operations.
        date:
          title: Payment date
          type: string
          description: The date and time at which the payment was created in UTC format.
          format: date-time
        status:
          title: Current status
          allOf:
            - $ref: '#/components/schemas/PaymentStatus'
          description: >-
            See the payment [status table](../docs#payment-status) for more
            information.
        orderId:
          title: Order ID
          type: string
          description: Your reference for the payment.
        currencyCode:
          title: Currency
          type: string
          description: >-
            The three-letter currency code in [ISO 4217
            format](https://en.wikipedia.org/wiki/ISO_4217#Active_codes). e.g.
            use `USD` for US dollars.
        amount:
          title: Payment amount
          minimum: 0
          type: integer
          format: int64
          description: The amount you charged the customer, in minor units.
        order:
          title: Order Details
          allOf:
            - $ref: '#/components/schemas/OrderDetailsAPISchema'
          description: More information associated with the order.
        customerId:
          title: The ID of the customer using the checkout
          type: string
          description: The unique identifier for your customer.
        customer:
          title: Customer Details
          allOf:
            - $ref: '#/components/schemas/CustomerDetailsAPISchema'
          description: More information associated with the customer.
        metadata:
          title: Payment Metadata
          type: object
          description: |
            Additional data to be used throughout the payment lifecycle.
        paymentMethod:
          title: Payment Method Options
          allOf:
            - $ref: >-
                #/components/schemas/PaymentResponsePaymentMethodOptionsAPISchema
          description: >-
            The payment method options provided in the request, as well as the
            token used to process the payment.
        processor:
          title: Processor Information
          allOf:
            - $ref: '#/components/schemas/PaymentResponseProcessorAPISchema'
          description: >-
            More information associated with the payment processor, including
            the processor name.
        requiredAction:
          title: Required action
          allOf:
            - $ref: '#/components/schemas/PaymentRequiredActionAPISchema'
          description: >-
            Required action to perform in order to resume the payment workflow.
            This can be requiring a 3DS check from the customer for instance.
        statusReason:
          title: Status Reason
          allOf:
            - $ref: '#/components/schemas/StatusReasonAPISchema'
          description: >
            Check this field for more information regarding the payment's
            status. This is especially useful when the status is `DECLINED` or
            `FAILED`.
        transactions:
          title: Transactions
          type: array
          items:
            $ref: '#/components/schemas/TransactionOverviewAPISchema'
          description: >-
            A list summarizing the transactions that occurred while processing
            the payment.


            Note: a refund is a separate transaction and so will appear in this
            `transactions` list if a refund was performed.
    400ErrorResponse:
      title: 400ErrorResponse
      properties:
        error:
          allOf:
            - $ref: '#/components/schemas/ErrorObject'
    409ErrorResponse:
      title: 409ErrorResponse
      type: object
      required:
        - error
      properties:
        error:
          allOf:
            - $ref: '#/components/schemas/ErrorObject'
            - type: object
              properties:
                paymentId:
                  title: Payment ID
                  type: string
                  description: Payment ID of the related pay
                status:
                  title: Status
                  type: string
                  description: Status of the related payment
    PaymentStatus:
      title: PaymentStatus
      enum:
        - PENDING
        - FAILED
        - AUTHORIZED
        - SETTLING
        - PARTIALLY_SETTLED
        - SETTLED
        - DECLINED
        - CANCELLED
      type: string
      description: An enumeration.
    OrderDetailsAPISchema:
      title: OrderDetailsAPISchema
      type: object
      properties:
        countryCode:
          title: Country Code
          allOf:
            - $ref: '#/components/schemas/CountryCodeEnum'
          description: The country in which the order is created
        fees:
          title: Fee Details
          type: array
          items:
            $ref: '#/components/schemas/OrderFeesAPISchema'
          description: The details of fees charged.
        lineItems:
          title: Line Items
          type: array
          items:
            $ref: '#/components/schemas/OrderLineItemsAPISchema'
          description: The details of the line items of the order.
        shipping:
          title: Shipping Details
          allOf:
            - $ref: '#/components/schemas/OrderShippingAPISchema'
          description: The details of shipping charged.
    CustomerDetailsAPISchema:
      title: CustomerDetailsAPISchema
      type: object
      properties:
        emailAddress:
          title: Email Address
          type: string
          description: >
            Customer email address.


            Note: It is recommended to include this field if a 3DS check will be
            performed
          format: email
        mobileNumber:
          title: Mobile Number
          type: string
          description: The customer's mobile number
          maxLength: 255
        firstName:
          title: First Name
          type: string
          description: The customer's first name
          maxLength: 255
        lastName:
          title: Last Name
          type: string
          description: The customer's last name
          maxLength: 255
        billingAddress:
          title: Billing Address
          allOf:
            - $ref: >-
                #/components/schemas/core_api__api__commons__schemas__addess__AddressAPISchema
          description: >
            Customer billing address.


            Note: It is recommended to include this field if a 3DS check will be
            performed
        shippingAddress:
          title: Shipping Address
          allOf:
            - $ref: >-
                #/components/schemas/core_api__api__commons__schemas__addess__AddressAPISchema
          description: Customer shipping address
        taxId:
          title: Tax ID
          type: string
          description: The customer's tax id number for tax exemptions
        nationalDocumentId:
          title: National Document ID
          type: string
          description: The customer's national identification number
    PaymentResponsePaymentMethodOptionsAPISchema:
      title: PaymentResponsePaymentMethodOptionsAPISchema
      type: object
      properties:
        descriptor:
          title: Payment descriptor
          type: string
          description: >-
            The description of the payment, as it would typically appear on a
            bank statement.
        paymentMethodToken:
          title: Payment Method Token
          type: string
          description: The payment method token used to authorize the transaction.
        vaultedPaymentMethodToken:
          title: Vaulted Payment Method Token
          type: string
          description: >-
            If the payment method token was vaulted, this is the new token. Use
            this token for recurring payments.
        analyticsId:
          title: Unique analytics ID
          type: string
          description: Unique analytics identifier corresponding to a payment method
        paymentMethodType:
          title: Payment method type
          allOf:
            - $ref: '#/components/schemas/PaymentMethodTypeEnum'
          description: Payment method type
        paymentMethodData:
          title: Payment method data
          anyOf:
            - $ref: '#/components/schemas/PaymentCardTokenAPISchema'
            - $ref: '#/components/schemas/PayPalOrderTokenAPISchema'
            - $ref: '#/components/schemas/PayPalBillingAgreementAPISchema'
            - $ref: '#/components/schemas/GoCardlessMandateAPISchema'
            - $ref: '#/components/schemas/KlarnaPaymentSessionAPISchema'
            - $ref: '#/components/schemas/KlarnaCustomerTokenAPISchema'
            - $ref: '#/components/schemas/IdealPayNLTokenAPISchema'
            - $ref: '#/components/schemas/ApayaCustomerTokenAPISchema'
          description: Payment method data
        threeDSecureAuthentication:
          title: Threedsecureauthentication
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureAuthenticationAPISchema'
          default:
            responseCode: NOT_PERFORMED
    PaymentResponseProcessorAPISchema:
      title: PaymentResponseProcessorAPISchema
      type: object
      properties:
        name:
          title: Processor Name
          type: string
          description: The payment processor used for this payment.
        processorMerchantId:
          title: Processor Merchant ID
          type: string
          description: >-
            The merchant ID registered at the payment processor used for this
            payment.
        amountCaptured:
          title: Amount captured
          type: integer
          format: int64
          description: >
            If no capture was performed, this value will be set to `0`.


            If one or more partial captures were performed, this value will be a
            sum

            of all partial capture amounts.
        amountRefunded:
          title: Amount refunded
          type: integer
          format: int64
          description: >
            If no refund was performed, this value will be set to `0`.


            If one or more partial refunds were performed, this value will be a
            sum

            of all partial refund amounts.
    PaymentRequiredActionAPISchema:
      title: PaymentRequiredActionAPISchema
      required:
        - name
        - description
      type: object
      properties:
        name:
          title: Name
          allOf:
            - $ref: '#/components/schemas/BlockingPaymentActionTypeEnum'
          description: Action name
        description:
          title: Description
          type: string
          description: Human description of the required action to perform.
        clientToken:
          title: Client token
          type: string
          description: >-
            The client token to be returned to the SDK if a required action is
            returned.

            Its length is not fixed. Treat it as an opaque string and do not
            rely on a maximum length when storing it.
    StatusReasonAPISchema:
      title: StatusReasonAPISchema
      required:
        - type
      type: object
      properties:
        type:
          title: Payment status type
          allOf:
            - $ref: '#/components/schemas/PaymentStatusTypeEnum'
          description: Type of the status.
        declineType:
          title: Decline Type
          allOf:
            - $ref: '#/components/schemas/DeclineTypeEnum'
          description: |
            If the error is of type `ISSUER_DECLINED` this will be returned.

            Declines of type `SOFT_DECLINE` may be retried,
            whereas declines of type `HARD_DECLINE` should not be retried.
        code:
          title: Payment status code
          allOf:
            - $ref: '#/components/schemas/TransactionDeclineReasonV2Enum'
          description: If the error is of type `ISSUER_DECLINED`, this will be returned.
        message:
          title: Processor message
          type: string
          description: >-
            In case of an error on the processor's part, we will return the
            message returned by the processor. This is usually a human readable
            error.
    TransactionOverviewAPISchema:
      title: TransactionOverviewAPISchema
      required:
        - processorMerchantId
      type: object
      properties:
        transactionType:
          title: Transaction type
          allOf:
            - $ref: '#/components/schemas/TransactionTypeEnum'
        processorTransactionId:
          title: Processor's transaction ID
          type: string
          description: Processor's unique identifier for the transaction
        processorName:
          title: Processor Name
          type: string
          description: An identifier of a processor.
        processorMerchantId:
          title: Processor master account identifier
          type: string
          description: |
            Processor's main account identifier.

            * Adyen: Account code
            * Braintree: Merchant ID
            * Stripe: Account ID"
        processorStatus:
          title: Processor Transaction status
          allOf:
            - $ref: '#/components/schemas/PaymentStatus'
          description: >-
            Transaction status, please refer to the [Transaction Status
            Codes](#section/API-Usage-Guide/Payment-Status) table for more
            information
        processorStatusReason:
          title: Payment error
          allOf:
            - $ref: '#/components/schemas/StatusReasonAPISchema'
          description: |
            If the transaction has a declined or failed status.

            Only if the status is `DECLINED` or `FAILED`, otherwise `null`.
        reason:
          title: Reason
          type: string
          description: >
            The reason for a cancel or refund request against this transaction,
            if one was provided.
          example: Item returned.
    ErrorObject:
      title: ErrorObject
      type: object
      properties:
        errorId:
          title: Error ID
          type: string
          description: An error ID
        description:
          title: Error description
          type: string
          description: A human description of the error
        recoverySuggestion:
          title: Error recovery suggestion
          type: string
          description: A human readable recovery suggestion of the error
        diagnosticsId:
          title: Error diagnostics ID
          type: string
          description: >-
            An ID that you can quote when contacting the Primer support team via
            our [Support
            Portal](https://primerapi.atlassian.net/servicedesk/customer/portal/11).
        validationErrors:
          title: Validation Errors
          type: array
          items:
            type: object
          description: Returned in case of a badly formed request
    CountryCodeEnum:
      title: CountryCodeEnum
      enum:
        - AW
        - AF
        - AO
        - AI
        - AX
        - AL
        - AD
        - AE
        - AR
        - AM
        - AS
        - AQ
        - TF
        - AG
        - AU
        - AT
        - AZ
        - BI
        - BE
        - BJ
        - BQ
        - BF
        - BD
        - BG
        - BH
        - BS
        - BA
        - BL
        - BY
        - BZ
        - BM
        - BO
        - BR
        - BB
        - BN
        - BT
        - BV
        - BW
        - CF
        - CA
        - CC
        - CH
        - CL
        - CN
        - CI
        - CM
        - CD
        - CG
        - CK
        - CO
        - KM
        - CV
        - CR
        - CU
        - CW
        - CX
        - KY
        - CY
        - CZ
        - DE
        - DJ
        - DM
        - DK
        - DO
        - DZ
        - EC
        - EG
        - ER
        - EH
        - ES
        - EE
        - ET
        - FI
        - FJ
        - FK
        - FR
        - FO
        - FM
        - GA
        - GB
        - GE
        - GG
        - GH
        - GI
        - GN
        - GP
        - GM
        - GW
        - GQ
        - GR
        - GD
        - GL
        - GT
        - GF
        - GU
        - GY
        - HK
        - HM
        - HN
        - HR
        - HT
        - HU
        - ID
        - IM
        - IN
        - IO
        - IE
        - IR
        - IQ
        - IS
        - IL
        - IT
        - JM
        - JE
        - JO
        - JP
        - KZ
        - KE
        - KG
        - KH
        - KI
        - KN
        - KR
        - KW
        - LA
        - LB
        - LR
        - LY
        - LC
        - LI
        - LK
        - LS
        - LT
        - LU
        - LV
        - MO
        - MF
        - MA
        - MC
        - MD
        - MG
        - MV
        - MX
        - MH
        - MK
        - ML
        - MT
        - MM
        - ME
        - MN
        - MP
        - MZ
        - MR
        - MS
        - MQ
        - MU
        - MW
        - MY
        - YT
        - NA
        - NC
        - NE
        - NF
        - NG
        - NI
        - NU
        - NL
        - 'NO'
        - NP
        - NR
        - NZ
        - OM
        - PK
        - PA
        - PN
        - PE
        - PH
        - PW
        - PG
        - PL
        - PR
        - KP
        - PT
        - PY
        - PS
        - PF
        - QA
        - RE
        - RO
        - RU
        - RW
        - SA
        - SD
        - SN
        - SG
        - GS
        - SH
        - SJ
        - SB
        - SL
        - SV
        - SM
        - SO
        - PM
        - RS
        - SS
        - ST
        - SR
        - SK
        - SI
        - SE
        - SZ
        - SX
        - SC
        - SY
        - TC
        - TD
        - TG
        - TH
        - TJ
        - TK
        - TM
        - TL
        - TO
        - TT
        - TN
        - TR
        - TV
        - TW
        - TZ
        - UG
        - UA
        - UM
        - UY
        - US
        - UZ
        - VA
        - VC
        - VE
        - VG
        - VI
        - VN
        - VU
        - WF
        - WS
        - YE
        - ZA
        - ZM
        - ZW
      description: An enumeration.
    OrderFeesAPISchema:
      title: OrderFeesAPISchema
      type: object
      required:
        - amount
        - type
      properties:
        amount:
          minimum: 0
          type: integer
          description: >-
            The fee amount charged to the customer, in minor  units. e.g. for
            $7, use `700`.
        type:
          type: string
          description: The type of fee.
        description:
          type: string
          description: A description of the fee, e.g. "Currency Conversion Fee".
    OrderLineItemsAPISchema:
      title: OrderLineItemsAPISchema
      type: object
      required:
        - itemId
        - description
        - amount
        - quantity
      properties:
        itemId:
          title: Item ID
          type: string
          description: A unique identifier for the line item.
        description:
          title: Item ID
          type: string
          description: A description of the item.
        amount:
          minimum: 0
          type: integer
          format: int64
          description: >-
            The amount charged to the customer, in minor units. The minimum
            amount is 0. The maximum amount is the limit of `int64`.
        discountAmount:
          title: Discount Amount
          minimum: 0
          type: integer
          format: int64
          description: Any discount applicable to this item, in minor units.
        quantity:
          type: integer
          description: The number of the particular line item that is being ordered.
        taxAmount:
          title: Tax Amount
          type: integer
          format: int64
          description: The tax charged on this item (if known), in minor units.
        taxCode:
          title: Tax Code
          type: string
          description: >-
            The tax code associated with this item, in minor units. This is
            required for Primer-initiated tax calculations.
        productType:
          title: Product Type
          allOf:
            - $ref: '#/components/schemas/ProductTypeEnum'
          description: An identifier for the product type.
    OrderShippingAPISchema:
      title: OrderShippingAPISchema
      type: object
      properties:
        amount:
          minimum: 0
          type: integer
          format: int64
          description: >-
            The shipping amount charged to the customer, in minor  units. e.g.
            for $7, use `700`.
    core_api__api__commons__schemas__addess__AddressAPISchema:
      title: AddressAPISchema
      type: object
      properties:
        firstName:
          title: Firstname
          type: string
          maxLength: 512
        lastName:
          title: Lastname
          type: string
          maxLength: 512
        addressLine1:
          title: Addressline1
          type: string
          maxLength: 255
        addressLine2:
          title: Addressline2
          type: string
          maxLength: 255
        city:
          title: City
          type: string
          maxLength: 255
        state:
          title: State
          type: string
          maxLength: 255
        countryCode:
          $ref: '#/components/schemas/CountryCodeEnum'
        postalCode:
          title: Postalcode
          type: string
          maxLength: 255
    PaymentMethodTypeEnum:
      title: PaymentMethodTypeEnum
      enum:
        - PAYMENT_CARD
        - PAYPAL_ORDER
        - PAYPAL_BILLING_AGREEMENT
        - KLARNA_AUTHORIZATION_TOKEN
        - KLARNA_CUSTOMER_TOKEN
        - PAY_NL_IDEAL
        - APAYA
        - OFF_SESSION_PAYMENT
        - CARD_OFF_SESSION_PAYMENT
        - APPLE_PAY
        - APPLE_PAY_ENCRYPTED_TOKEN
        - GOOGLE_PAY
        - AUTOMATED_CLEARING_HOUSE
      type: string
      description: >-
        Payment method type, where `OFF_SESSION_PAYMENT` is used for APM
        (Alternative Payment Method) payments and `PAYMENT_CARD` for traditional
        debit or credit cards. Please note that this list is different from one
        indicated on [available payment
        methods](/connections/payment-methods/available-payment-methods) page
        and values of this field will be changed in the future versions of the
        API.
    PaymentCardTokenAPISchema:
      title: PaymentCardTokenAPISchema
      required:
        - last4Digits
        - expirationMonth
        - expirationYear
      type: object
      properties:
        first6Digits:
          title: Payment card's first six digits
          maxLength: 6
          minLength: 6
          type: string
        firstDigits:
          title: Payment card's first digits
          description: >-
            The first 6 or 8 digits of the card number, depending on the card
            number length.
          maxLength: 8
          minLength: 6
          type: string
        last4Digits:
          title: Payment card's last four digits
          maxLength: 4
          minLength: 4
          type: string
        expirationMonth:
          title: Expiration month
          maxLength: 2
          minLength: 2
          type: string
        expirationYear:
          title: Expiration year
          maxLength: 4
          minLength: 4
          type: string
        cardholderName:
          title: Cardholder's name
          type: string
        network:
          title: Card network
          type: string
        isNetworkTokenized:
          title: Is represented by a digital PAN
          type: boolean
          default: false
        binData:
          $ref: '#/components/schemas/BinDataAPISchema'
    PayPalOrderTokenAPISchema:
      title: PayPalOrderTokenAPISchema
      required:
        - paypalOrderId
      type: object
      properties:
        paypalOrderId:
          title: PayPal order identifier
          type: string
        externalPayerInfo:
          title: Payer Info
          allOf:
            - $ref: '#/components/schemas/PayPalExternalPayerInfoAPISchema'
          description: Information about the PayPal customer
        paypalStatus:
          title: PayPal order status
          type: string
    PayPalBillingAgreementAPISchema:
      title: PayPalBillingAgreementAPISchema
      required:
        - paypalBillingAgreementId
      type: object
      properties:
        paypalBillingAgreementId:
          title: Paypalbillingagreementid
          type: string
        externalPayerInfo:
          title: Payer Info
          allOf:
            - $ref: '#/components/schemas/PayPalExternalPayerInfoAPISchema'
          description: Information about the PayPal customer
        shippingAddress:
          title: Shipping address
          allOf:
            - $ref: '#/components/schemas/AddressAPISchema'
          description: The PayPal customer's shipping address
        paypalStatus:
          title: PayPal order status
          type: string
    GoCardlessMandateAPISchema:
      title: GoCardlessMandateAPISchema
      required:
        - gocardlessMandateId
      type: object
      properties:
        gocardlessMandateId:
          title: Mandate agreement ID
          type: string
          description: Unique identifier of a GoCardless mandate agreement
    KlarnaPaymentSessionAPISchema:
      title: KlarnaPaymentSessionAPISchema
      required:
        - klarnaAuthorizationToken
        - sessionData
      type: object
      properties:
        klarnaAuthorizationToken:
          title: Klarnaauthorizationtoken
          type: string
        sessionData:
          $ref: '#/components/schemas/KlarnaSessionDetailsAPISchema'
    KlarnaCustomerTokenAPISchema:
      title: KlarnaCustomerTokenAPISchema
      required:
        - klarnaCustomerToken
        - sessionData
      type: object
      properties:
        klarnaCustomerToken:
          title: Klarnacustomertoken
          type: string
        sessionData:
          $ref: '#/components/schemas/KlarnaSessionDetailsAPISchema'
    IdealPayNLTokenAPISchema:
      title: IdealPayNLTokenAPISchema
      required:
        - paymentMethodConfigId
      type: object
      properties:
        paymentMethodConfigId:
          title: Paymentmethodconfigid
          type: string
          format: uuid
    ApayaCustomerTokenAPISchema:
      title: ApayaCustomerTokenAPISchema
      required:
        - mx
      type: object
      properties:
        mx:
          title: Mx
          type: string
        mnc:
          title: Mnc
          type: integer
        mcc:
          title: Mcc
          type: integer
    ThreeDSecureAuthenticationAPISchema:
      title: ThreeDSecureAuthenticationAPISchema
      required:
        - responseCode
      type: object
      properties:
        responseCode:
          $ref: '#/components/schemas/ThreeDSecureAuthResponseCodeEnum'
        reasonCode:
          title: Reasoncode
          anyOf:
            - $ref: '#/components/schemas/ThreeDSecureSkippedReasonCodeEnum'
            - $ref: '#/components/schemas/ThreeDSecureFailedReasonCodeEnum'
        reasonText:
          title: Reasontext
          type: string
        protocolVersion:
          title: Protocolversion
          type: string
        challengeIssued:
          title: Challengeissued
          type: boolean
    BlockingPaymentActionTypeEnum:
      title: BlockingPaymentActionTypeEnum
      enum:
        - 3DS_AUTHENTICATION
        - USE_PRIMER_SDK
      type: string
      description: An enumeration.
    PaymentStatusTypeEnum:
      title: PaymentStatusTypeEnum
      enum:
        - APPLICATION_ERROR
        - GATEWAY_REJECTED
        - ISSUER_DECLINED
      type: string
      description: An enumeration.
    DeclineTypeEnum:
      title: DeclineTypeEnum
      enum:
        - SOFT_DECLINE
        - HARD_DECLINE
      type: string
      description: An enumeration.
    TransactionDeclineReasonV2Enum:
      title: TransactionDeclineReasonV2Enum
      enum:
        - ERROR
        - INVALID_CARD_NUMBER
        - EXPIRED_CARD
        - LOST_OR_STOLEN_CARD
        - SUSPECTED_FRAUD
        - UNKNOWN
        - DECLINED
        - REFER_TO_CARD_ISSUER
        - DO_NOT_HONOR
        - INSUFFICIENT_FUNDS
        - WITHDRAWAL_LIMIT_EXCEEDED
        - ISSUER_TEMPORARILY_UNAVAILABLE
        - AUTHENTICATION_REQUIRED
      type: string
      description: An enumeration.
    TransactionTypeEnum:
      title: TransactionTypeEnum
      enum:
        - SALE
        - REFUND
      type: string
      description: An enumeration.
    ProductTypeEnum:
      title: ProductTypeEnum
      enum:
        - PHYSICAL
        - DIGITAL
      type: string
      description: An enumeration
    BinDataAPISchema:
      title: BinDataAPISchema
      required:
        - network
        - regionalRestriction
        - accountNumberType
        - accountFundingType
        - prepaidReloadableIndicator
        - productUsageType
        - productCode
        - productName
      type: object
      properties:
        network:
          $ref: '#/components/schemas/CardNetworkEnum'
        issuerCountryCode:
          $ref: '#/components/schemas/CountryCodeEnum'
        issuerName:
          title: Issuername
          type: string
        issuerCurrencyCode:
          $ref: '#/components/schemas/Currency'
        regionalRestriction:
          $ref: '#/components/schemas/CardRegionRestrictionEnum'
        accountNumberType:
          $ref: '#/components/schemas/CardAccountNumberTypeEnum'
        accountFundingType:
          $ref: '#/components/schemas/AccountFundingTypeEnum'
        prepaidReloadableIndicator:
          $ref: '#/components/schemas/PrepaidReloadableEnum'
        productUsageType:
          $ref: '#/components/schemas/CardProductTypeEnum'
        productCode:
          title: Productcode
          type: string
        productName:
          title: Productname
          type: string
    PayPalExternalPayerInfoAPISchema:
      title: PayPalExternalPayerInfoAPISchema
      type: object
      properties:
        externalPayerId:
          title: Externalpayerid
          type: string
        email:
          title: Email
          type: string
        firstName:
          title: Firstname
          type: string
        lastName:
          title: Lastname
          type: string
    AddressAPISchema:
      title: AddressAPISchema
      required:
        - addressLine1
        - city
        - countryCode
      type: object
      properties:
        firstName:
          title: First Name
          type: string
        lastName:
          title: Last Name
          type: string
        addressLine1:
          title: Address Line 1
          type: string
          description: Street name, Company name or PO Box
        addressLine2:
          title: Address Line 2
          type: string
          description: Apartment, Unit or Building number
        city:
          title: City
          type: string
          description: Name of the city, district, town or village
        state:
          title: State
          type: string
          description: State, County or Province
        countryCode:
          title: Country Code
          allOf:
            - $ref: '#/components/schemas/CountryCodeEnum'
          description: Two letter ISO country code
        postalCode:
          title: Postal Code
          type: string
          description: Postal or ZIP code
    KlarnaSessionDetailsAPISchema:
      title: KlarnaSessionDetailsAPISchema
      required:
        - billingAddress
        - purchaseCountry
        - purchaseCurrency
        - locale
        - orderLines
      type: object
      properties:
        recurringDescription:
          title: Recurringdescription
          type: string
        billingAddress:
          $ref: '#/components/schemas/KlarnaAddressAPISchema'
        shippingAddress:
          $ref: '#/components/schemas/KlarnaAddressAPISchema'
        purchaseCountry:
          title: Purchasecountry
          type: string
        purchaseCurrency:
          title: Purchasecurrency
          type: string
        locale:
          title: Locale
          type: string
        orderLines:
          title: Orderlines
          type: array
          items: {}
        tokenDetails:
          $ref: '#/components/schemas/KlarnaTokenDetails'
    ThreeDSecureAuthResponseCodeEnum:
      title: ThreeDSecureAuthResponseCodeEnum
      enum:
        - NOT_PERFORMED
        - SKIPPED
        - AUTH_SUCCESS
        - AUTH_FAILED
        - CHALLENGE
        - METHOD
      type: string
      description: An enumeration.
    ThreeDSecureSkippedReasonCodeEnum:
      title: ThreeDSecureSkippedReasonCodeEnum
      enum:
        - GATEWAY_UNAVAILABLE
        - DISABLED_BY_MERCHANT
        - NOT_SUPPORTED_BY_ISSUER
        - FAILED_TO_NEGOTIATE
        - UNKNOWN_ACS_RESPONSE
        - 3DS_SERVER_ERROR
        - ACQUIRER_NOT_CONFIGURED
        - ACQUIRER_NOT_PARTICIPATING
        - EXEMPTION_ACCEPTED
      type: string
      description: An enumeration.
    ThreeDSecureFailedReasonCodeEnum:
      title: ThreeDSecureFailedReasonCodeEnum
      enum:
        - UNKNOWN
        - REJECTED_BY_ISSUER
        - CARD_AUTHENTICATION_FAILED
        - UNKNOWN_DEVICE
        - UNSUPPORTED_DEVICE
        - EXCEEDS_AUTHENTICATION_FREQUENCY_LIMIT
        - EXPIRED_CARD
        - INVALID_CARD_NUMBER
        - INVALID_TRANSACTION
        - NO_CARD_RECORD
        - SECURITY_FAILURE
        - STOLEN_CARD
        - SUSPECTED_FRAUD
        - TRANSACTION_NOT_PERMITTED_TO_CARDHOLDER
        - CARDHOLDER_NOT_ENROLLED_IN_SERVICE
        - TRANSACTION_TIMED_OUT_AT_THE_ACS
        - LOW_CONFIDENCE
        - MEDIUM_CONFIDENCE
        - HIGH_CONFIDENCE
        - VERY_HIGH_CONFIDENCE
        - EXCEEDS_ACS_MAXIMUM_CHALLENGES
        - NON_PAYMENT_NOT_SUPPORTED
        - THREE_RI_NOT_SUPPORTED
        - ACS_TECHNICAL_ISSUE
        - DECOUPLED_REQUIRED_BY_ACS
        - DECOUPLED_MAX_EXPIRY_EXCEEDED
        - DECOUPLED_AUTHENTICATION_INSUFFICIENT_TIME
        - AUTHENTICATION_ATTEMPTED_BUT_NOT_PERFORMED_BY_CARDHOLDER
        - ACS_TIMED_OUT
        - INVALID_ACS_RESPONSE
        - ACS_SYSTEM_ERROR_RESPONSE
        - ERROR_GENERATING_CAVV
        - PROTOCOL_VERSION_NOT_SUPPORTED
        - TRANSACTION_EXCLUDED_FROM_ATTEMPTS_PROCESSING
        - REQUESTED_PROGRAM_NOT_SUPPORTED
      type: string
      description: >-
        This enum is derived from the `transStatusReason` on page 218 of the

        [EMV Co 3DS protocol
        specification](https://www.emvco.com/terms-of-use/?u=/wp-content/uploads/documents/EMVCo_3DS_Spec_v220_122018.pdf)


        | Code | Description                             |

        |------|-----------------------------------------|

        | 01   | Card authentication failed              |

        | 02   | Unknown Device                          |

        | 03   | Unsupported Device                      |

        | 04   | Exceeds authentication frequency limit  |

        | 05   | Expired card                            |

        | 06   | Invalid card number                     |

        | 07   | Invalid transaction                     |

        | 08   | No Card record                          |

        | 09   | Security failure                        |

        | 10   | Stolen card                             |

        | 11   | Suspected fraud                         |

        | 12   | Transaction not permitted to cardholder |

        | 13   | Cardholder not enrolled in service      |

        | 14   | Transaction timed out at the ACS        |

        | 15   | Low confidence                          |

        | 16   | Medium confidence                       |
    CardNetworkEnum:
      title: CardNetworkEnum
      enum:
        - AMEX
        - DANKORT
        - DINERS_CLUB
        - DISCOVER
        - ENROUTE
        - ELO
        - HIPER
        - INTERAC
        - JCB
        - MAESTRO
        - MASTERCARD
        - MIR
        - PRIVATE_LABEL
        - UNIONPAY
        - VISA
        - OTHER
      type: string
      description: |
        The list of available card networks.
    Currency:
      title: Currency
      enum:
        - AED
        - AFN
        - ALL
        - AMD
        - ANG
        - AOA
        - ARS
        - AUD
        - AWG
        - AZN
        - BAM
        - BBD
        - BDT
        - BGN
        - BHD
        - BIF
        - BMD
        - BND
        - BOB
        - BOV
        - BRL
        - BSD
        - BTN
        - BWP
        - BYR
        - BYN
        - BZD
        - CAD
        - CDF
        - CHE
        - CHF
        - CHW
        - CLP
        - CNY
        - COP
        - COU
        - CRC
        - CUC
        - CUP
        - CVE
        - CZK
        - DJF
        - DKK
        - DOP
        - DZD
        - EGP
        - ERN
        - ETB
        - EUR
        - FJD
        - FKP
        - GBP
        - GEL
        - GHS
        - GIP
        - GMD
        - GNF
        - GTQ
        - GYD
        - HKD
        - HNL
        - HRK
        - HTG
        - HUF
        - IDR
        - ILS
        - INR
        - IQD
        - IRR
        - ISK
        - JMD
        - JOD
        - JPY
        - KES
        - KGS
        - KHR
        - KMF
        - KPW
        - KRW
        - KWD
        - KYD
        - KZT
        - LAK
        - LBP
        - LKR
        - LRD
        - LSL
        - LYD
        - MAD
        - MDL
        - MKD
        - MMK
        - MNT
        - MOP
        - MRO
        - MUR
        - MVR
        - MWK
        - MXN
        - MXV
        - MYR
        - MZN
        - NAD
        - NGN
        - NIO
        - NOK
        - NPR
        - NZD
        - OMR
        - PAB
        - PEN
        - PGK
        - PHP
        - PKR
        - PLN
        - PYG
        - QAR
        - RON
        - RSD
        - RUB
        - RWF
        - SAR
        - SBD
        - SCR
        - SDG
        - SEK
        - SGD
        - SHP
        - SOS
        - SRD
        - SSP
        - SVC
        - SYP
        - SZL
        - THB
        - TJS
        - TMT
        - TND
        - TOP
        - TRY
        - TTD
        - TWD
        - TZS
        - UAH
        - UGX
        - USD
        - UYU
        - UZS
        - VND
        - VUV
        - WST
        - XAF
        - XAG
        - XAU
        - XBA
        - XBB
        - XBC
        - XBD
        - XCD
        - XCG
        - XDR
        - XFU
        - XOF
        - XPD
        - XPF
        - XPT
        - XSU
        - XTS
        - XUA
        - YER
        - ZAR
        - ZMW
        - ZWG
        - ZWL
      description: >
        Enumerates all supported currencies.


        The following currencies have been retired and will return a deprecation
        error on new payment or session creation requests: BGN, ZWL, ANG
    CardRegionRestrictionEnum:
      title: CardRegionRestrictionEnum
      enum:
        - DOMESTIC_USE_ONLY
        - NONE
        - UNKNOWN
      type: string
      description: An enumeration.
    CardAccountNumberTypeEnum:
      title: CardAccountNumberTypeEnum
      enum:
        - PRIMARY_ACCOUNT_NUMBER
        - NETWORK_TOKEN
        - DIGITAL_PAN
        - UNKNOWN
      type: string
      description: An enumeration.
    AccountFundingTypeEnum:
      title: AccountFundingTypeEnum
      enum:
        - CREDIT
        - DEBIT
        - PREPAID
        - CHARGE
        - DEFERRED_DEBIT
        - UNKNOWN
      type: string
      description: An enumeration.
    PrepaidReloadableEnum:
      title: PrepaidReloadableEnum
      enum:
        - RELOADABLE
        - NON_RELOADABLE
        - NOT_APPLICABLE
        - UNKNOWN
      type: string
      description: An enumeration.
    CardProductTypeEnum:
      title: CardProductTypeEnum
      enum:
        - CONSUMER
        - BUSINESS
        - GOVERNMENT
        - UNKNOWN
      type: string
      description: An enumeration.
    KlarnaAddressAPISchema:
      title: KlarnaAddressAPISchema
      type: object
      properties:
        title:
          title: Title
          type: string
        firstName:
          title: Firstname
          type: string
        lastName:
          title: Lastname
          type: string
        email:
          title: Email
          type: string
        phoneNumber:
          title: Phonenumber
          type: string
        addressLine1:
          title: Addressline1
          type: string
        addressLine2:
          title: Addressline2
          type: string
        addressLine3:
          title: Addressline3
          type: string
        city:
          title: City
          type: string
        state:
          title: State
          type: string
        countryCode:
          $ref: '#/components/schemas/CountryCodeEnum'
        postalCode:
          title: Postalcode
          type: string
    KlarnaTokenDetails:
      title: KlarnaTokenDetails
      required:
        - type
      type: object
      properties:
        type:
          title: Type
          type: string
        brand:
          title: Brand
          type: string
        masked_number:
          title: Masked Number
          type: string
        expiry_date:
          title: Expiry Date
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.