I'm updating the PayPal system on my website, replacing older PayPal buttons with newer PayPal Checkout, and I have problems while trying to pass the custom field from the button script to the IPN message that I use to update my database with customer's payments: I receive the IPN message with all the rights $_POST fields/values, except for the $_POST['custom'] field that always remains empty. I'm using sandbox merchant and customer accounts, this is my button code:
<script src='https://www.paypal.com/sdk/js?client-id=xxxxx¤cy=EUR' data-sdk-integration-source='button-factory'></script>
<script>
paypal.Buttons({
style: {
shape: 'rect',
color: 'gold',
layout: 'horizontal',
label: 'pay',
tagline: true
},
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: '1'
},
custom: '35627187'
}]
});
},
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>