Create Invoice API

API Command: create_invoice

The Create Invoice API (create_invoice) allows you to create an email invoice for your customer and provides an option to send the email invoice to the customer either immediately or later through automation.

Environment

Sample request

Sample payload

{
  "itemName": "string",
  "description": "string",
  "rate": 1,
  "isTaxInclusive": true,
  "interStateTax": 0,
  "intraStateTax": 0,
  "cess": 0,
  "hsn": "string",
  "clientAddedOn": 0,
  "variants": [
    {
      "id": 0,
      "itemUnit": 0,
      "measuringUnit": "string",
      "rate": 0,
      "action": "string"
    }
  ]
}
Sample response
{
  "status": 0,
  "message": "string",
  "result": {},
  "errorCode": 170,
  "guid": "f529e375-739f-4c8a-b5f5-0e67fa3f533f"
}
Response parameters for Create Invoice API
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=9eec02ac9e2efc335bdda2d7486121ce
03de24c2fa7d32d17462ad5a6a9058db

Request parameters

Reference information for request parameters
ParameterReference
keyFor more information on how to generate the Key and Salt, refer to any of the following:

- Production: Generate Merchant Key and Salt
- Test: Generate Test Merchant Key and Salt
hashHash logic for this API is:
sha512(key|command|var1|salt)
sha512
var1For JSON fields description, refer to Additional Info for General APIs

Fields in var1 Parameter of Create Invoice API

The input var1 parameter must be generated in the JSON string format mentioned in the sample value string above. This string shows each parameter and its corresponding value separated by the delimiter colon (:). The parameters are also separated by the comma delimiter (,). The var1 parameter comprises the fields as described in the following table: 

FieldDescriptionExample
amount
mandatory
Float This parameter contains the payment amount of the particular transaction. 135.5
txnid
mandatory
String This parameter contains the merchant-generated transaction number which is used to track a particular order (must be unique every time if already successful, otherwise you get an error of the duplicate transaction).
abaac3332
productinfo
mandatory
String This parameter contains the product Description.
Character Limit - 5 to 250

iPhone
firstname
mandatory
String This parameter contains the first name of the customer. Only alphabets (A-Z, a-z), space or full-stop ( . ) characters are allowed.
Character Limit - 3 to 150
Samir
email
mandatory
String This parameter contains the email address of the customer.
Note: This information is helpful when it comes to issues related to fraud detection and chargebacks. Hence, it is a must to provide the correct information.
[email protected]
phone
mandatory
String This parameter contains the phone number of the customer.
Note: This information is helpful when it comes to issues related to fraud detection and chargebacks. Hence, it is a must to provide the correct information.
9988776655
address1
optional
String This parameter contains the first line of the billing address.
Character Limit - 100
H.No-23b, Street 7, Andheri
city
optional
String This parameter contains the billing address city of the customer. Only alphabets A-Z, a-z, 0-9, space.
Character Limit - 25
Mumbai
state
optional
String This parameter contains the billing address state of the customer. Only alphabets (A-Z, a-z), space or full-stop ( . ) characters are allowed.
Character Limit - 25
Maharashtra
country
optional
String This parameter contains the billing address country of the customer. Only alphabets A-Z, a-z, 0-9, space.
Character Limit - 25.
India
zipcode
optional
String This parameter contains the billing zip code of the customer. Only digits (0-9) are allowed.
Character limit - 6.
122002
udf1-udf5
optional
String User-defined fields (udf) are used to store any information corresponding to a particular transaction. You can use up to five udfs in the post designated as udf1, udf2, udf3, udf4, udf5. Only alphabets (A-Z, a-z), space, full-stop ( . ), hyphen(-), underscore(_), ampersand (@), comma (,) are allowed.Shipping Method, Billing Address1, Billing Address2, Bill Address - City, etc.
template_id
optional
Integer This parameter contains the template ID to be provided in case of more than one email invoice template. Merchant can decide which template to use and provide the particular template ID in this parameter.14
sms_template_id
optional
Integer This parameter contains the sms template ID to be provided in case of more than one sms invoice template. Merchant can decide which template to use and provide the particular template ID in this parameter.14
validation_period
optional
Integer This parameter contains the number of days for which the email invoice usage is valid (If this field is left empty, the default value will be taken as 7 days). The default value is 7 days.45
send_email_now
optional
BooleanThis parameter contains the any of the following values to specify whether the email invoice needs to be sent to customer at the time of creation or later:
1: If the merchant wants to automatically send the email invoice request to the customer at the time of the creation of the email invoice itself.

0: If the merchant does not want to send the email invoice request to the customer at the creation time itself. In this case, the email will be sent later automatically.
1
send_sms
optional
String This parameter contains the any of the following values to specify whether the SMS invoice needs to be sen to customer:
1: If the merchant wants to automatically send the SMS invoice to the customer at the time of the creation of the email invoice.

2:If the merchant want to send the SMS invoice to the customer but not the email.
* 0: If the merchant does not want to send the SMS invoice to the customer.
1
time_unit
optional
String This parameter contains the time unit of validation period. It can be any of the following:
M : Minute
H: Hour
* D: Days

The default value is D.
M

Language
Click Try It! to start a request and see the response here!