It is possible to represent multiple line items and fees in the Setu bill object when the bill to be collected in your business has some amount of complexity. You can show this to your customers by using the flexibilities provided by Setu API contracts.
Assume you are trying to represent the following items in your bill.
Item | Amount |
---|---|
EMI for June | 1000 |
EMI for July | 1000 |
Convenience Fees | 12 |
Late fees | 150 |
Total | 2162 |
Here is how it can be represented. Let us construct the following objects first.
- Line items for the two EMIs
- Convenience Fees and Late Fees
Line items
The EMI for June can be represented like this.
{
"description": "EMI for June",
"aggregates": {
"total": {
"value": 100000
}
}
}
Similarly the EMI for July.
{
"description": "EMI for July",
"aggregates": {
"total": {
"value": 100000
}
}
}
Fees:
The late fee can be represented like this.
{
"displayName":"Late fee",
"aggregates":{
"total": {
"value": 15000
}
}
}
The convenience fee can be represented like this.
{
"displayName":"Convenience fee",
"aggregates":{
"total": {
"value": 1200
}
}
}
Putting it all together
Once you have these two fees calculated, your bill object changes to
{
"amountExactness":"EXACT",
"aggregates":{
"total":{
"amount":{
"value": 216200
},
"displayName":"Total payable amount"
},
"subtotal": {
"amount": {
"value": 200000
},
"displayName": "EMI Amount"
}
},
"fees":[
<late fees>,
<convenience fees>
],
"items": [
<june emi>,
<july emi>
],
"dueDate":"2019-08-26T12:56:39Z",
"billerBillID":"CXR5JEQO8K",
"customerAccount":{
"id":"xyz@gmail.com"
},
"generatedOn":"2019-07-27T12:56:39Z",
"recurrence":"ONE_TIME"
}
Wrap the bill object in the following response and send it across as part of the fetchCustomerBills API.
{
"success": true,
"status": 200,
"data": {
"customer": {
"name": "Ashok Kumar"
},
"billDetails": {
"billFetchStatus": "AVAILABLE",
"bills": [
<BILL OBJECT>
]
}
}
}
You can read more about the bill object in our documentation on the get billers API.