Create Payment Link with SI using API

You can create a payment link with SI (Recurring Payments) enabled using API, as described in this section. For more information on SI, refer to Introduction.

HTTP Method: POST

Environment

Request parameters

ParameterDescriptionExample
key
mandatory
Merchant key provided by PayU. Refer to the first entry in the Post Parameters table for a detailed description of this parameterJP***g
command
mandatory
This parameter must contain the API command as create_invoice.create_invoice
var1
mandatory
The invoice details are posted in a JSON format. The fields in this JSON are similar to the parameters posted using the Create Invoice API. For more details, refer to Create Invoice API. {"amount":"10","txnid":"abaac3332","productinfo":"jnvjrenv","firstname":"test","email":"[email protected]","phone":"1234567890","address1":"testaddress","city":"test" ,"state":"test","country":"test","zipcode":"122002","templateid":"14","validation period":6,"send_email_now":"1","time_unit" : "M", “send_sms” : “1”}
hash
mandatory
This parameter must contain the hash value to be calculated at your end. The string used for calculating the hash is mentioned below:
sha512(key|command|var1|salt)
where sha512 is the encryption method used here.
var2
mandatory
The standing instruction or subscription details are specified in a JSON format. For more details, refer to var2 JSON Fields Description.{"EnableSI" : "1", "FreeTrial" : "0", "BillingAmount" : "10", "BillingCurrency" : "INR", "BillingCycle" : "WEEKLY", "BillingInterval" : "1", "PaymentStartDate" : "2022-09-05", "PaymentEndDate" : "2022-09-07"} 

var2 JSON fields description

ParameterDescription
EnableSI
mandatory
Boolean: This flag must contain any of the following to indicate if SI or subscriptions is required for the payment link:
1: The request is eligible for SI
0: The request is eligible for SI

Note: If EnableSI=1 in the JSON, the values for the all other fields (mandatory) in this JSON must be posted.
billingAmount
mandatory
String Contains the billing amount
billingCycle
mandatory
String Billing Cycle defines whether customer needs to be charged over Daily, Weekly basis, Monthly or Yearly basis or one time,
billingInterval
mandatory
NSNumber Billing Interval is closely coupled with value of “billingCycle” and denotes at what frequency, the subscription plan needs to be executed.
billingLimit
optional
String The possible values for this parameter are:
billingRule
optional
String The possible values for this parameter are:
. MAX = Maximum amount. Lesser than this or equal to this amount can be debited in recurring debits
EXACT= Exact to this amount can be debited in recurring debits
Note: If no value is passed, then by default this is considered as ‘MAX’
billingCurrency
mandatory
String Currency in which the amount needs to be collected. By default, it is 'INR'.
paymentStartDate
mandatory
Date Start date of recurring payment
paymentEndDate
mandatory
Date End Date of recurring payment
freeTrial
optional
Boolean This flag is to indicate any of the following:
0: This is not a trial subscription. If this parameter is not posted, will be assumed as 0.
1: This is a trial subscription.

Sample request

curl --location --request POST 'https://test.payu.in/merchant/postservice.php?form=2' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Cookie: PHPSESSID=0l8ji8ffmqa35r3u71kmsdd6nq' \
--data-urlencode 'key=QyT13U' \
--data-urlencode 'command=create_invoice' \
--data-urlencode 'hash=cae5bc03e097c10bfe5764a5f006391dfdccb1b9d40ffe4d27b1236733deb979119bcd5d6ed3e94ac9463c94b86b20556220896c401710af20a02d3c8a53bb77' \
--data-urlencode 'var1={"amount":"3","txnid":"inv-098654","productinfo":"test product info","firstname":"first name","email":"[email protected]","phone":"1234567890","address1":"testaddress","city":"test","state":"test","country":"test","zipcode":"123456","send_email_now":"1","send_sms":"1","validation_period":"6","time_unit":"D"}' \
--data-urlencode 'var2={"EnableSI" : "1", "freeTrial" : "0", "billingAmount" : "10", "billingCurrency" : "INR", "billingCycle" : "WEEKLY", "billingInterval" : "1", "paymentStartDate" : "2022-09-05", "paymentEndDate" : "2022-09-07"}'

Response parameters

ParameterDescriptionExample
Transaction IdDisplays the transaction ID of the invoice that is generated by PayU.test11390
Email IdDisplays the mail ID to which the payment link is sent. This is the same as e-mail ID specified in the email parameter in the request.[email protected]
PhoneDisplays the mobile phone to which the payment link is sent. This is the same as e-mail ID specified in the phone parameter in the request.1234567890
StatusDisplays the status of the API call.Success
URLDisplays the payment link URL that is shared through email or phone.https://test.payu.in/processInvoice?invoiceId=9eec02ac9e2efc335bdda2d74861
21ce03de24c2fa7d32d17462ad5a6a9058db

Sample response

Sample response for Payment Link with SI creation

{
  "Transaction Id":"abaac3332",
  "Email Id":"[email protected]",
  "Phone":"1234567890",
  "Status":"Success",
  "URL":"https:\/\/pp78secure.payu.in\/processInvoice?invoiceId=b1f8c52b1c7ab2d6b512130a49d87288"
}