Paypal Subscription, check if user paid for the next month - paypal

i have a service, where i use Paypal subscription. Paypal has webhooks. The problem is that I don't understand which one i need to use, to know if user paid for the next month or not.
I used Billing subscription renewed but i was wrong. Actually there is no documentation, that explains Paypal webhooks
Hope you can help me with that

I had the same issue and then I used
PAYMENT.SALE.COMPLETED webhook event
It will be triggered when a subscription is made and when the subscription is renewed.

Related

Is the INVOICING.INVOICE.SCHEDULED automatically created?

I've implemented PayPal gateway in my application, and I'm looking for a way to send a notification to my customer when an upcoming renewal is coming.
Unfortunately in the documentation I didn't find a depth explaination about INVOICING.INVOICE.SCHEDULED but I'm guessing should be the same as invoice.upcoming of Stripe which is triggered when a recurring payment is going to be renewed.
My question is: INVOICING.INVOICE.SCHEDULED is sended by PayPal automatically when a recurring payment is going to be renewed?
Invoicing and Subscriptions are two separate PayPal products. I would not expect an Invoicing webhook in relation to a Subscription recurring payment.
The subscription webhooks are listed here: https://developer.paypal.com/docs/integration/direct/webhooks/event-names/#subscriptions
If you are looking for one that happens "in advance" of a scheduled payment, I am not aware of one.

How to interprete paypal billing agreement creation?

I am building a paypal subscription system but i have some difficulties to understand some points. When using sandbox i can't simulate a payment denial process so when the payment is made, paypal redirect me to my "approval url callback" and a billing agreement is created.
So i want to know , in a real situation, will paypal redirect me to the approval url and create this billing agreement even if the payment didn't occur yet ? or this one can be created if and only if the payment is accepted ? (So if paypal denied the payment the billing agreement will never be created)
In my case, my customers will need to access to some paid features of my website so, should i wait for the "ipn webhook notification (PAYMENT.SALE.COMPLETED)" which can take several minutes to be fired to my endpoint, or can i grant access immediately after the billing agreement is created ?
Which is the most secure thing to do ?
thanks.
If the user cancels the checkout, Paypal will redirect to your cancel URL.
But the failed payment cases are not clear to me either. I believe that the agreement will be created even if the payment fails, since it needs to exist for the payment attempt to be done, but I don't work at Paypal :).
My approach is to activate the subscription on a successful redirect no matter what, [edit: the execute response returns an agreement_details.next_billing_date in the past, so you can't use that] with a short initial subscription expiration (4h). When our webhook receives a PAYMENT.SALE.COMPLETED message, we fetch the agreement billing agreement details, and update the subscription expiration to the new agreement_details.next_billing_date. But if the webhook receives a PAYMENT.SALE.DENIED, we just let the subscription expire.
HTH.

PayPal Express Checkout - Webhook PAYMENT.SALE.COMPLETED

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.

PayPal Subscriptions - Tracking Refund

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/

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.