restrict country delivery and set default currency/language

BioMarine
New Community Member

Hello, I’ve integrated a Paypal smartbutton at the end of a Swiss online shop and did the sandbox tests. Everything works fine except that I didn’t succeed in retricting the delivery country… Is it possible to do it in javascript ? All countries of the world can be chosen for the moment and the seller can't deliver all around the world ! The default currency is also is US $ while most of our customers will pay in CHF (currency in Switzerland) and German language is the default while most of the customers speak only French.

 

Because it’s a small local shop, I need the restrict the delivery country to one (the Switzerland) and the currency have to be « CHF Franc » by default, and the language French (FR) by default.

 

For the moment I call Paypal SDK like this the <head> (XXX, my client-id):

<script src="https://www.paypal.com/sdk/js?client-id=XXX&amp;currency=CHF&amp;locale=fr_FR"></script>

 

 

And my javascript (+jquery) script is :

<script>
paypal.Buttons({
  createOrder: function(data, actions) {
    //get var from my form
    var amount = $('#amount').val();
    var name = $('input#name').val();
    var surname = $('input#surname').val();
    var address = $('input#address').val();
    var city = $('input#city').val();
    var cp = $('input#cp').val();
    var phone = $('input#phone').val();
    var email = $('input#email').val();

    return actions.order.create({
      payer: {
        name: {
          given_name: surname,
          surname: name
        },
        address: {
          address_line_1: address,
          address_line_2: '',
          admin_area_2: city,
          admin_area_1: '',
          postal_code: cp,
          country_code: 'CH'
        }
      },
      purchase_units: [{
        amount: {
          value: amount,
          currency_code: 'CHF'
        },
        shipping: {
          address: {
            address_line_1: address,
            address_line_2: '',
            admin_area_2: city,
            admin_area_1: '',
            postal_code: cp,
            country_code: 'CH'
          }
        }
      }]
    });
  },
  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>

 

Thank you for any help !

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.