I'm using the Resource_Management > Get_Supplier_Invoices operation and the Financial_Management > Get_Payments operation but can't work out how to associate payments to supplier invoices. I've read the endpoint docs, analysed the XML responses and Googled everything I can think of but no luck. What am I missing?
I'm using the Resource_Management > Get_Supplier_Invoices operation and the Financial_Management > Get_Payments operation but can't work out how to associate payments to supplier invoices. I've read the endpoint docs, analysed the XML responses and Googled everything I can think of but no luck. What am I missing?
Share Improve this question edited Mar 20 at 11:21 DarkBee 15.5k8 gold badges72 silver badges117 bronze badges asked Mar 20 at 11:17 Rhys JonesRhys Jones 5,5061 gold badge24 silver badges44 bronze badges1 Answer
Reset to default 0To link invoices and payments, look for key fields like Invoice_ID, Invoice_Number, or an Allocation
section in the payment response. Use a direct link (e.g., Invoice_ID
) if available; otherwise, match by Supplier_ID
and validate with Payment_Amount
and Invoice_Amount
.
If payments reference allocations, use those details to associate them with invoices. For workflows, directly match `Invoice_ID` or, if missing, infer relationships using supplier, amounts, and dates.
Example
supplier_invoices = [
{"Invoice_ID": "INV-001", "Supplier_ID": "SUP-001", "Invoice_Amount": 1000.00, "Due_Date": "2023-10-15"},
{"Invoice_ID": "INV-002", "Supplier_ID": "SUP-002", "Invoice_Amount": 500.00, "Due_Date": "2023-10-20"},
]
payments = [
{"Payment_ID": "PAY-101", "Supplier_ID": "SUP-001", "Payment_Amount": 1000.00, "Invoice_Reference": "INV-001", "Payment_Date": "2023-10-14"},
{"Payment_ID": "PAY-102", "Supplier_ID": "SUP-002", "Payment_Amount": 500.00, "Payment_Date": "2023-10-18"},
]
linked_data = []
for payment in payments:
for invoice in supplier_invoices:
# Case A: Direct match using Invoice_ID
if payment.get("Invoice_Reference") == invoice.get("Invoice_ID"):
linked_data.append({"Payment_ID": payment["Payment_ID"], "Invoice_ID": invoice["Invoice_ID"]})
# Case B: Match by Supplier_ID and Amount
elif payment.get("Supplier_ID") == invoice.get("Supplier_ID") and payment.get("Payment_Amount") == invoice.get("Invoice_Amount"):
linked_data.append({"Payment_ID": payment["Payment_ID"], "Invoice_ID": invoice["Invoice_ID"]})
for link in linked_data:
print(f"Payment {link['Payment_ID']} is linked to Invoice {link['Invoice_ID']}")