Kelvin Lacy Posted October 23, 2021 Share Posted October 23, 2021 These three sales invoices are unpaid and there is 84.00 yet to allocate. Listing all artefacts verify this as the case. (Artefact id's shown below are obfuscated!) Can you suggest what is going wrong? Sage Call: 'https://api.accounting.sage.com/v3.1/contact_allocations' [contact_allocation] => Array ( [transaction_type_id] => CUSTOMER_ALLOCATION [contact_id] => xxxxb5201cc64b4e9c443e1d6e32b325 [date] => 2021-10-11 [allocated_artefacts] => Array ( [0] => Array ( [artefact_id] => xxxxx03160149f887cfaa495da1150d [amount] => 14.00 ) [1] => Array ( [artefact_id] => xxxxxxee62e604c80ae5fe1759fd8aa21 [amount] => 35.00 ) [2] => Array ( [artefact_id] => xxxxx850a72c4c729e0e1abb5d851ee6 [amount] => 35.00 ) [3] => Array ( [artefact_id] => xxxxx72b64d2985e48668ed24cb88 [amount] => -84 ) ) ) 2021-10-23 13:06:30DST: Sage API Response Code: 422 2021-10-23 13:06:30DST: Severity: error 2021-10-23 13:06:30DST: dataCode: RecordInvalid 2021-10-23 13:06:30DST: message: Couldn't find Sales Payable Artefact. Hope you can help, all other calls in the integration are working fine! Link to comment Share on other sites More sharing options...
Steel, Mark Posted October 25, 2021 Share Posted October 25, 2021 Hi Kelvin, thank you for your question. The most common issue, is for the artefact_id param of the receipt/payment to be passed with the transaction_id or contact_payment_id value of the customer_receipt or vendor_payment. You need to ensure you are passing the payment_on_account_id of the unallocated customer_receipt. There's some further information relating to this in our Payments and Receipts guide. "payment_on_account": { "id": "8c6b711758544eb0bd1a6a5a44238dce", "displayed_as": "API Allocation", "$path": "/contact_payments/140fd1bfd9584841bc557392fce39f09", "created_at": "2021-10-25T08:21:34Z", "updated_at": "2021-10-25T08:46:38Z", "contact_name": "Mikes Insurance Services", "contact_reference": "MIB001", "contact": { "id": "959358c0b35d4443b3f8b4b41f6cd49d", "displayed_as": "Mikes Insurance Services (MIB001)", "$path": "/contacts/959358c0b35d4443b3f8b4b41f6cd49d" }, Please let us know if you require any further guidance. Thanks Mark Link to comment Share on other sites More sharing options...
Kelvin Lacy Posted October 26, 2021 Author Share Posted October 26, 2021 Thanks Mark, yes in a certain situation (this being it!) I was indeed passing the returned transaction id rather than the payment_on_account_id. Link to comment Share on other sites More sharing options...
Kelvin Lacy Posted October 29, 2021 Author Share Posted October 29, 2021 Mark - am I correct in assuming Sage then creates a new receipt for any residual unallocated amount? And it should then be returned if I list all contact payments? Link to comment Share on other sites More sharing options...
Steel, Mark Posted October 29, 2021 Share Posted October 29, 2021 Hi Kelvin When partially or fully allocating a customer_receipt or supplier_payment, the originating transaction would still be returned by the contact_payments endpoint with the outstanding_amount reflecting the unallocated amount of the receipt. A new contact_payment is not created if only a partial amount is allocated. When a customer_receipt or supplier_payment is allocated to an artefact a contact_allocation record is created. I've attached the response for an unallocated customer_receipt, a partially allocated customer_receipt and the contact_allocation created after the allocation. Unallocated customer_receipt { "id": "31f05ad7ddcc4ad7b630841557e1722b", "displayed_as": "Cust Receipt", "$path": "/contact_payments/31f05ad7ddcc4ad7b630841557e1722b", "created_at": "2021-10-29T10:23:37Z", "updated_at": "2021-10-29T10:23:37Z", "links": [ { "href": "https://accounts-extra.sageone.com/advanced_uk/customer_income_payments/341592836", "rel": "alternate", "type": "text/html" } ], "transaction": { "id": "f60e04323e214c1eb7379459e0f33744", "displayed_as": "Cust Receipt", "$path": "/transactions/f60e04323e214c1eb7379459e0f33744" }, "transaction_type": { "id": "CUSTOMER_RECEIPT", "displayed_as": "Customer Receipt", "$path": "/transaction_types/CUSTOMER_RECEIPT" }, "payment_method": { "id": "CREDIT_DEBIT", "displayed_as": "Credit/Debit Card", "$path": "/payment_methods/CREDIT_DEBIT" }, "contact": { "id": "fcaeb413a8524020ba42606182b407c1", "displayed_as": "First Customer (1stCust)", "$path": "/contacts/fcaeb413a8524020ba42606182b407c1" }, "bank_account": { "id": "5942e91ca0ac4d13b96ed6bd9cd1f156", "displayed_as": "Bank Account (1200)", "$path": "/bank_accounts/5942e91ca0ac4d13b96ed6bd9cd1f156" }, "date": "2021-10-29", "net_amount": "0.0", "tax_amount": "0.0", "total_amount": "100.0", "currency": { "id": "GBP", "displayed_as": "Pound Sterling (GBP)", "$path": "/currencies/GBP" }, "exchange_rate": "1.0", "base_currency_net_amount": "0.0", "base_currency_tax_amount": "0.0", "base_currency_total_amount": "100.0", "base_currency_currency_charge": "0.0", "reference": "Cust Receipt", "allocated_artefacts": [], "tax_rate": null, "payment_on_account": { "id": "eb3e768589a64c2591d42b40217875c2", "displayed_as": "Cust Receipt", "$path": "/contact_payments/31f05ad7ddcc4ad7b630841557e1722b", "created_at": "2021-10-29T10:23:37Z", "updated_at": "2021-10-29T10:23:37Z", "contact_name": "First Customer", "contact_reference": "1stCust", "contact": { "id": "fcaeb413a8524020ba42606182b407c1", "displayed_as": "First Customer (1stCust)", "$path": "/contacts/fcaeb413a8524020ba42606182b407c1" }, "date": "2021-10-29", "reference": "Cust Receipt", "net_amount": "100.0", "tax_amount": "0.0", "total_amount": "100.0", "outstanding_amount": "100.0", "currency": { "id": "GBP", "displayed_as": "Pound Sterling (GBP)", "$path": "/currencies/GBP" }, "exchange_rate": "1.0", "base_currency_net_amount": "100.0", "base_currency_tax_amount": "0.0", "base_currency_total_amount": "100.0", "base_currency_outstanding_amount": "100.0", "status": { "id": "UNPAID", "displayed_as": "Unpaid", "$path": "/artefact_statuses/UNPAID" } }, "editable": true } Partially allocated customer_receipt { "id": "31f05ad7ddcc4ad7b630841557e1722b", "displayed_as": "Cust Receipt", "$path": "/contact_payments/31f05ad7ddcc4ad7b630841557e1722b", "created_at": "2021-10-29T10:23:37Z", "updated_at": "2021-10-29T10:28:38Z", "links": [ { "href": "https://accounts-extra.sageone.com/advanced_uk/customer_income_payments/341592836", "rel": "alternate", "type": "text/html" } ], "transaction": { "id": "f60e04323e214c1eb7379459e0f33744", "displayed_as": "Cust Receipt", "$path": "/transactions/f60e04323e214c1eb7379459e0f33744" }, "transaction_type": { "id": "CUSTOMER_RECEIPT", "displayed_as": "Customer Receipt", "$path": "/transaction_types/CUSTOMER_RECEIPT" }, "payment_method": { "id": "CREDIT_DEBIT", "displayed_as": "Credit/Debit Card", "$path": "/payment_methods/CREDIT_DEBIT" }, "contact": { "id": "fcaeb413a8524020ba42606182b407c1", "displayed_as": "First Customer (1stCust)", "$path": "/contacts/fcaeb413a8524020ba42606182b407c1" }, "bank_account": { "id": "5942e91ca0ac4d13b96ed6bd9cd1f156", "displayed_as": "Bank Account (1200)", "$path": "/bank_accounts/5942e91ca0ac4d13b96ed6bd9cd1f156" }, "date": "2021-10-29", "net_amount": "0.0", "tax_amount": "0.0", "total_amount": "100.0", "currency": { "id": "GBP", "displayed_as": "Pound Sterling (GBP)", "$path": "/currencies/GBP" }, "exchange_rate": "1.0", "base_currency_net_amount": "0.0", "base_currency_tax_amount": "0.0", "base_currency_total_amount": "100.0", "base_currency_currency_charge": "0.0", "reference": "Cust Receipt", "allocated_artefacts": [], "tax_rate": null, "payment_on_account": { "id": "eb3e768589a64c2591d42b40217875c2", "displayed_as": "Cust Receipt", "$path": "/contact_payments/31f05ad7ddcc4ad7b630841557e1722b", "created_at": "2021-10-29T10:23:37Z", "updated_at": "2021-10-29T10:28:38Z", "contact_name": "First Customer", "contact_reference": "1stCust", "contact": { "id": "fcaeb413a8524020ba42606182b407c1", "displayed_as": "First Customer (1stCust)", "$path": "/contacts/fcaeb413a8524020ba42606182b407c1" }, "date": "2021-10-29", "reference": "Cust Receipt", "net_amount": "100.0", "tax_amount": "0.0", "total_amount": "100.0", "outstanding_amount": "40.0", "currency": { "id": "GBP", "displayed_as": "Pound Sterling (GBP)", "$path": "/currencies/GBP" }, "exchange_rate": "1.0", "base_currency_net_amount": "100.0", "base_currency_tax_amount": "0.0", "base_currency_total_amount": "100.0", "base_currency_outstanding_amount": "40.0", "status": { "id": "PART_PAID", "displayed_as": "Part Paid", "$path": "/artefact_statuses/PART_PAID" } }, "editable": false } Contact Allocation { "id": "0116c21b757d40849fbd7c6418d9d1ba", "displayed_as": "Customer Allocation - 2021-10-29", "$path": "/contact_allocations/0116c21b757d40849fbd7c6418d9d1ba", "created_at": "2021-10-29T10:28:38Z", "updated_at": "2021-10-29T10:28:38Z", "links": [ { "href": "https://accounts-extra.sageone.com/advanced_uk/customer_allocations/341595775", "rel": "alternate", "type": "text/html" } ], "transaction": { "id": "7a0db27bcf654f0d8e111d4a53c08ab9", "displayed_as": null, "$path": "/transactions/7a0db27bcf654f0d8e111d4a53c08ab9" }, "transaction_type": { "id": "CUSTOMER_ALLOCATION", "displayed_as": "Customer Allocation", "$path": "/transaction_types/CUSTOMER_ALLOCATION" }, "date": "2021-10-29", "contact": { "id": "fcaeb413a8524020ba42606182b407c1", "displayed_as": "First Customer (1stCust)", "$path": "/contacts/fcaeb413a8524020ba42606182b407c1" }, "allocated_artefacts": [ { "id": "487c248afd604cd2abc4dfae7557882c", "artefact": { "id": "af401321111a40a082bd81212d9e83e8", "displayed_as": "SI-1", "$path": "/sales_invoices/af401321111a40a082bd81212d9e83e8", "links": [ { "href": "https://accounts-extra.sageone.com/invoicing/sales_invoices/af401321111a40a082bd81212d9e83e8", "rel": "alternate", "type": "text/html" }, { "href": "https://accounts-extra.sageone.com/advanced_uk/online_payment/gb03c71a2e65eba76e533318d18a53c66fcd96481f9eb02a264cc99e85db5178eb4bd9ff903b32d2b7ad5ddfeb891c47d2782ec816a92c2e1d2e8fbb5aca778904e79eb8603c3ebcb78e97ed1465563fa37b0453a61846201857f98a7843655cb3c11ffe52d4a8b5c39b53c07ba4a49fba", "rel": "bookmark", "type": "text/html" } ] }, "amount": "60.0" }, { "id": "ec6c894df95b47e3800f0816986b55e9", "artefact": { "id": "eb3e768589a64c2591d42b40217875c2", "displayed_as": "Cust Receipt", "$path": "/contact_payments/31f05ad7ddcc4ad7b630841557e1722b", "links": [ { "href": null, "rel": "alternate", "type": "text/html" } ] }, "amount": "-60.0" } ] } 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