Generate Invoice
A merchant can perform following Invoice operations using our REST API.
- Generate an invoice
How to Generate Invoice?
Invoice generation request has to be sent to our REST endpoint i.e. invoiceServices/REST/v1/generate
using POST method.
In our API Specifications you can find a full list of parameters that can be sent in the initial request.
Sample Request
curl https://preprod.facilero.com/invoiceServices/REST/v1/generate \ curl --header "AuthToken:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJjb25tZXJjaGFudDEiLCJyb2xlIjoibWVyY2hhbnQiLCJpc3MiOiJQWiIsImV4cCI6MTUwMTE0NjY0MX0.TFmGGKDUgkktmZQvrUTeox1buH1J6lgBVE3Mcy8OVjA" -d "authentication.memberId=11344" \ -d "authentication.checksum=3d6008949ea8c37de15e1408ae244bf2" \ -d "customer.email=john.doe@abc.com" \ -d "customer.givenName=John" \ -d "telnocc=91" \ -d "customer.mobile=532-2878" \ -d "amount=50.00" \ -d "merchantInvoiceId=Invoice01" \ -d "merchantRedirectUrl=www.merchantRedirectUrl.com" \ -d "currency=USD" \ -d "product.productDescription=shirt" \ -d "product.productAmount=50.00" \ -d "product.quantity=5" \ -d "product.productTotal=250.00" \ -d "invoiceExpirationPeriod=10" \ -d "merchantOrderDescription=Invoice for Goods and Services"
Sample Response
{ "memberId": "11344", "statusInvoiceResult": { "code": "00010", "description": "Invoice generated successfully" }, "invoiceDetails": { "amount": "250.00", "currency": "USD", "expirationPeriod": "10", "createdDate": "2017-02-08", "createdTime": " 16:15:46.", "merchantInvoiceId": "Invoice01", "customerEmail": "john.doe@abc.com", "merchantOrderDescription": "Invoice for Goods and Services", "systemInvoiceId": "1746", "transactionUrl": "https://preprod.facilero.com/transaction/PayInvoice?inv=2625&ct=wgdeHvcvppnoyjoH" } }
Hashing Rule
Facilero is supporting MD5 Cryptographic Hash for the authenticity of payment request send to the server.
Below is the description of fields use for generating checksum.
- memberId <Merchant ID as shared by Facilero >
- secureKey <Secure Key that can be generated through Facilero's dashboard>
- merchantInvoiceId <Unique invoice ID provided by merchant>
- amount <Amount of transaction>
- merchantRedirectUrl <Redirect URL which is given by merchant in request>
How to generate Checksum ?
Checksum has to be calculated with following combination and need to be send along with the authentication parameters in each server-to-server request:
Generate Invoice:
<memberId>|<memberSecureKey>|<merchantInvoiceId>|<amount>|<merchantRedirectUrl>
Sample Code
import java.security.MessageDigest def generateMD5Checksum() { String values= "11344|secureKey|invoice01|250.00|www.merchantRedirectUrl.com"; MessageDigest digest = MessageDigest.getInstance(MD5) digest.update(values.bytes); new BigInteger(1, digest.digest()).toString(16).padLeft(32, '0') }