Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
python-billtobox-api
Readme
Wrapper for the Bill-To-Box / BanqUP (UnifiedPost) API - v4
This package is limited to PurchaseInvoices at this moment.
Install with pip
pip install python-billtobox-api
Import the package and the BillToBoxAPI.
from billtobox.api import BillToBoxAPI
Make the connection with your created CLIENTID and CLIENTSECRET.
api = BillToBoxAPI(CLIENTID, CLIENTSECRET)
BillToBox authentcation is build on OAuth2. A basic script to obtain your first tokens can be found below.
from billtobox.api import BillToBoxAPI
REDIRECT_URI = 'https://any-url-will-do.com/callback/'
api = BillToBoxAPI(CLIENTID, CLIENTSECRET)
authUrl = api.authHandler.getAuthURL(REDIRECT_URI)
print('visit url: ', authUrl)
response = input('paste response: ')
token = api.authHandler.retrieveToken(response, redirectUri=REDIRECT_URI)
When using the script above, any REDIRECT_URI will do. Simply copy and paste the response URI so the handler can obtain the right tokens.
You can choose to make use of the UAT/Test environment instead of production by specifying an extra parameter demo and setting it to True.
api = BillToBoxAPI(CLIENTID, CLIENTSECRET, demo=True)
Be aware that the UAT environment uses a different CLIENTID and CLIENTSECRET than the production environment.
Field | Remarks |
---|---|
id | |
purchase_invoice_uuid | UUID |
purchase_invoice_number | |
client_creditor_purchase_invoice_number | |
client_creditor_number | |
creditor_number | |
client_number | |
amount | |
vat_amount | |
currency_code | |
creditor_currency_code | |
purchase_invoice_date | |
purchase_invoice_due_date | |
platform_id | |
invoice_lines | Contains an InvoiceLineList object |
Field |
---|
id |
service_name |
service_description |
service_quantity |
service_price |
service_vat |
Get all the purchase invoices. You can limit the size or specify the page. The maximum size is 50, increase the page if you would to see more invoices. Default page is 0 and default size is 50. Optionally you can specify the field to sort. Default field to sort by is client_id.
Returns a PurchaseInvoiceList object.
purchaseInvoices = api.purchaseInvoices.list(page=0, size=50, sort='client_id')
# Is the same as
purchaseInvoices = api.purchaseInvoices.list()
for invoice in purchaseInvoices.items():
print(invoice.id)
print(invoice.amount)
for line in invoice.invoice_lines.items():
print(line.service_name)
print(line.service_price)
Get a specific purchase invoice by its ID. Returns a PurchaseInvoice object.
invoice = api.purchaseInvoices.get(ID)
print(invoice.id)
Get a specific purchase invoice by its UUID (different than the ID). Returns a PurchaseInvoice object.
At this moment there is no built-in function in the API to retrieve an invoice by its UUID. This function will thus loop over all the invoices and returns the invoice with the requested UUID. This is the reason why the function may run slow if you have a lot of invoices in your account.
invoice = api.purchaseInvoices.getByUUID(UUID)
print(invoice.id)
Deletes a specific purchase invoice by its ID.
invoice = api.purchaseInvoices.delete(ID)
FAQs
Wrapper for the Bill-To-Box / BanqUP (UnifiedPost) API - v4
We found that python-billtobox-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.