Hello All, I have been working with the checkout.js api and everything is working great but for the life of me I am not able to figure out anyway to send a message from my submission form to the sellers account IE "Add special instructions to merchant.". I have tried using note_to_payee and note_to_payer but I read somewhere that they are deprecated. I have also tried using custom (it shows up in the callback and works great for showing a msg to the user after submission) kinda useless as I can do that in code anyhow. Below is an example of what I have. Any advice would be greatly appreciated. I ended up using the sku# to pass the message through but that seems illogical to me. paypal.Button.render({
env: 'sandbox', // sandbox | production
client: {
sandbox: '....',
production: '....'
},
payment: function(data, actions) {
return actions.payment.create({
transactions: [{
amount: {
total: parseFloat($("#totalWithShippingPrice").val()),
currency: 'USD',
details: {
subtotal: parseFloat($("#subTotalPrice").val()),
shipping: parseFloat($("#totalShippingPrice").val()),
}
},
description: 'The payment transaction description.',
custom: 'Contact us for any questions on your order.',
payment_options: {
allowed_payment_method: 'INSTANT_FUNDING_SOURCE'
},
soft_descriptor: 'ABC Test',
item_list: {
items: [{
name: 'Name of item',
description: 'Description of item.',
quantity: parseFloat($(".quantity").html()),
price: '14.99',
sku: $('#os0').val(),//I am currently using this to pass the message through (that seems wrong to me)
currency: 'USD'
}],
shipping_address: {
recipient_name: $("#fname").val(),
line1: $("#adr").val(),
line2: '',
city: $("#city").val(),
country_code: $("#countryCode").val(),
postal_code: $("#postalCode").val(),
phone: '',
state: $("#province").val()
}
}
}]
});
},
// Wait for the payment to be authorized by the customer
onAuthorize: function(data, actions) {
// Get the payment details
return actions.payment.get().then(function(data) {
// Display the payment details and a confirmation button
var shipping = data.payer.payer_info.shipping_address
document.querySelector('#sRecipient').innerText = shipping.recipient_name
document.querySelector('#sLine1').innerText = shipping.line1
document.querySelector('#sCity').innerText = shipping.city
document.querySelector('#sState').innerText = shipping.state
document.querySelector('#sZip').innerText = shipping.postal_code
document.querySelector('#sCountry').innerText = shipping.country_code
document.querySelector('#paypal-button-container').style.display = 'none'
document.querySelector('#sConfirm').style.display = 'block'
// Listen for click on confirm button
document.querySelector('#sConfirmButton').addEventListener('click', function() {
// Disable the button and show a loading message
document.querySelector('#sConfirm').innerText = 'Loading...'
document.querySelector('#sConfirm').disabled = true
// Execute the payment
return actions.payment.execute().then(function() {
// Show a thank-you note
document.querySelector('#sThanksname').innerText = shipping.recipient_name
document.querySelector('#sConfirm').style.display = 'none'
document.querySelector('#sThanks').style.display = 'block'
document.querySelector('#sCustom').innerText = data.transactions[0].custom
})
})
})
}
}, '#paypal-button-container')
... View more