EMI


This API allows you to offer EMI through a Custom Checkout flow, giving you full control over how EMI options and subventions are displayed to your customers.

EnvironmentHTTP MethodAPI
SandboxPOSThttps://api-preprod.phonepe.com/apis/pg-sandbox/payments/v2/pay
ProductionPOSThttps://cards.phonepe.com/apis/pg/payments/v2/pay

⚠️ Setup Required to Avoid Errors!


Before initiating a payment, install the PhonePe Test App and configure the payment template. Skipping this step may result in HTTP 500 errors.

Request Header
Header NameHeader ValueDescription
Content-Typeapplication/json
AuthorizationO-Bearer <access_token>Pass access_token received in Authorization call
Request Parameters
Parameter NameData TypeMandatoryDescriptionConstraints
merchantOrderIdStringYesUnique merchant order id generated by merchant.Max Length = 63 charactersNo Special characters allowed except underscore “_” and hyphen “-“
amountLongYesOrder amount in paisa.Min Value = 100 (In paise)
metaInfoObjectNoMerchant defined meta info to store additional information. same data will be returned in status and callback response.Maximum length for Udf1-10 = 256 characters
Maximum length for Udf11-15 = 50 characters.
It is mandatory to keep the parameter names udf1, udf2, etc., exactly as they are in the metainfo block. Renaming these key values will result in a production error.
paymentFlowObjectYesAdditional details required by this flow.
paymentFlow.typeStringYesType of payment mode.Allowed Value = PG
paymentFlow.paymentMode.authModeStringYesType of Authentication mode.Allowed Value = 3DS
paymentFlow.paymentMode.cardDetails.encryptedCardNumberStringYesEncrypted 16 digit card number which merchant passes to process card transaction.
paymentFlow.paymentMode.cardDetails.encryptionKeyIdIntegerYesKeyId of key which merchant uses to encrypt card number & CVV.
paymentFlow.paymentMode.cardDetails.cardHolderNameStringNoCard Holder Name.
paymentFlow.paymentMode.cardDetails.expiry.monthStringYesCard Expiry Month.
paymentFlow.paymentMode.cardDetails.expiry.yearStringYesCard Expiry Year.
paymentFlow.paymentMode.encryptedCvvStringYesEncrypted CVV of the card with which payment is being initiated.
paymentFlow..paymentMode.merchantUserIdStringNoUnique merchant User Id generated by merchant.
paymentFlow.paymentMode.typeStringYesType of payment modeAllowed Value = CARD/TOKEN/ALT_ID
paymentFlow.paymentMode.emiDetails.tenureInMonthsIntegerYesEMI tenure in months
paymentFlow.paymentMode.emiDetails.interestPercentagePerAnnumBigDecimalNoAnnual interest rate
Sample Request: paymentMode.type = “CARD”
{
    "merchantOrderId": "TEST_ORD43166295132490004064",
    "amount": 100,
    "metaInfo":
    {
        "udf1": "dummy1",
        "udf2": "dummy2",
        "udf3": "dummy3",
        "udf4": "dummy4"
    },
    "paymentFlow":
    {
        "type": "PG",
        "paymentMode":
        {
            "type": "TOKEN",
            "authMode": "3DS",
            "tokenDetails":
            {
                "encryptedToken": "<encryptedToken>",
                "encryptionKeyId": 122,
                "expiry":
                {
                    "month": "12",
                    "year": "2029"
                },
                "panSuffix": "<panSuffix>",
                "cardHolderName": "Dummy Name",
                "cryptogram": "<cryptogram>",
                "encryptedCvv": "<encryptedCvv>"
            },
            "emiDetails":
            {
                "tenureInMonths": 6,
                "interestPercentagePerAnnum": 13.0
            }
        }
    }
}
Sample Request: paymentMode.type = “TOKEN” or paymentMode.type = “ALT_ID”
{
    "merchantOrderId": "TEST_ORD43166295132490004064",
    "amount": 100,
    "metaInfo":
    {
        "udf1": "dummy1",
        "udf2": "dummy2",
        "udf3": "dummy3",
        "udf4": "dummy4"
    },
    "paymentFlow":
    {
        "type": "PG",
        "paymentMode":
        {
            "type": "TOKEN",
            "authMode": "3DS",
            "tokenDetails":
            {
                "encryptedToken": "<encryptedToken>",
                "encryptionKeyId": 122,
                "expiry":
                {
                    "month": "12",
                    "year": "2029"
                },
                "panSuffix": "<panSuffix>",
                "cardHolderName": "Dummy Name",
                "cryptogram": "<cryptogram>",
                "encryptedCvv": "<encryptedCvv>"
            },
            "emiDetails":
            {
                "tenureInMonths": 6,
                "interestPercentagePerAnnum": 13.0
            }
        }
    }
}
Response Parameters for TOKEN
FieldDataTypeMandatoryDescription
tokenDetails.encryptionKeyIdIntegerYesKeyId of key which merchant uses to encrypt card number & cvv
tokenDetails.encryptedTokenStringYesEncrypted TOKEN number which merchant passes to process card transaction
tokenDetails.encryptedCvvStringYesEncrypted CVV of the card with which payment is being initiated.
tokenDetails.cryptogramStringYesThe cryptogram fetched from the gateway where the card was tokenized.
tokenDetails.panSuffixStringYesLast four digits of cardNumber
tokenDetails.cardHolderNameStringNoCard Holder Name
tokenDetails.expiry.monthStringYesToken expiry month
tokenDetails.expiry.yearStringYesToken expiry year
emiDetailsObjectNoemiDetails block needs to be passed if emi is required on the transaction
emiDetails.tenureInMonthsIntegerYesEMI tenure in months
emiDetails.interestPercentagePerAnnumBigDecimalNoAnnual interest rate
Sample Response
{
  "orderId": "OMO2608101347310515326548BW",
  "state": "PENDING",
  "expireAt": 1786350570581,
  "redirectUrl": "https://pg-testing.phonepe.com/pg-transport/v1/redirect/dummy?id=8a62b7e3-3892-4b11-a941-85e878a39404",
  "nativeOtpEnabled": false
}
Field NameData TypeDescription
orderIdStringPG generated internal order id.
stateStringState of the order created, Expected value is CREATED.
expiryAtLongOrder expiry date in epoch (in milliseconds).
redirectUrlStringUrl where merchant is supposed to redirect user to complete payment.
headers
body params
Is this article helpful?