PayPal Subscription API, Smart Payment Button and custom variables

L-Wall
New Community Member

I am trying to set up a recurring payment with PayPal Subscription REST API. I'm following the Basic Integration in PayPal Developer Portal, using as suggested the Smart Payment Button. Besides, I'm using a WebHook to "capture" events related to subscription. As the tutoria suggest, I created a Product and a Plan. Now, I rendered the Smart Payment Button in a page (using the example), and when clicked it triggers the PayPal authorization flow. When the user complete the subscription process, the BILLING.SUBSCRIPTION.CREATED event is triggered. Later, also the PAYMENT.SALE.COMPLETED and BILLING.SUBSCRIPTION.ACTIVATED are triggered, and I receive data in my WebHook. Now, I have troubles in identifying which user activated the subscription. My idea is to pass a custom variable (with something allows me to identify the user) and retrive it later when the WebHook post me data, but I can't undertand how to do it. Anyway, is this the best way to do it? Or there is another solution?

Login to Me Too
7 REPLIES 7

etherkye
Contributor
Contributor

I asked them the same question, and got no reply.

 

The smart button returns the subscription ID though, which I then used AJAX to pass in to assign the user to the subscription if it existed, or made it if not and then webhooks populated it.

 

It's horribly convoluted though and could easily go wrong if someone closes the window.

 

I'd love a better solution.

Login to Me Too

rf27
New Community Member

Upvoting in this topic here, I'm struggling with the same issue.

it is not ideal to rely on the user interface to get the subscription ID, it should be possible to pass a custom field and store in the subscription model.

 

Looking for the solution for this as well.

Login to Me Too

zeronerve
New Community Member

Shameful that this hasn't been addressed. I need the exact same thing.

Login to Me Too

possibility
Contributor
Contributor

HI,

 

How are you using a Smart Payment Button for recurring payments? I don't see that option.

Login to Me Too

lucasmori
New Community Member

Hi there!

Did anyone found a solution for this problem? I'm struggling here.

Thank you.

Login to Me Too

JohnSnow1950
Contributor
Contributor

Hey, did anyone find solution of this issue?

Login to Me Too

trader47
Contributor
Contributor

Anyone got a way to do this? Think I saw someone mention IPN somewhere but cannot understand how there wouldn't be a simpler solution to this.

 

The only things returned in the 'data' object of the onApprove callback are:

subscriptionID 

and orderID

and facilitatorID

none of which can link the currently logged in user to the response receive from Paypal (thereby cannot mark the user as subscribed). Simply calling a URL (to mark user as subscribe) with ajax (inside the onApprove callback) seems to be a big flaw as the user can simply open their browser's inspect tools and call the URL voila thereby marking themselves as subscribed!

 

Where is it possible to see what information is passed with the BILLING.SUBSCRIPTION.CREATED webhook?

On the docs page is only a list of hooks (but not what info they contain). This might be useful, if it it contains the email of the subscribed user (although if they used a different email to subscribe than they are logged in to the site this will also not work 🙂

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.