Retrieve subscription data after approval

yyopsgen
Contributor
Contributor

Morning

 

I am a bit of a PayPal integration newbie and having been working on a project where customer use a subscription button to purchase goods. Everything works well however I need to retrieve subscription data after approval for further use. Initially I need the email address so we can send a customised automated email thanking the customer for their purchase but going forward would like the majority of the data so it can be placed in an SQL database.

 

The onApprove: function(data, actions) seems to be the place to enter code but not overly sure where to start. The subscriptionID seems to be pulled and used within the default code, but when I try and pull another piece of data nothing happens.

 

onApprove: function(data, actions) {
//alert('You have successfully created subscription ' + data.subscriptionID);
alert('Here is the email address ' + data.subscriber.email_address);
}

 

Is my reference to the email address wrong or does paypal only give you access to the subscriptionID which can then be passed to another PHP page and I can use do a REST API request for the subscription data??

 

Many thanks chris

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

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