PayPal Subscription Failed Payment Webhook flow - paypal

i was wondering what webhook is sent when a subscription payment fails?. I wish to downgrade a user on my website if a payment isn't made/fails. but im unsure if the 'Billing.Subscription.Cancelled or Billing.Subscription.Suspended is sent.' I have the "max_fail_attempts": "1".
Thanks

Paypal apis & documents are suck. you can check this link
https://www.paypal-community.com/t5/Webhooks-REST-APIs/regarding-webhook-of-billing-agreement/td-p/1450631
I never see this callback sent, now i give up these webhooks and try IPN instead, hope it works.
there is another link maybe help, in 2015 guys said webhooks supports for recurring payment is in progress, I think it still in progress now.
https://github.com/paypal/PayPal-PHP-SDK/issues/242

Related

Buy with pay now vs pay with subscription on IPN paypal

I'm having problem with payment on subscription IPN paypal.
If I set cmd is '_xclick-subscriptions', after payment, I saw IPN response to update my db is very slow.
But if I set cmd is '_xclick', after paypmen, I saw IPN response to update my db is very quickly, seems immediate...
Does anyone know about this problem. Could you help me??
Thanks you so much!
If you rely on time then you need to use Express Checkout for subscriptions.
This is because you won't need to wait for an IPN notification to update your database, instead you will get the answer from paypal right away in an API call.
In your case you will need the credentials of the person who will receive the money, not the person who is going to subscribe. You need the follow the process described here: developer.paypal.com/docs/classic/express-checkout/
Here you can see some diagrams: here

Paypal IPN for subscription agreement

I have integrated Paypal subscription plan, and subscribing the plan in rails app. Now I am looking to integrate webhooks for paypal payments. I am really struggling hard to make paypal work. This is my third question related with Paypal subscription, however I have solved earlier questions by myself. But could do better if there was good documentation in paypal.
I found there are IPN for subscription/recurring payment but I can not find the field with which I can relate the IPN with existing subscription. I am storing subscription_id i.e. agreement_id but in IPN i am not able to find agreement_id.
Please suggest what to do.
Thanks in Advance.
You can put the agreement_id value in the custom field. You should get the custom field back during each IPN.

PayPal Hosted Pro Direct Payment

someone can help. I using PayPals Rest API to make a direct payment. I have a Pro account. The response, I get back from paypal after the autho process, has a status. PayPals documentation says there are 5 different statues that can be returned. (created; approved; failed; canceled; expired ). So my question is, if the status is pending, how can i know if at a latter date the payment has been successful or declined. There is no mention in the documentation to use an IPN. I cant find any documentation on these statues. Any help would really be appreciated.
You could use the Look up a payment resource call to get details about payments that have not completed, such as payments that are created and approved, or if a payment has failed.

Paypal IPN prior to renewal

I am setting up a Paypal IPN for a subscription service. After reviewing the documentation and speaking with Paypal, I'm still unsure as to whether the IPN feature will send out notifications before a subscription is renewed. I've got it to where it will notify a user when their account is charged for the renewal, but there is no prior notification that this transaction will take place.
Does anyone have any experience with setting this up and if it's possible?
Thanks!
IPN only notifies you when a payment is made or its status changes. For subscriptions you won't get one prior to renewal.
If you're using the Recurring Payments API, you can get that via GetRecurringPaymentsProfileDetails, which will tell you when the next billing cycle is.

How can I cancel a paypal recurring payment from my website?

I'm currently integrating the paypal recurring payment process in my website (thanks to https://www.paypal.com/uk/cgi-bin/webscr?cmd=_pdn_subscr_techview_outside) and, for the moment, it works.
But I have a simple question, and I don't find the answer on Internet. Let's say a user deletes his account on my website after 2 months. How can I cancel automatically his subscription ?
Thank you!
It takes a bit of effort to find, but Paypal does publish a guide on subscriptions.
To cancel someone's subscription, you need to create a link to Paypal -- see page 171 of that reference. There doesn't appear to be an API which allows you to cancel their subscription for them: they need to click a link to Paypal and cancel the subscription themselves.
The guide actually says
Paste the code onto you webpage [sic] near text that explains how subscription cancellations work.
Apparently it's possible to cancel recurring payments with the API. See:
Can you cancel a PayPal automatic payment via API? (Subscription created via Hosted button)
This is certainly more complex than the "unsubscribe" button that paypal gives you, but... it could actually work. The "unsubscribe" button requires that people's payments are coming from their PayPal account, which is not the case if they set up recurring payments on a credit card (without logging into PayPal.)