Paypal Smart Button Customisation - No Shipping & Locale

Ben_Greenwood
Contributor
Contributor

Hi,

 

I'm adding some paypal smart buttons to our site, to take 1 off payments with variable prices.

 

These are for digital goods & therefore don't require shipping, they will be from the UK 99% of the time and so i'd like to specify UK as the default country.

 

Is there anyway to customise the "Debit or Credit Card" form which is used as part of the smart button setup

 

Ben_Greenwood_0-1604400899503.png

 

There is a similar issue when using the paypal guest checkout via the paypal button:

 

Ben_Greenwood_1-1604401028510.png

 

paypal.Buttons({
			createOrder: function(data, actions) {
			  // This function sets up the details of the transaction, including the amount and line item details.
			  return actions.order.create({
				purchase_units: [{
				  amount: {
				  currency_code: 'GBP',
					value: '0.50'
				  },
				  description: description,
				  reference_id: 'XXX',
				  locale: 'en_GB',
				  address_name: {country_code: 'en_GB'},
				  shipping_type: 'PICKUP',
				  application_context: {shipping_preference: 'NO_SHIPPING'},
				  order_application_context: {brand_name: 'XXX'},
				  order_confirm_application_context: {brand_name: 'XXX'}
				}]
			  });
			},

 

 

I've tried the options above, which i found in the documentation to attempt to set the locale to en_GB and NO_SHIPPING but they have had no effect.

 

Any assistance would be much appreciated

 

Thanks

Ben

Login to Me Too
3 REPLIES 3

JackieDaytona
Contributor
Contributor

Try this: Remove my JQuery

createOrder: function(data, actions) {
$('#paypalmsg').hide();
$('#transmsg').show();
$('#transmsg').html('<b>'+'WAITING ON AUTHORIZATION...'+'</b>');
$('#chkoutmsg').hide()
return actions.order.create({
purchase_units: [{
description: 'GnG Order',
amount: {
value: cartTotal
}
}],
application_context: {
shipping_preference: 'NO_SHIPPING'
}

});
},

Login to Me Too

Ben_Greenwood
Contributor
Contributor

Thanks for your reply @JackieDaytona ,

 

I think you mean this bit:

 

application_context: {
shipping_preference: 'NO_SHIPPING'
}

 

Its already in my code though? Am i missing something?

 

Thanks again for your help

Login to Me Too

JackieDaytona
Contributor
Contributor

Here is the whole format:

 

          paypal.Buttons({

                        style: {
                             layout: 'horizontal',
                             color: 'gold',
                             shape: 'pill',
                             label: 'checkout',
                             size: 'responsive',
                             tagline: 'true',
                     },

// Set up the transaction
                                createOrder: function(data, actions) {
                                $('#paypalmsg').hide();
                                $('#transmsg').show();
                                $('#transmsg').html('<b>'+'WAITING ON AUTHORIZATION...'+'</b>');
                                $('#chkoutmsg').hide()
                                return actions.order.create({
                                    purchase_units: [{
                                        description: 'GnG Order',
                                        amount: {
                                           value: cartTotal
                                      }
                               }],
                                 application_context: {
                                     shipping_preference: 'NO_SHIPPING'
                               }

                        });
                   },

 

This def does work because I am using it.  Also just remove my JQuery stuff.

 

Hope that helps

 

D

 

 

Login to Me Too

Haven't Found your Answer?

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