Invoices
Invoice object
{
"id": "inv_XsTY9J7C12iAD9Zc1J",
"customer": {
"id": "cus_APxT9s7X12ilP9Zx9O",
"name": "Acme Nation LLC",
"address": "17st, National Sub",
"state": "IL",
"country": "US",
"phone": null,
"email": "billing@stark.com",
"website": "https://www.stark.com"
"tax_settings": {},
"metadata": {},
"created": "2020-05-12 15:42:09",
"updated": "2020-05-12 21:16:12"
},
"document": {
"id": "US1",
"name": "Invoice",
"country": "US",
"currency": "USD"
},
"number": 10923,
"test_mode": false,
"date": "2020-06-17",
"due_date": "2020-07-12",
"lines": [
{
"id": "lin_APxT9s7X12ilP9Zx9O",
"name": "Acme App",
"description": "Software services",
"quantity": 4.0,
"discount": 10.0
"discount_scheme": "%"
},
...
],
"collection_method": "deferred_dues",
"payments": [
{
"id": "pay_APxT9s7X12ilP9Zx9O",
"amount": 50.5,
"currency": "USD",
"date": "2020-06-30",
"description": "Invoice Nº 10923"
"source": null,
"payment_date": null,
"customer": "cus_APxT9s7X12ilP9Zx9O",
"invoice": "inv_XsTY9J7C12iAD9Zc1J",
"status": "requires_payment_method",
"metadata": {},
"created": "2020-06-17 14:21:32",
"updated": "2020-06-17 14:21:32"
},
...
],
"amount": 100.50,
"exempt": 0,
"tax": 0,
"tax_percent": 0,
"subtotal": 100.50,
"discount": 10.0,
"discount_scheme": "$",
"total": 90.50,
"period_start": null,
"period_end": null,
"local_file": null,
"note": "Hint: Chargeable to 2020-07-12",
"fiscal_settings": {},
"status": "finalized",
"metadata": {},
"user": "tony@stark.com",
"created": "2020-06-17 14:21:32",
"updated": "2020-06-17 14:21:32"
}
Create an invoice
POST
https://api.piriod.com/invoices/
This endpoint creates an invoice for a given customer with status draft. After create the invoice use finalize resource for finish invoice.
Request Body
{
"id": "inv_XsTY9J7C12iAD9Zc1J",
"customer": {
"id": "cus_APxT9s7X12ilP9Zx9O",
"name": "Acme Nation LLC",
"address": "17st, National Sub",
"state": "IL",
"country": "US",
"phone": null,
"email": "billing@stark.com",
"website": "https://www.stark.com"
"tax_settings": {},
"metadata": {},
"created": "2020-05-12 15:42:09",
"updated": "2020-05-12 21:16:12"
},
"document": {
"id": "US1",
"name": "Invoice",
"country": "US",
"currency": "USD"
},
"number": 0,
"test_mode": false,
"date": "2020-06-17",
"due_date": "2020-07-12",
"lines": [
{
"id": "lin_APxT9s7X12ilP9Zx9O",
"name": "Acme App",
"description": "Software services",
"quantity": 10.00,
"amount": 12.00,
"discount": 10.00
"discount_scheme": "$"
}
],
"collection_method": "deferred",
"payments": [
{
"id": "pay_APxT9s7X12ilP9Zx9O",
"amount": 110.00,
"currency": "USD",
"date": "2020-06-30",
"description": "Invoice Nº 10923"
"source": null,
"payment_date": null,
"customer": "cus_APxT9s7X12ilP9Zx9O",
"invoice": "inv_XsTY9J7C12iAD9Zc1J",
"status": "requires_payment_method",
"metadata": {},
"created": "2020-06-17 14:21:32",
"updated": "2020-06-17 14:21:32"
}
],
"amount": 110.00,
"exempt": 0,
"tax": 0,
"tax_percent": 0,
"subtotal": 110.00,
"discount": 10.00,
"discount_scheme": "$",
"total": 100.00,
"period_start": null,
"period_end": null,
"local_file": null,
"note": "Hint: Chargeable to 2020-07-12",
"fiscal_settings": {},
"status": "draft",
"metadata": {},
"user": "tony@stark.com",
"created": "2020-06-17 14:21:32",
"updated": "2020-06-17 14:21:32"
}
Retrieve an invoice
GET
https://api.piriod.com/invoices/{id}/
This endpoint retrieves an invoice.
Path Parameters
{
"id": "inv_XsTY9J7C12iAD9Zc1J",
"customer": {
"id": "cus_APxT9s7X12ilP9Zx9O",
"name": "Acme Nation LLC",
"address": "17st, National Sub",
"state": "IL",
"country": "US",
"phone": null,
"email": "billing@stark.com",
"website": "https://www.stark.com"
"tax_settings": {},
"metadata": {},
"created": "2020-05-12 15:42:09",
"updated": "2020-05-12 21:16:12"
},
"document": {
"id": "US1",
"name": "Invoice",
"country": "US",
"currency": "USD"
},
"number": 10923,
"test_mode": false,
"date": "2020-06-17",
"due_date": "2020-07-12",
"lines": [
{
"id": "lin_APxT9s7X12ilP9Zx9O",
"name": "Acme App",
"description": "Software services",
"quantity": 10.00,
"amount": 12.00,
"discount": 10.00
"discount_scheme": "$"
}
],
"collection_method": "deferred",
"payments": [
{
"id": "pay_APxT9s7X12ilP9Zx9O",
"amount": 110.00,
"currency": "USD",
"date": "2020-06-30",
"description": "Invoice Nº 10923"
"source": null,
"payment_date": null,
"customer": "cus_APxT9s7X12ilP9Zx9O",
"invoice": "inv_XsTY9J7C12iAD9Zc1J",
"status": "requires_payment_method",
"metadata": {},
"created": "2020-06-17 14:21:32",
"updated": "2020-06-17 14:21:32"
}
],
"amount": 110.00,
"exempt": 0,
"tax": 0,
"tax_percent": 0,
"subtotal": 110.00,
"discount": 10.00,
"discount_scheme": "$",
"total": 100.00,
"period_start": null,
"period_end": null,
"local_file": null,
"note": "Hint: Chargeable to 2020-07-12",
"fiscal_settings": {},
"status": "draft",
"metadata": {},
"user": "tony@stark.com",
"created": "2020-06-17 14:21:32",
"updated": "2020-06-17 14:21:32"
}
Update an invoice
PATCH
https://api.piriod.com/invoices/{id}/
This endpoint updates an invoice. Only invoices with status draft
are updated.
Path Parameters
Request Body
{
"id": "inv_XsTY9J7C12iAD9Zc1J",
"customer": {
"id": "cus_XT9UAs7y18ilAW72lX",
"name": "Simple People LLC",
"address": "12A Marina Avenue",
"state": "CA",
"country": "US",
"phone": null,
"email": "business@spinversions.com",
"website": "https://www.spinversions.com"
"tax_settings": {},
"metadata": {},
"created": "2020-05-12 15:42:09",
"updated": "2020-05-12 21:16:12"
},
"document": {
"id": "US1",
"name": "Invoice",
"country": "US",
"currency": "USD"
},
"number": 0,
"test_mode": true,
"date": "2020-06-17",
"due_date": "2020-07-12",
"lines": [
{
"id": "lin_APxT9s7X12ilP9Zx9O",
"name": "Acme App",
"description": "Software services",
"quantity": 10.00,
"amount": 12.00,
"discount": 10.00
"discount_scheme": "$"
}
],
"collection_method": "deferred",
"payments": [
{
"id": "pay_APxT9s7X12ilP9Zx9O",
"amount": 110.00,
"currency": "USD",
"date": "2020-06-30",
"description": "Invoice Nº 10923"
"source": null,
"payment_date": null,
"customer": "cus_APxT9s7X12ilP9Zx9O",
"invoice": "inv_XsTY9J7C12iAD9Zc1J",
"status": "requires_payment_method",
"metadata": {},
"created": "2020-06-17 14:21:32",
"updated": "2020-06-17 14:21:32"
}
],
"amount": 110.00,
"exempt": 0,
"tax": 0,
"tax_percent": 0,
"subtotal": 110.00,
"discount": 10.00,
"discount_scheme": "$",
"total": 100.00,
"period_start": "2020-06-01",
"period_end": "2020-06-31",
"local_file": null,
"note": "Chargeable to 2020-06-31",
"fiscal_settings": {},
"status": "draft",
"metadata": {},
"user": "tony@stark.com",
"created": "2020-06-17 14:21:32",
"updated": "2020-06-17 14:21:32"
}
Destroy an invoice
DELETE
https://api.piriod.com/invoices/{id}/
Destroy an invoice object. Only invoices with status draft
are updated.
Path Parameters
Finalize an invoice
GET
https://api.piriod.com/invoices/{id}/finalize/
This endpoint finalize an invoice. When the invoice is finalized, it is validated with the tax agency, if the invoice document type has tax regulations, you will no longer be able to update your data. The status attribute of the invoice object will become to finalized
. The local_file attribute of the invoice object will have a url to get the file that was sent to the tax agency, normally it is a file with an .xml extension.
Path Parameters
{
"id": "inv_XsTY9J7C12iAD9Zc1J",
"customer": {
"id": "cus_XT9UAs7y18ilAW72lX",
"name": "Simple People LLC",
"address": "12A Marina Avenue",
"state": "CA",
"country": "US",
"phone": null,
"email": "business@spinversions.com",
"website": "https://www.spinversions.com"
"tax_settings": {},
"metadata": {},
"created": "2020-05-12 15:42:09",
"updated": "2020-05-12 21:16:12"
},
"document": {
"id": "US1",
"name": "Invoice",
"country": "US",
"currency": "USD"
},
"number": 0,
"test_mode": true,
"date": "2020-06-17",
"due_date": "2020-07-12",
"lines": [
{
"id": "lin_APxT9s7X12ilP9Zx9O",
"name": "Acme App",
"description": "Software services",
"quantity": 10.00,
"amount": 12.00,
"discount": 10.00
"discount_scheme": "$"
}
],
"collection_method": "deferred",
"payments": [
{
"id": "pay_APxT9s7X12ilP9Zx9O",
"amount": 110.00,
"currency": "USD",
"date": "2020-06-30",
"description": "Invoice Nº 10923"
"source": null,
"payment_date": null,
"customer": "cus_APxT9s7X12ilP9Zx9O",
"invoice": "inv_XsTY9J7C12iAD9Zc1J",
"status": "requires_payment_method",
"metadata": {},
"created": "2020-06-17 14:21:32",
"updated": "2020-06-17 14:21:32"
}
],
"amount": 110.00,
"exempt": 0,
"tax": 0,
"tax_percent": 0,
"subtotal": 110.00,
"discount": 10.00,
"discount_scheme": "$",
"total": 100.00,
"period_start": "2020-06-01",
"period_end": "2020-06-31",
"local_file": null,
"note": "Chargeable to 2020-06-31",
"fiscal_settings": {},
"status": "finalized",
"metadata": {},
"user": "tony@stark.com",
"created": "2020-06-17 14:21:32",
"updated": "2020-06-17 14:21:32"
}
Retrieve an invoice PDF
GET
https://api.piriod.com/invoices/{id}/pdf/
This endpoint retrieves a PDF representation of the invoice. Returns a Blob encoded in Base64.
Path Parameters
{
"file": "JVBERi0xLjcKJeLjz9MKNiAwIG9iago8PCAvVHlwZSAvUGFnZS..."
}
Last updated