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

# Payments - Check Balance and Apply PM Data

> Check the balance of the payment methods, apply the payment method data and recalculate remaining_amount and surcharge



## OpenAPI

````yaml post /v2/payments/{id}/eligibility/check-balance-and-apply-pm-data
openapi: 3.0.3
info:
  title: Hyperswitch - API Documentation
  description: >

    ## Get started


    Hyperswitch provides a collection of APIs that enable you to process and
    manage payments.

    Our APIs accept and return JSON in the HTTP body, and return standard HTTP
    response codes.


    You can consume the APIs directly using your favorite HTTP/REST library.


    We have a testing environment referred to "sandbox", which you can setup to
    test API calls without

    affecting production data.

    Currently, our sandbox environment is live while our production environment
    is under development

    and will be available soon.

    You can sign up on our Dashboard to get API keys to access Hyperswitch API.


    ### Environment


    Use the following base URLs when making requests to the APIs:


    | Environment   |  Base URL                          |

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

    | Sandbox       | <https://sandbox.hyperswitch.io>   |

    | Production    | <https://api.hyperswitch.io>       |


    ## Authentication


    When you sign up on our [dashboard](https://app.hyperswitch.io) and create a
    merchant

    account, you are given a secret key (also referred as api-key) and a
    publishable key.

    You may authenticate all API requests with Hyperswitch server by providing
    the appropriate key in

    the request Authorization header.


    | Key             | 
    Description                                                                                 
    |

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

    | api-key         | Private key. Used to authenticate all API requests from
    your merchant server                  |

    | publishable key | Unique identifier for your account. Used to authenticate
    API requests from your app's client  |


    Never share your secret api keys. Keep them guarded and secure.
  contact:
    name: Hyperswitch Support
    url: https://hyperswitch.io
    email: support.global@juspay.io
  license:
    name: Apache-2.0
  version: 0.1.0
servers:
  - url: https://sandbox.hyperswitch.io
    description: Sandbox Environment
security: []
tags:
  - name: Merchant Account
    description: Create and manage merchant accounts
  - name: Profile
    description: Create and manage profiles
  - name: Merchant Connector Account
    description: Create and manage merchant connector accounts
  - name: Payments
    description: Create and manage one-time payments, recurring payments and mandates
  - name: Refunds
    description: Create and manage refunds for successful payments
  - name: Mandates
    description: Manage mandates
  - name: Customers
    description: Create and manage customers
  - name: Payment Methods
    description: Create and manage payment methods of customers
  - name: Disputes
    description: Manage disputes
  - name: API Key
    description: Create and manage API Keys
  - name: Payouts
    description: Create and manage payouts
  - name: payment link
    description: Create payment link
  - name: Routing
    description: Create and manage routing configurations
  - name: Event
    description: Manage events
paths:
  /v2/payments/{id}/eligibility/check-balance-and-apply-pm-data:
    post:
      tags:
        - Payments
      summary: Payments - Check Balance and Apply PM Data
      description: >-
        Check the balance of the payment methods, apply the payment method data
        and recalculate remaining_amount and surcharge
      operationId: Apply Payment Method Data
      parameters:
        - name: id
          in: path
          description: The global payment id
          required: true
          schema:
            type: string
        - name: X-Profile-Id
          in: header
          description: Profile ID associated to the payment intent
          required: true
          schema:
            type: string
          example: pro_abcdefghijklmnop
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApplyPaymentMethodDataRequest'
        required: true
      responses:
        '200':
          description: Apply the Payment Method Data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckAndApplyPaymentMethodDataResponse'
      security:
        - publishable_key__client_secret: []
components:
  schemas:
    ApplyPaymentMethodDataRequest:
      type: object
      required:
        - payment_methods
      properties:
        payment_methods:
          type: array
          items:
            $ref: '#/components/schemas/BalanceCheckPaymentMethodData'
    CheckAndApplyPaymentMethodDataResponse:
      type: object
      required:
        - balances
        - remaining_amount
        - currency
        - requires_additional_pm_data
      properties:
        balances:
          type: array
          items:
            $ref: '#/components/schemas/EligibilityBalanceCheckResponseItem'
        remaining_amount:
          $ref: '#/components/schemas/MinorUnit'
        currency:
          $ref: '#/components/schemas/Currency'
        requires_additional_pm_data:
          type: boolean
          description: >-
            Whether the applied payment method balance is enough for the order
            amount or additional PM is required
        surcharge_details:
          type: array
          items:
            $ref: '#/components/schemas/ApplyPaymentMethodDataSurchargeResponseItem'
          nullable: true
    BalanceCheckPaymentMethodData:
      oneOf:
        - type: object
          required:
            - gift_card
          properties:
            gift_card:
              $ref: '#/components/schemas/GiftCardData'
    EligibilityBalanceCheckResponseItem:
      type: object
      required:
        - payment_method_data
        - eligibility
      properties:
        payment_method_data:
          $ref: '#/components/schemas/BalanceCheckPaymentMethodData'
        eligibility:
          $ref: '#/components/schemas/PMBalanceCheckEligibilityResponse'
    MinorUnit:
      type: integer
      format: int64
      description: This Unit struct represents MinorUnit in which core amount works
    Currency:
      type: string
      description: >-
        The three-letter ISO 4217 currency code (e.g., "USD", "EUR") for the
        payment amount. This field is mandatory for creating a payment.
      enum:
        - AED
        - AFN
        - ALL
        - AMD
        - ANG
        - AOA
        - ARS
        - AUD
        - AWG
        - AZN
        - BAM
        - BBD
        - BDT
        - BGN
        - BHD
        - BIF
        - BMD
        - BND
        - BOB
        - BRL
        - BSD
        - BTN
        - BWP
        - BYN
        - BZD
        - CAD
        - CDF
        - CHF
        - CLF
        - CLP
        - CNY
        - COP
        - 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
        - MGA
        - MKD
        - MMK
        - MNT
        - MOP
        - MRU
        - MUR
        - MVR
        - MWK
        - MXN
        - 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
        - SLE
        - SLL
        - SOS
        - SRD
        - SSP
        - STD
        - STN
        - SVC
        - SYP
        - SZL
        - THB
        - TJS
        - TMT
        - TND
        - TOP
        - TRY
        - TTD
        - TWD
        - TZS
        - UAH
        - UGX
        - USD
        - UYU
        - UZS
        - VES
        - VND
        - VUV
        - WST
        - XAF
        - XCD
        - XOF
        - XPF
        - YER
        - ZAR
        - ZMW
        - ZWL
    ApplyPaymentMethodDataSurchargeResponseItem:
      type: object
      required:
        - payment_method_type
        - payment_method_subtype
      properties:
        payment_method_type:
          $ref: '#/components/schemas/PaymentMethod'
        payment_method_subtype:
          $ref: '#/components/schemas/PaymentMethodType'
        surcharge_details:
          allOf:
            - $ref: '#/components/schemas/SurchargeDetailsResponse'
          nullable: true
    GiftCardData:
      oneOf:
        - type: object
          required:
            - givex
          properties:
            givex:
              $ref: '#/components/schemas/GiftCardDetails'
        - type: object
          required:
            - pay_safe_card
          properties:
            pay_safe_card:
              type: object
        - type: object
          required:
            - bhn_card_network
          properties:
            bhn_card_network:
              $ref: '#/components/schemas/BHNGiftCardDetails'
    PMBalanceCheckEligibilityResponse:
      oneOf:
        - type: object
          required:
            - success
          properties:
            success:
              $ref: '#/components/schemas/PMBalanceCheckSuccessResponse'
        - type: object
          required:
            - failure
          properties:
            failure:
              $ref: '#/components/schemas/PMBalanceCheckFailureResponse'
    PaymentMethod:
      type: string
      description: 'Indicates the type of payment method. Eg: ''card'', ''wallet'', etc.'
      enum:
        - card
        - card_redirect
        - pay_later
        - wallet
        - bank_redirect
        - bank_transfer
        - crypto
        - bank_debit
        - reward
        - real_time_payment
        - upi
        - voucher
        - gift_card
        - open_banking
        - mobile_payment
        - network_token
    PaymentMethodType:
      type: string
      description: >-
        Indicates the sub type of payment method. Eg: 'google_pay' & 'apple_pay'
        for wallets.
      enum:
        - ach
        - affirm
        - afterpay_clearpay
        - alfamart
        - ali_pay
        - ali_pay_hk
        - alma
        - amazon_pay
        - paysera
        - apple_pay
        - atome
        - bacs
        - bancontact_card
        - becs
        - benefit
        - bizum
        - blik
        - bluecode
        - boleto
        - bca_bank_transfer
        - bni_va
        - breadpay
        - bri_va
        - bhn_card_network
        - card_redirect
        - cimb_va
        - classic
        - credit
        - crypto_currency
        - cashapp
        - dana
        - danamon_va
        - debit
        - duit_now
        - efecty
        - eft
        - eft_debit_order
        - eps
        - flexiti
        - fps
        - evoucher
        - giropay
        - givex
        - google_pay
        - go_pay
        - gcash
        - ideal
        - interac
        - indomaret
        - klarna
        - kakao_pay
        - local_bank_redirect
        - mandiri_va
        - knet
        - mb_way
        - mobile_pay
        - momo
        - momo_atm
        - multibanco
        - online_banking_thailand
        - online_banking_czech_republic
        - online_banking_finland
        - online_banking_fpx
        - online_banking_poland
        - online_banking_slovakia
        - oxxo
        - pago_efectivo
        - permata_bank_transfer
        - open_banking_uk
        - pay_bright
        - payjustnow
        - paypal
        - paze
        - pix
        - pix_key
        - pix_emv
        - pix_qr
        - pix_automatico_qr
        - pix_automatico_push
        - pay_safe_card
        - przelewy24
        - prompt_pay
        - pse
        - qris
        - red_compra
        - red_pagos
        - samsung_pay
        - sepa
        - sepa_bank_transfer
        - sepa_guarenteed_debit
        - skrill
        - sofort
        - swish
        - touch_n_go
        - trustly
        - twint
        - upi_collect
        - upi_intent
        - upi_qr
        - vipps
        - viet_qr
        - venmo
        - walley
        - we_chat_pay
        - seven_eleven
        - lawson
        - mini_stop
        - family_mart
        - seicomart
        - pay_easy
        - local_bank_transfer
        - mifinity
        - open_banking_pis
        - direct_carrier_billing
        - instant_bank_transfer
        - instant_bank_transfer_finland
        - instant_bank_transfer_poland
        - revolut_pay
        - indonesian_bank_transfer
        - open_banking
        - network_token
    SurchargeDetailsResponse:
      type: object
      required:
        - surcharge
        - display_surcharge_amount
        - display_tax_on_surcharge_amount
        - display_total_surcharge_amount
      properties:
        surcharge:
          $ref: '#/components/schemas/SurchargeResponse'
        tax_on_surcharge:
          allOf:
            - $ref: '#/components/schemas/SurchargePercentage'
          nullable: true
        display_surcharge_amount:
          type: number
          format: double
          description: surcharge amount for this payment
        display_tax_on_surcharge_amount:
          type: number
          format: double
          description: tax on surcharge amount for this payment
        display_total_surcharge_amount:
          type: number
          format: double
          description: sum of display_surcharge_amount and display_tax_on_surcharge_amount
    GiftCardDetails:
      type: object
      required:
        - number
        - cvc
      properties:
        number:
          type: string
          description: The gift card number
        cvc:
          type: string
          description: The card verification code.
    BHNGiftCardDetails:
      type: object
      required:
        - account_number
        - pin
        - cvv2
        - expiration_date
      properties:
        account_number:
          type: string
          description: The gift card or account number
        pin:
          type: string
          description: The security PIN for gift cards requiring it
        cvv2:
          type: string
          description: The CVV2 code for Open Loop/VPLN products
        expiration_date:
          type: string
          description: The expiration date in MMYYYY format for Open Loop/VPLN products
    PMBalanceCheckSuccessResponse:
      type: object
      required:
        - balance
        - applicable_amount
        - currency
      properties:
        balance:
          $ref: '#/components/schemas/MinorUnit'
        applicable_amount:
          $ref: '#/components/schemas/MinorUnit'
        currency:
          $ref: '#/components/schemas/Currency'
    PMBalanceCheckFailureResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
    SurchargeResponse:
      oneOf:
        - type: object
          required:
            - type
            - value
          properties:
            type:
              type: string
              enum:
                - fixed
            value:
              $ref: '#/components/schemas/MinorUnit'
        - type: object
          required:
            - type
            - value
          properties:
            type:
              type: string
              enum:
                - rate
            value:
              $ref: '#/components/schemas/SurchargePercentage'
      discriminator:
        propertyName: type
    SurchargePercentage:
      type: object
      required:
        - percentage
      properties:
        percentage:
          type: number
          format: float
  securitySchemes:
    publishable_key__client_secret:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Format:
        `publishable-key=<publishable-key>,client-secret=<client-secret>`


        Publishable keys are a type of keys that can be public and have limited
        scope of usage. Client Secret provide temporary access to singular data,
        such as access to a single customer object for a short period of time.
        This authentication scheme is used by the SDK.

````