Norman Firkins Posted August 8, 2021 Share Posted August 8, 2021 Hi there, Just wondering how I can set the status_id of an invoice when I create it. At the moment when I create an invoice, they automatically are set as overdue. Here is my code, if you have any ideas they would be much appreciated url = 'https://api.accounting.sage.com/v3.1/sales_invoices' payload = { "sales_invoice": { "contact_id": contact_id, "date": date, "due_date": date, "reference": reference, "invoice_lines": products, "status_id": 'PAID' } } headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + access_token, } response = requests.request("POST", url, headers=headers, json=payload) Thank you Link to comment Share on other sites More sharing options...
Steel, Mark Posted August 9, 2021 Share Posted August 9, 2021 Hi Norman, thank you for your question. The status_id of artefacts is read only and cannot and should not be set directly. They are given their various statuses based on dates, such as date and due_date and payment/credit allocations. If you're creating an invoice with both a date and due_date of today, the invoice will be automatically given the status of overdue as it is expecting payment that same day. There are a couple of guides available that will help you further with this. Artefact Statuses, Payments & Receipts Thanks Mark Link to comment Share on other sites More sharing options...
Norman Firkins Posted August 9, 2021 Author Share Posted August 9, 2021 @Steel, Mark So I'm assuming I would have to create a contact payment which is associated with a bank account and the artefact(sales invoices), then the invoice will be displayed as paid? Thank you for the help Link to comment Share on other sites More sharing options...
Steel, Mark Posted August 9, 2021 Share Posted August 9, 2021 @Norman Firkins Yes that's correct, you would need to create a payment or credit_note and allocate it to the sales_invoice. On successful allocation the payment status will be displayed as paid or part paid depending on the value of the payment or credit. Thanks Mark Link to comment Share on other sites More sharing options...
Norman Firkins Posted August 9, 2021 Author Share Posted August 9, 2021 @Steel, Mark Just a quick question with creating a Contact Payment, where can I find the transaction_type_id? Thank you Link to comment Share on other sites More sharing options...
Steel, Mark Posted August 9, 2021 Share Posted August 9, 2021 @Norman Firkins The transaction_types endpoint returns all available transaction types including the id. { "$total": 41, "$page": 1, "$next": "/transaction_types?page=2&items_per_page=20", "$back": null, "$itemsPerPage": 20, "$items": [ { "id": "BANK_OPENING_BALANCE", "displayed_as": "Bank Opening Balance", "$path": "/transaction_types/BANK_OPENING_BALANCE" }, { "id": "BANK_PAYMENT", "displayed_as": "Bank Payment", "$path": "/transaction_types/BANK_PAYMENT" }, { "id": "BANK_RECEIPT", "displayed_as": "Bank Receipt", "$path": "/transaction_types/BANK_RECEIPT" }, { "id": "BANK_TRANSFER", "displayed_as": "Bank Transfer", "$path": "/transaction_types/BANK_TRANSFER" }, { "id": "CORRECTION", "displayed_as": "Correction", "$path": "/transaction_types/CORRECTION" }, { "id": "CUSTOMER_ALLOCATION", "displayed_as": "Customer Allocation", "$path": "/transaction_types/CUSTOMER_ALLOCATION" }, { "id": "CUSTOMER_RECEIPT", "displayed_as": "Customer Receipt", "$path": "/transaction_types/CUSTOMER_RECEIPT" }, { "id": "CUSTOMER_REFUND", "displayed_as": "Customer Refund", "$path": "/transaction_types/CUSTOMER_REFUND" }, { "id": "DEPOSIT", "displayed_as": "Deposit", "$path": "/transaction_types/DEPOSIT" }, { "id": "JOURNAL", "displayed_as": "Journal", "$path": "/transaction_types/JOURNAL" }, { "id": "GENERAL_LEDGER_OPENING_BALANCE", "displayed_as": "Journal Opening Balance", "$path": "/transaction_types/GENERAL_LEDGER_OPENING_BALANCE" }, { "id": "OTHER_RECEIPT", "displayed_as": "Other Receipt", "$path": "/transaction_types/OTHER_RECEIPT" }, { "id": "OTHER_PAYMENT", "displayed_as": "Other Payment", "$path": "/transaction_types/OTHER_PAYMENT" }, { "id": "PURCHASE_QUICK_ENTRY_CREDIT_NOTE", "displayed_as": "Purchase QE Credit", "$path": "/transaction_types/PURCHASE_QUICK_ENTRY_CREDIT_NOTE" }, { "id": "PURCHASE_QUICK_ENTRY_INVOICE", "displayed_as": "Purchase QE Invoice", "$path": "/transaction_types/PURCHASE_QUICK_ENTRY_INVOICE" }, { "id": "PURCHASE_INVOICE", "displayed_as": "Purchase Invoice", "$path": "/transaction_types/PURCHASE_INVOICE" }, { "id": "PURCHASE_CREDIT_NOTE", "displayed_as": "Purchase Credit Note", "$path": "/transaction_types/PURCHASE_CREDIT_NOTE" }, { "id": "SALES_QUICK_ENTRY_CREDIT_NOTE", "displayed_as": "Sales QE Credit", "$path": "/transaction_types/SALES_QUICK_ENTRY_CREDIT_NOTE" }, { "id": "SALES_QUICK_ENTRY_INVOICE", "displayed_as": "Sales QE Invoice", "$path": "/transaction_types/SALES_QUICK_ENTRY_INVOICE" }, { "id": "SALES_CREDIT_NOTE", "displayed_as": "Sales Credit Note", "$path": "/transaction_types/SALES_CREDIT_NOTE" } ] } Thanks Mark Link to comment Share on other sites More sharing options...
Norman Firkins Posted August 9, 2021 Author Share Posted August 9, 2021 @Steel, Mark Thanks Mark thats great. I'm having trouble with searching for a sales invoice by reference. Here's my code, am I doing anything wrong? Thank you url = 'https://api.accounting.sage.com/v3.1/sales_invoices?search=' + reference + ',status_id=paid' headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + access_token, } response = requests.request("GET", url, headers=headers) Link to comment Share on other sites More sharing options...
Steel, Mark Posted August 9, 2021 Share Posted August 9, 2021 @Norman Firkins The API requires & rather than + when you're using multiple query params and no separator(comma) is required. sales_invoices?search=SI-56&status_id=PAID Thanks Mark Link to comment Share on other sites More sharing options...
Jake Bosman Posted September 9, 2021 Share Posted September 9, 2021 Hi We have a woocommerce invoice that was paid by stripe, how do we set this as paid? Link to comment Share on other sites More sharing options...
Steel, Mark Posted September 9, 2021 Share Posted September 9, 2021 Hi Jake How do your stripe payouts appear in the Bank Account? A lot will depend on how your stripe account is configured within Sage Business Cloud Accounting. Was the registration for stripe payments setup through Sage Business Cloud Accounting or external to it? The payments need to be seen as customer receipts in order for them to be allocated in the API. Our Payments and Receipts guide offers further guidance on this. Thanks Mark Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now