REST Hooks: invoice.payment.add

I added a REST Hook with event key invoice.payment.add, it works, here is the answer:

{"event_key":"invoice.payment.add","object_type":"invoice.payment","object_keys":[{"apiUrl":"https://api.infusionsoft.com/crm/rest/v1/transactions/14","id":14,"timestamp":"2018-02-27T17:18:14Z"}],"api_url":""}

but 14 is a PaymentId, not a transaction id. If I follow the the apiUrl (with access token of course) it would return an empty string. The real transaction id is 422 (in this example), so the url should be https://api.infusionsoft.com/crm/rest/v1/transactions/422
What is wrong: the url or the id?

I need to get the list of the products from that transaction after the payment. How can I do it? Preferably without querying 3 tables (InvoicePayment, InvoiceItem, and OrderItem)

1 Like

Hi @and_dev it looks like we are giving back the PaymentId which mismatches what the transaction endpoint requires. You would need to first get the correct transaction Id from the orders/{orderId}/transactions endpoint… This looks like an oversight, I have created a ticket for the team to address this.

it’s not orderId either, orderId for this transaction would be 24, not 14. I was experimenting with promotions, when the price is $0, it doesn’t count as a payment, I guess. REST Hook wasn’t triggered.

14 matches PaymentId from the table InvoicePayment, so it requires several steps to get transactionId

Can you update this topic when the issue would be resolved? Thanks

Running into this as well. Following the URL returns an empty response.

This was raised over 2 years ago. Is there an update?

The answer is there but no one like it. You follow the payment id back to get the invoice id. While it might be nice to combine these into one api call, it’s still available this way, just by tracking back the id’s. It would be great if the api allowed for SQL JOINs but it doesn’t so tracking back is at least viable :wink:

I had looked at the REST API docs and couldn’t determine a way of getting the order ID from the paymentID that the webhook sends.

How can I “You follow the payment id back to get the invoice id” using the REST API?

I guess the part I’m missing here is I’d need to use the XML-RPC API to do the lookup?

do you want the order id or the id of the invoice the payment was applied to? an order is just a one time template that all invoices are created from…the payment is made therefor, against the invoice… when you retrieve the payment information it provides a invoice id

NOTE: I realize that IS/Keap have always used the term order a bit loosely and that causes confusion…but clarifying that the payment is against an INVOICE is most important…the ‘get order details or payment etc’ is a mis-use of the terms on their part, non the less, using the REST api, this is what returns the invoice id in question.

image