Receiving a PAYMENT.SALE.COMPLETED webhook notification - how can I trace the parent Subscription

morsagmon
Contributor
Contributor

Hello all.

I'm creating subscriptions for membership customers using the REST API.

I'm also keeping track of all payments transactions on my app's DB.

I'm listening to the PAYMENT.SALE.COMPLETED webhook notification to capture payments made.

However, I cannot identify any data in this event's payload that will help me trace its parent Subscription ID (typically looks like this: I-BW452GLLEP1G).

The only ID keys I see are:

"id": "WH-2WR32451HC0233532-67976317FL4543714",

"resource": {
     "parent_payment": "PAY-1PA12106FU478450MKRETS4A",

     "id": "80021663DE681814L",

 

None of which can lead me to the parent subscription, as far as I could find.

I did include a custom_id value in the Create Subscription call that would point me to the Subscription record in my DB, but I don't see this custom_id as part of the PAYMENT.SALE.COMPLETED payload (at least not as the webhooks mockup simulator generated).

Or maybe my process is not the best practice to track payments on subscriptions for customers?

Thanks!

Mor

Login to Me Too
1 ACCEPTED SOLUTION

Accepted Solutions
Solved

morsagmon
Contributor
Contributor

 

OK, inspecting a real payload coming back for this event from Paypal, I can see my custom attribute I added when creating the subscription is indeed part of the payload and can be accessed with:

event.resource.custom

 

Also, it looks like the subscription_id is also part of this payload:

event.resource.billing_agreement_id

 

 

View solution in original post

Login to Me Too
3 REPLIES 3

Corobori
New Community Member

I am about to start a project where I will need to do the same as you're doing. That obviously would include being informed when payment are made. 

Did you solve the issue ? 

 

Login to Me Too

morsagmon
Contributor
Contributor

Hi Corobori.

 

Haven't received any replies yet. I've only posted here, so we should both know when that happens...

Good luck with your project!

Mor

Login to Me Too
Solved

morsagmon
Contributor
Contributor

 

OK, inspecting a real payload coming back for this event from Paypal, I can see my custom attribute I added when creating the subscription is indeed part of the payload and can be accessed with:

event.resource.custom

 

Also, it looks like the subscription_id is also part of this payload:

event.resource.billing_agreement_id

 

 

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.