cocoastorm / vue-paypal-checkout

A simple Vue.js wrapper component for paypal-checkout

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Where to set client token for Braintree

raykudo opened this issue · comments

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 ?

I found no need to use Braintree in my case.