Skip to content

Instantly share code, notes, and snippets.

@Zettersten
Last active March 5, 2019 15:25
Show Gist options
  • Save Zettersten/6e3da5c45139976b7e54dd0a3c2fbac1 to your computer and use it in GitHub Desktop.
Save Zettersten/6e3da5c45139976b7e54dd0a3c2fbac1 to your computer and use it in GitHub Desktop.
Example Invoice Line Item Calculation
// REQUEST
{
"entries": [
{
"taxRate": 100,
"discountRate": 50,
"shippingAmount": 20,
"description": "This is the first line item",
"details": "Additional details",
"quantity": "2",
"price": 10
}
],
"taxRate": 0,
"discountRate": 50,
"shippingAmount": 100
}
// RESPONSE
{
"due": 32,
"subtotal": 70,
"tax": 10,
"discount": 40,
"shipping": 120,
"total": 135,
"referenceNumber": 0,
"balanceDue": 0,
"price": 70,
"taxRate": 0,
"discountRate": 50,
"shippingAmount": 100,
"entries": [
{
"type": "service",
"isOptional": false,
"willPay": true,
"description": "This is the first line item",
"details": "Additional details",
"quantity": 2,
"price": 10,
"taxRate": 100,
"discountRate": 50,
"shippingAmount": 20,
"total": 70,
"subtotal": 20,
"shipping": 20,
"discount": 5,
"tax": 10
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment