Reputation: 3731
I'm using Paypal's REST-API to create billing agreements.
It's rather convoluted surrounding recurring payments and I need to discover which webhook event I should be listening for when a recurring payment has been made as at that point I need to increment the amount of days left a respective account has.
Reference: https://developer.paypal.com/docs/integration/direct/webhooks/event-names/
Upvotes: 0
Views: 702
Reputation: 3731
The event name I was looking for was PAYMENT.SALE.COMPLETED
to make sure it's from a Billing Agreement for recurring payments check for the existence of billing_agreement_id
eg
$data = json_decode(file_get_contents("php://input"), true);
$data = $data['resource'];
if (!array_key_exists('billing_agreement_id', $data)) {
// Not a payment for a billing agreement
// handle single payments or:
die();
}
Upvotes: 1
Reputation: 342
The event name for recurring payment should be PAYMENT.SALE.COMPLETED .
Upvotes: 0