Redemption – Notify

This is the second part post Subscription setup to charge the Redemption amount as per the subscription cycle chosen.

Redemption has 2 steps: 

  1. Notify: This step is used to notify the user about the next payment debit.
  2. Execute: This step is to debit the amount from the user.

Notify

Host Details

EnvironmentValue
UAThttps://api-preprod.phonepe.com/apis/pg-sandbox
PRODhttps://api.phonepe.com/apis/pg

API Endpoint

/subscriptions/v2/notify

Complete Host URL

Http Method: POST

EnvironmentValue
UAThttps://api-preprod.phonepe.com/apis/pg-sandbox/subscriptions/v2/notify
PRODhttps://api.phonepe.com/apis/pg/subscriptions/v2/notify

Request Details

Request Headers

Header NameHeader Value
Content-Typeapplication/json
AuthorizationO-Bearer <access_token>

Note: access_token can be generated using the Auth Token API. Refer here

Request Parameters

Parameter NameData TypeDescriptionMandatory (Yes/No)Constraints
merchantOrderIdSTRINGUnique merchant order id generated by merchantYesMax Length = 63 characters
No Special characters allowed except underscore “_” and hyphen “-“
amountLONGOrder amount in paisaYesThe MAXIMUM debit/redemption amount for the mandate.
The amount is in Paise.
Note:
● For VARIABLE recurring debit, this amount would be considered as Max Cap Amount
● For PENNY_DROP flow, the amount should be greater than or equal to 200 (In Paise)
● For TRANSACTION flow, the amount should be greater than or equal to 100 (In Paise)
expireAtDateTime
Order expireAt epoch after which order will auto fail/skipped if not terminal.
(in milliseconds)
NoDefault Value – 48 hours
paymentFlow.typeSTRINGType of payment flowYesPossible Values
SUBSCRIPTION_REDEMPTION
paymentFlow.merchantSubscriptionIdSTRING
Merchant reference subscription ID passed during setup of the subscription
Yes
paymentFlow.redemptionRetryStrategyRedemption retry strategy in case attempts failNoPossible Values:
● STANDARD – Internal retries
● CUSTOM – Merchant needs to retry.
Default Value – STANDARD
paymentFlow.autoDebitAuto debit redemption 24 hours after notify success
Can’t be true for CUSTOM redemptionRetryStrategy
NoPossible Values –
true
false
Default Value – false
metaInfo
User defines fields propagated in status check & callbacks
NoDefault Value – null

Send the above payload and headers to the API via HTTP POST method.

Sample Payload

{
  "merchantOrderId": "MO1709025691805",
  "amount": 1000,
  "expireAt": 1620891733101,
  "metaInfo": {
    "udf1": <some meta info of max length 256>
    "udf2": <some meta info of max length 256>
    "udf3": <some meta info of max length 256>
    "udf4": <some meta info of max length 256>
    "udf5": <some meta info of max length 256>
  }  
  "paymentFlow": {
    "type": "SUBSCRIPTION_REDEMPTION",
    "merchantSubscriptionId": "MS121312",
    "redemptionRetryStrategy": "CUSTOM",
    "autoDebit": true
  }
}

Note:

  • If paymentFlow.redemptionRetryStrategy is passed as CUSTOM, then merchants has to retry the redemption until you get COMPLETED/FAILED (Terminal Status) . Maximum Time window for getting the terminal status is 48 hours and Maximum of 10 retries are allowed.
  • If paymentFlow.redemptionRetryStrategy is passed as STANDARD, then PhonePe will take care of the internal retires for redemption. Maximum Time window for getting the terminal status is 48 hours and these retries are handled by PhonePe internally.
  • Default Value – STANDARD

Sample CURL

curl --location 'https://api-preprod.phonepe.com/apis/pg-sandbox/subscriptions/v2/notify' \
--header 'Accept: application/json' \
--header 'Authorization: O-Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHBpcmVzT24iOjE3MTIyNTM2MjU2NDQsIm1lcmNoYW50SWQiOiJWMlNVQlVBVCJ9.7aVzYI_f_77-bBicEcRNuYx093b2wCsgl_WFNkKqAPY' \
--header 'Content-Type: application/json' \
--data '{
 "merchantOrderId": "MO1709025691805",
 "amount": 1000,
 "expireAt": 1620891733101,
 "paymentFlow": {
   "type": "SUBSCRIPTION_REDEMPTION",
   "merchantSubscriptionId": "MS121312",
   "redemptionRetryStrategy": "CUSTOM",
   "autoDebit": true
 }
}'

Response from the API

{
    "orderId" : "OMO12344",
    "state" : "NOTIFICATION_IN_PROGRESS",
    "expireAt": 1707116484762
}

Response Parameters

Field NameDescription
orderIdPhonePe reference order ID
stateOrder state
expireAtExpiry in Epoch Timestamp (in milliseconds)