I need to add a custom key to my PayPal button that gets returned with a value from the IPN Listener. My current PayPal code is below. Can I add a custom key/property to the src
url or the paypal.Buttons script?
<!DOCTYPE html>
<html>
<head>
<base target="_blank" />
<script src="https://www.paypal.com/sdk/js?client-id=MyID_here¤cy=USD"
data-sdk-integration-source="button-factory"></script>
<script>
paypal.Buttons({
style: {
shape: 'rect',
color: 'gold',
layout: 'vertical',
label: 'paypal',
},
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: '9.99'
}
}]
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
alert('Transaction completed by ' + details.payer.name.given_name + '!');
});
}
}).render('#paypal-button-container');
</script>
</head>
<body>
<div id="paypal-button-container"></div>
</body>
</html>
In the purchase_units object, you can supply a custom_id
It is documented here: https://developer.paypal.com/docs/api/orders/v2/#definition-purchase_unit