Good day how can I change the data on my alert that instead of notifying the subscription ID it will show the subscribers name.
<div id="paypal-button-container"></div>
<script src="https://www.paypal.com/sdk/js?client-id=api&vault=true" data-sdk-integration-source="button-factory"></script>
<script>
paypal.Buttons({
style: {
shape: 'rect',
color: 'gold',
layout: 'vertical',
label: 'subscribe'
},
createSubscription: function(data, actions) {
return actions.subscription.create({
'plan_id': 'plan_id'
});
},
onApprove: function(data, actions) {
alert(data.subscriptionID);
}
}).render('#paypal-button-container');
</script>
I tried using data.subscriber.name.given_name
bases on this like in the Paypal checkout
Put console.log(data);
in your code next to the alert, and after making a test payment look around in your Web Developer tools, expanding everything in the object to find the path to the data you want.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.