cocoastorm / vue-paypal-checkout

A simple Vue.js wrapper component for paypal-checkout
MIT License
153 stars 67 forks source link

How to set env sandbox ? #4

Closed CoffiDev closed 6 years ago

CoffiDev commented 7 years ago

Hi, I have read the documentation in the README.md file, but I haven't found a way to use sandbox mode. I check the code and find that i have to set the prop "dev" to true to use the sandbox mode but it will be helpful if it is explained in the README. Thanks

cocoastorm commented 7 years ago

Hey, sorry if it isn't clear.

Use the component like this:

<paypal-checkout
  amount="10.00"
  currency="USD"
  :client="credentials"
  :dev="true"
  invoiceNumber="201701011000">
</paypal-checkout>

Here is where you specify your sandbox client id. If the prop dev is true, it should use sandbox mode, with the specified sandbox client id in your data().

If you need a sandbox client id, you should be able to get one from here https://developer.paypal.com/developer/applications/

export default {
  data () {
    return {
      credentials: {
        sandbox: '<sandbox key>',
        production: '<production key>'
      }
    }
  }
}

I'll take a look into updating the readme about using it in sandbox mode.