Payment and invoice allocation
I have posted some payments via the payments API with the following JSON:
{
"Value": 0.65,
"DocumentDate": "2022-12-18",
"Invoices": [ {"id": 002049} ],
"Tender": {"id": 1038048},
"Contact": {"id": 12345678},
"Comment": "Test Payment to allocate to invoice",
"PaymentType": "InvoicePayment"
}
The invoice number is correct (and has to be 0 justified otherwise the API fails), the payment is correctly entered in Wild Apricot but the response returns <AllocatedValue>0.0000</AllocatedValue>
As a result, the payment needs to be manually settled in Wild Apricot against that same invoice.
I expected the provision of the invoice number would automatically settle the payment. Did I miss something?
I then tried to settle the payment using the AllocateInvoice API using the following:
https://api.wildapricot.org/v2.2/accounts/123456/payments/12345678/AllocateInvoice
where the accountId and paymentId are valid (i.e., the paymentId is the one returned by the payments API)
The JSON is (the invoiceId must NOT be 0 justified or the validation fails) :
{
"InvoiceId": 2049,
"Amount": 0.65
}
I get a status 400 with the following message: Invalid argument value: 'document'=12345678
Which seems to say it does not recognise the paymentId it just created (or older ones for that matter).
Did I miss something again or are there bugs in the APIs?
Thank you to anyone who can help me with these problems.
-
Robin Nandi commented
Should the Id sent in the payment API be the Invoice Id or the Document Number?
"Invoices": [ {"id": 002049} ],I am trying to do something similar, but getting a 400 error when creating the payment.