Paypal Sandbox Not Sending Webhook or IPN Notifications - ruby

I'm using the PayPal Adaptive Payments Ruby SDK (https://github.com/paypal/adaptivepayments-sdk-ruby)
What I want to do is send User A an email requesting a PayPal deposit on behalf of User B.
I'm generating a pay_key and redirect URL no problem to PayPal's site. There, User A can login and pay User B through PayPal's site.
The problem is that I need to know when the transaction has completed. One method is to wait for User A to be redirected to a URL on my site, but this isn't very reliable. I'd rather use IPN or Webhooks to receive the notification.
In Sandbox mode, the IPN or Webhooks aren't being triggered, so I can't really test (simulator won't help).
Also, looking at the docs, I am not sure how to map the transaction ID back to the original Pay Key either so that I can tell User A has paid.

I found here (PayPal + RESTful API + WebHooks + Self Signed Certificates) knowing that webhook won't work with self signed cert. Are you using self signed cert. for SSL?

Related

Issue regarding paypal IPN in codeignitor

I am integrating PayPal payment gateway in my code ignitor website. and I am using this ref
https://www.codexworld.com/paypal-payment-gateway-integration-in-codeigniter/
All things are successfully done but payments transaction data is not saved into the database.
I have set the IPN URL in the sandbox business account. And in the IPN history page, It showing IPN was sent successfully. but IPN data not received on my website.
I also test IPN using the IPN simulator. When I put my base URL like https://www.earlyyearz.com/ then IPN was sent successfully. but when I give the path of my IPN function
https://www.earlyyearz.com/payments/ipn then it was saying IPN not sent.
does anyone can help me to fix this.
thanks in advance.
Add logging to your IPN function so you can see what is happening when it receives the data. If your IPN function does not respond with an HTTP 200-level status, PayPal will mark the IPN as not having been received.
IPN is an extremely old service that was not designed for modern web integrations. If this is a new integration, first ask yourself why you are using IPN to begin with (you shouldn't need it for a normal PayPal checkout with server API captures)
But if you really do need asynchronous notifications (again, you shouldn't need them), use webhooks instead of IPN.

Validate whether payment was a success or failure

I am looking to use PayPal to accept a payment through my website. I am looking at the Smart Payment button option. If the payment is successful I need to update something in my website DB. How can I determine whether the payment was successful or not? I cant see anything the API docs.
I also need to retain user context with a PHP session ID. How can I pass that to the paypal site and ensure it is returned with the success / fail indicator?
Use Paypal IPN to receive payment notifications. Setup a server endpoint to respond to IPN requests and update your DB etc...
To maintain state, you will need to include a hidden input filed in your Smart Payment Button with a name of custom and a value of your choice (session id).
Setup a IPN endpoint ie: /checkout/ipn, to receive Paypal notifications. Capture the session ID with $_POST['custom'];
I ended up using the Braintree API for this use case. Ther Brantree API returns a unique payment identifier (payment Nonce) which you can then validate by submitting a call back to the Braintree API to ensure the payment was actually received properly.

Unable to receive webhooks with Sandbox Paypal

I'm trying to get notified via webhooks when a simple payment is made, however I don't receive any request from paypal on the specified URL. Here is what I've done:
I have 2 sandbox accounts: Facilitator and Buyer
Create an app (sanbox mode)
Add a webhook URL in that app
Now I go on woocommerce site where i configured my app with Paypal.
and when I make a payment to buy an item with a buyer account.
In developer dashboard the payment is received if I go to Sandbox -> Notifications: "Notification of Payment Received from test buyer", but the webhook page on my server is not called.
Also if I go to Developer Account -> Webhook Notifications and select the app I have this message: You don't have any events for the selected application
I believe my transactions are not being done correctly.
Can someone please help me with this.?

Regarding uable to trigger Paypal REST API webhook events from developer sandbox

What is wrong with my Paypal sandbox account process
to receive webhook notifications? We are unable to receive webhook event on
my URL.
URL working with "Webhooks simulator". Please let me know what
should I do for receive webhook event on above URL.
Webhooks simulator sends sample payloads for the events you configured. It does not send a notification on triggering of an actual event.
If you are getting notification via Webhooks Simulator, it means the URL configured by you is able to intercept POST requests.
Now for the "Paypal sandbox account unable to process to receive Webhook notifications" part, please check if the transaction is actually created at https://developer.paypal.com/developer/dashboard/sandbox/ . If the transaction you are looking for is not present there, there won't be any notification generated. In case transaction is present there and still you are not getting any notifications, please share debug id.
Here is a silly thing that I overlooked in the documentation and only found out after contacting support.
After you've followed the approval url and gave your approval, dit you execute the payment with the REST API?
https://developer.paypal.com/docs/api/payments/#payment_execute
Webhooks are only called after you've executed the payment.
The confusing part is; there is no webhook being called, when a user approves or cancels a payment. There is only a redirect back to a return url or cancel url. So you either need to monitor the redirect back to your site and trigger the execute call then, or find another way (like polling the payment) to see the status change before calling the execute call.

How to make monthly subscription payment by paypal in php?

I am building a web app in laravel 4.
I tried to make a monthly subscription payment via paypal.
I had added a subscribe button in my billing page.
I have tested the link. It could redirect to paypal site and ask approve.
But how does the server know the user has successfully paid?
After successfull payment paypal sends a IPN to the address u provide...By this notification your server can come to know about the payment.login to paypal account>>setting>>ipn link or url>>and set it to a php file which can recieve ipn variables and detect about the payment

Resources