1. Home
  2. Docs
  3. Developers Guide
  4. Integration APIs
  5. Invoice
  6. create_invoice

create_invoice

This API allows to create an email invoice for a customer and provides an option of sending the email invoice to the customer immediately or later by automating it.

Webservice Request Parameters

Parameter DescriptionMandatoryExample
1. amountPayment amount of the particular transaction. Yes10000
2. txnid
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 duplicate transaction)
Yes
abaac3332
3. productinfo
Product Description
Yes
iPhone
4. firstnameFirst name of the customer.
Only alphabets a-z are allowed
Yes
Samir
5. emailEmail address of the customer.Yestest@test.com
6. phonePhone number of the customerYes

9988776655
7. address1The first line of the billing address.NoH.No-23b, Street 7, Andheri
8. cityBilling address city of the customerNoMumbai
9. stateBilling address city of the customer NoMaharashtra
10. countryBilling address country of the customer NoIndia
11. zipcodeBilling zipcode of the customer No122002
12.
template_id

Template ID to be provided in case of more than one email invoice templates. Merchant can decide which template to use and provide that particular template ID in this parameter
No14
13.
validation_period
Number of days for which the email invoice usage is valid (If this field is left empty, then default value will be taken as 7 days No6
14.
send_email_now

1 – If the merchant wants to automatically send the email invoice request to the customer at the time of creation of email invoice itself
0 – If the merchant doesn’t want to send the email invoice request to the customer at the creation time itself. In this case, the email would be sent later automatically
No1

Webservice Request Format

ParameterSample Value
var1
{“amount“:”10000”,”txnid“:”abaac3332″,”productinfo“:”iPhone”,”firstname“:”Samir”,”em ail“:”test@test.com”,”phone“:”9988776655”,”address1“:”testaddress”,”city“:”Mumbai”,”stat e“:”Maharashtra”,”country“:”India”,”zipcode“:”122002″,”template_id“:”14″,”validation_period“: 6,”send_email_now“:”1”}

Here, the input var1 parameter has to 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 (,)

WebService Responses

a. If successfully executed:

(
          [Transaction Id] => abaac3332
          [Email Id] => test@test.com
          [Phone] => 9988776655
          [Status] => Success
[URL] => https://test.payu.in/processInvoice?invoiceId=9eec02ac9e2efc335bdda2d7486121ce03de24c2fa7d32d17462ad5a6a9058db
)

b. If duplicate transaction id is used:

Invoice for this transaction ID already exists.

c. If invalid parameter is sent*:

Invalid <parameter>

Note*: Here <parameter> value displayed would be the incorrect parameter provided