Closed hjone72 closed 7 years ago
You can use the API to request a record to see what's sent with the subscription.
So as an example if I had a subscription for a payment, the same information that is returned by looking up that payment using the API is sent with the subscription?
That's correct.
I am not finding that to be the case.
I am calling a simple PHP script that is outputting the json_encode($_POST)
to a file. After triggering the subscription the file only has []
.
Hoping you might be able to point me in a direction to start debugging this.
Here's where we get the data ready to send in the app:
https://github.com/invoiceninja/invoiceninja/blob/master/app/Listeners/SubscriptionListener.php#L143
We use transformers to map the data, for example:
I've added a bit of code to the SubscriptionListener.php
writing the $data array to a file and that works. But I can't seem to access the data at the target_url.
My target URL is the following: http://localhost:8080/in_sdk/processpayment.php
Are there any issues with the URL?
Thank you for your assistance!
Looks ok to me. Is the app on the same port, maybe a firewall/proxy/etc is stripping the post data?
Executing a curl to the same URL with some random post data works fine. Does InvoiceNinja log what data is sent to the subscription?
It doesn't but you could add \Log::info(...)
Thanks for your help. I'll keep looking
So as it turns out... If you send application/json to PHP it won't convert it to POST. You can access it using the following file_get_contents("php://input");
Here is a link with some more details. https://stackoverflow.com/questions/13050716/receiving-a-json-post
Thanks for sharing the solution!
Hi,
I am having trouble accessing the POST data from a new payment subscription call. Do you have any examples of what InvoiceNinja sends with the webhook?
Thanks,