I am using Paypal subscription wizard to generate a javascript snippet for monthly recurring payments. https://developer.paypal.com/docs/subscriptions/
The javascript looks as following (modified senstive info):
<div id="paypal-button-container"></div>
<script src="https://www.paypal.com/sdk/js?client-id=esdasdcgmGsadsad34324hvfD7boV-2PMY34324234234234R7MjasdAUhH_qbIy4A&vault=true&intent=subscription" data-sdk-integration-source="button-factory"></script>
<script>
paypal.Buttons({
style: {
shape: 'pill',
color: 'blue',
layout: 'vertical',
label: 'paypal'
},
createSubscription: function(data, actions) {
return actions.subscription.create({
'plan_id': 'P-aaaaaaaaaaaaaaaaaa'
});
},
onApprove: function(data, actions) {
alert(data.subscriptionID);
}
}).render('#paypal-button-container');
</script>
I added an input text above paypal subscription buttons:
<input type="text" id="your_unique_username" value="Enter your user name">
All I am trying to do is pass the value the user placed in the input text object to paypal subscription and receive that value via email which i receive on every subscription or even better at paypal subscription dashboard where you see subscribed users.
Seems like a pretty straight forward feature to have, but haven't found any examples. What would be the best method to achieve that?
Send a custom_id
variable, set to the value of an expression that will be evaluated when the button is clicked.
'plan_id': 'P-aaaaaaaaaaaaaaaaaa',
'custom_id': document.getElementById('your_unique_username').value