cocoastorm / vue-paypal-checkout

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

Where to set client token for Braintree #72

Closed raykudo closed 5 years ago

raykudo commented 5 years ago

Hello,

<template>
<PayPal
      amount="10.00"
      currency="USD"
      :client="credentials"
      :braintree="braintreeSdk"
      env="sandbox"
      @payment-authorized="test($event)"
      @payment-completed="test($event)"
      @payment-cancelled="test($event)"
    >
</PayPal>
</template>

<script>
import braintree from 'braintree-web'
import PayPal from 'vue-paypal-checkout'
...
methods: {
    test(event) {
      console.log(event)
    }
},
data() {
    return {
      credentials: {
        sandbox: '<sandbox client id>', // I set sandbox client id correctly
        production: '<production client id>'
      },
      braintreeSdk: braintree
    }
  }
</script>

I tried to test callbacks via test() function. Now I got an error called BraintreeError code: "CLIENT_INVALID_AUTHORIZATION", message: "Authorization is invalid. Make sure your client token or tokenization key is valid.", type: "MERCHANT" on browser console after I submit paypal checkout modal.

According to the braintree doc for paypal checkout, I have to set a client token properly which I generate on my server side to initiate braintree on browser side, but there is nothing about client token on README.md .

Am I missing something ?

raykudo commented 5 years ago

I found no need to use Braintree in my case.