Previously, I used Paypal Subscription links on my website, clicking which, users can go to Paypal payment page, pay the amount there and become subscriber.
Now, I want to receive webhooks, whenever my subscriber updates or cancels his subscription. Therefore, am using following code to render Paypal buttons via which users can now buy subscriptions. I have setup corresponding webhooks against the below mentioned client-id
in My Apps section in Paypal. This is all working for new subscriptions.
<div id="paypal-button-container-P-XXX"></div>
<script src="https://www.paypal.com/sdk/js?client-id=XXXXXX&vault=true&intent=subscription" data-sdk-integration-source="button-factory"></script>
<script>
paypal.Buttons({
style: {
shape: 'rect',
color: 'gold',
layout: 'vertical',
label: 'subscribe'
},
createSubscription: function(data, actions) {
return actions.subscription.create({
/* Creates the subscription */
plan_id: 'P-XXX'
});
},
onApprove: function(data, actions) {
alert(data.subscriptionID);
}
}).render('#paypal-button-container-P-XXX'); // Renders the PayPal button
</script>
I want to know, whether there is a way so that I can setup or receive webhooks for my old subscribers as well, which subscribed through the Subscriber Plan link?
Subscriptions are permanently tied to the Client ID they were created with.
You can subscribe to webhooks for that app's Client ID in https://www.paypal.com/signin?intent=developer&returnUri=https%3A%2F%2Fdeveloper.paypal.com%2Fdeveloper%2Fapplications
Verification of such webhooks will be different, so depending on your verfication method (if any) you should send such webhooks to a different URL to be able to tell the difference.