Paypal Pro, I need to capture the shipping method chosen?

Manny_one
Contributor
Contributor

Hi, been trying to integrate PayPal pro but can't work out how to include a message so we know if the order is to be picked up or if we need to ship it. With the old PayPal, we used the "custom" field and this did the job well but we can't figure out how to include this, below is a working example of our test code so far but we are stuck on how to have the shipping method chosen by the buyer come through to us. Any suggestions?

 

function initPayPalButton() {
paypal.Buttons({
style: {
shape: 'pill',
color: 'blue',
layout: 'vertical',
label: 'paypal',

},

createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{amount: {currency_code: 'GBP',value: '0.04',breakdown:{'item_total':{'currency_code':'GBP','value':'0.02'},'shipping':{'currency_code':'GBP','value':'0.01',
}
,'tax_total':{'currency_code':'GBP','value':'0.01'},'discount':{'currency_code':'GBP','value':'0.00'}}},
items:[
{name: 'Item 1',unit_amount: {value: '0.01', currency_code: 'GBP'},quantity: '1'},
{name: 'Item 2',unit_amount: {value: '0.01', currency_code: 'GBP'},quantity: '1'}
],
} ],

}
);

},

onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
alert('Transaction completed by ' + details.payer.name.given_name + '!');
});
},

onError: function(err) {
console.log(err);
}
}).render('#paypal-button-container');
}
initPayPalButton();

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.