1
votes

I've implemented PayPal Billing subscription using PayPal-PHP-SDK, everything is working fine as expected, the user can cancel the subscription from the application with this code.

$agreementStateDescriptor = new AgreementStateDescriptor();
$agreementStateDescriptor->setNote("Suspending the Agreement.");

$agreement->suspend($agreementStateDescriptor, $apiContext);

But if the user cancel the subscription from his PayPal account, my application will not be notified for it, how it can be addressed? is there any webhook as Stripe or something.

https://github.com/paypal/PayPal-PHP-SDK/

Thanks

1

1 Answers

-1
votes

you need to create a Paypal webhook for your app.

Set an URL (accessible URL) i.e. yourdomain/paypal/resolver

then register event BILLING.SUBSCRIPTION.CANCELLED.

Once the user cancel the agreement from Paypal, the webhook for BILLING.SUBSCRIPTION.CANCELLED event is activated and send a request to your site.

FYI, the samples provided from this link http://paypal.github.io/PayPal-PHP-SDK/sample/ are pretty much useful