I have implemented Paypal subscription with a seven-day free trial, then the payment is captured if the user did not cancel his subscription. which webhook event is fired in the normal case (payment done after trial period)?
All Subscription payments will result in the event PAYMENT.SALE.COMPLETED the moment the transaction completes.
Other than BILLING.SUBSCRIPTION.ACTIVATED for the case of trials starting without a payment, you can build all subscription logic based on listening for just PAYMENT.SALE.COMPLETED and making a note of when you expect the next one. Other billing subscription events aren't necessary nor useful to track.
Related
I'm integrating PayPal payment gateway into my application. I'm using the PayPal REST API's. I'm able to authorize the request and webhook. Also, API and webhooks are working fine for me. The only thing about I'm little confused that which event and sequences of events will be if subscription payment failed?
For subscriptions, the only event you need to act on is PAYMENT.SALE.COMPLETED. When you receive this event, update the profile's valid date through the next cycle (e.g. 1 month in the future). If you don't receive a new PAYMENT.SALE.COMPLETED in time, the subscription has lapsed.
When creating the subscription you can set a custom_id which is useful for reconcilliation.
I implement a subscription site in which the subscriptions plans are monthly.
I use IPN to handle subscription events.
Now, If a recurring payment failed, I will get the relevant event and will cancel the subscription in my side.
But, what should I do when a user cancels his subscription via my site, and he still has time left in his subscription, and I want to cancel the subscription only in the end of the subscription period?
What can I do if the user cancels his subscription via PayPal and still has time left in his subscription?
In stripe you simply set "cancel_at_period_end=true" and then it's the same scenario.
There is no equivalent, PayPal doesn't keep track of anything for you. You'll receive cancel events whenever a profile is cancelled.
If you want to keep track of paid-through periods, that logic is up to you.
I was searching a while and also read the paypal docs but I am unable to find an answer to my question. I created a recurring payment with Paypal Express Checkout. Everything is working fine, but now I need to know a little bit more about webhooks.
Assume a user registered and created a recurring subscription. The set-up fee is 0,00€ and the first payment will be in one week. After the first payment, the billing cycle will be every week. Now about my webhook question: I guess I need to use the PAYMENT.SALE.COMPLETED webhook am I right? As soon as I get paid every week, the PAYMENT.SALE.COMPLETED webhook will fire for every successfull payment and therefore add a new entry inside my database. Am I right? Or do I need to use another webhook for recurring payments?
Is there someone who uses this webhook in combination of a recurring subscription? Would be great if someone can help me out understanding if PAYMENT.SALE.COMPLETED is the correct webhook for recurring subscriptions.
Yes, PAYMENT.SALE.COMPLETED is sent after every successful billing event for a subscription.
Here is an example timeline of a subscription sale on my website:
2021-07-30 13:17:13.143: PAYMENT.SALE.COMPLETED - first payment
2021-07-30 13:17:10.679: BILLING.SUBSCRIPTION.ACTIVATED
2021-07-30 13:16:15.032: BILLING.SUBSCRIPTION.CREATED - this came after the one above, so make sure you can handle that
2021-08-30 11:13:05.321: PAYMENT.SALE.COMPLETED with "state"=>"completed" - second recurring payment
2021-09-08 14:34:44.816: PAYMENT.SALE.COMPLETED with "state"=>"completed","payment_hold_status"=>"RELEASED" - this is the release of the second recurring payment
If the recurring payment fails, you will receive BILLING.SUBSCRIPTION.PAYMENT.FAILED. Paypal retries the payment 3 times. See the attribute next_payment_retry_time which is set to null after the 3rd and final failed payment attempt.
You can configure your billing plan to automatically suspend a subscription after x number of failed payments (note: set this to be 1+ because 0 keeps is always active) and/or automatically add the outstanding payments to the next billing cycling.
Screenshot below:
I don't believe you have any choice for which webhook PayPal will send you. I am fighting with this right now because PAYMENT.SALE.COMPLETED is the one they send me, but it doesn't contain enough data for me to match it up with a customer or a shopping cart. I want them to return CHECKOUT.ORDER.COMPLETED instead, but there doesn't seem to be a way to make that happen.
I'm not a developer, but a project manager. So please excuse my lack of proper language.
We are trying to figure out how to handle subscription refunds and then limit account access on the site.
Here's a scenario. Member signs up for an annual subscription to gain certain capabilities in the account. 3 months into it member decides to cancel and requests a refund. Normally, if no refund is issued, subscription is good until the end of the billing period, at which point account is deactivated.
In our case, if a refund is issued, account should be deactivated immediately. Question: is it possible to set this up as part of PayPal Subscriptions? Some type of call from PayPal to our system that will trigger account deactivation.
Thank you.
We recommend using IPN (Instant Payment Notifications) to be asynchronously notified of any events, in this case of those related to existing subscription/recurring payments.
https://developer.paypal.com/webapps/developer/docs/classic/ipn/gs_IPN/
If you enable IPN notifications you will receive a POST of PayPal in the following events (among others):
When a recurring profile is cancelled.
When a refund has been made to a previous completed transaction.
This way, you can set up your IPN script to keep the subscription “open” in your side for the remainder of the month even if the profile has been cancelled, or to deactivate it if the last month has been refunded.
For more information about IPN variables:
https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/
Similar to the post: Does PayPal Standard automatically retry to charge the client if a payment fails?
But about how the client can make it retry manually lets say after they have put more funds into their paypal account but before paypal automatically retries in a few days time.
When you use subscription - the automatic billing is handled by PayPal, and the retrying interval is fixed in this design, the client will not be able to trigger a manual recurring transaction / payment retry.
If the use case behind the question is about how the merchant(you) handles the flexible subscription billing period calculation upon payment failure/retries, it would be recommended that either you make fixed billing period start dates (continue the subscription) regardless of the payment delay, or suspend the client's subscription when payments failed, and resume it (calculate the new start date) when payment retry worked.
Both of the status/events above will trigger IPN messages to your listener, so that you may proceed either logic based on that.