0

When accommodating event types for a PayPal webhook listener in my backend for a subscription plan I created, is it possible to receive the plan_id and custom_id parameters in PAYMENT.SALE.COMPLETED events? Or are they only going to be accessible from BILLING.SUBSCRIPTION.* events?

I need a dependable method of updating my database whenever a given user is automatically billed in the cycle. From what I have read, it sounds like the only option is the PAYMENT.SALE.COMPLETED event- but, I haven't been able to test this event with my current subscription (it has a trial period) and I have only been able to verify that BILLING.SUBSCRIPTION.* events pass along the plan_id and custom_id from my react button in my frontend.

If not, then how can we possibly correlate subscription events effectively with the user that completed a payment, without the ability to pass along these two parameters?

skyboyer
  • 22,209
  • 7
  • 57
  • 64
Matt
  • 51
  • 5

1 Answers1

1

custom_id is returned. I don't know about plan_id but the sandbox environment exists to answer your question

PAYMENT.SALE.COMPLETED is the only important event to listen for. BILLING.SUBSCRIPTION events are in general not useful for any concrete purpose.

Preston PHX
  • 27,642
  • 4
  • 24
  • 44
  • I am new to using Paypal Webhooks, etc., but I think you should also listen to BILLING.SUBSCRIPTION.CANCEL . As a Paypal end user, I can end a subs from within Paypal. – user1889992 May 08 '23 at 14:19
  • The absence of a cancel event doesn't mean the payment is going to be successful. So until a successful payment arrives (or does not, and it lapses), the logic is the same and the cancel event adds no information other than a preview indicator that it's going to lapse. There is no action that needs to be taken based on this. – Preston PHX May 08 '23 at 14:36
  • If calling a BILLING webhook, you get custom_id. If PAYMENT, you get custom (not custom_id) from what I have seen. – user1889992 May 08 '23 at 19:48
  • @PrestonPHX You are saying that the PAYMENT.SALE.COMPLETED is the only important event to listen for, But it does not have the next billing date listed for the recurring payents. I am using BILLING.SUBSCRIPTION.ACTIVATED in order to get the next billing payment due in order to show the user from their control panel within my web application. AND the PAYMENT.SALE.COMPLETED is completely unreliable when it comes to the back end. I have waited 6 hours on the webhook before it finally propagates to my back end. So in the mean time, I'm using the BILLING.SUBSCRIPTION.ACTIVATED in order to..... – Cavalier Jul 17 '23 at 21:35
  • immediately approve the users member access. Then I wait for the payment.sale.completed or payment.sale.failed or payment.sale.denied and then I go back and adjust the user's access accordingly. It is not perfect because the user could get up to 5 hours time of free access because the webhook takes so long. – Cavalier Jul 17 '23 at 21:39
  • @PrestonPHX when the payment.sale.completed is taking so long, is there a way to speed it up? perhaps... When the billing.subscription.activated goes through, do a call to paypal to check for the payement.sale.completed manually rather than waiting for the webhook? – Cavalier Jul 17 '23 at 21:41
  • You can query the status separately https://stackoverflow.com/questions/72869634/paypal-sandbox-webhooks-like-payment-sale-completed-for-subscriptions-very-slow – Preston PHX Jul 17 '23 at 21:50