0

I'm looking to reduce the response time for a payment page using the Braintree Drop-In UI (JS v3 SDK).

When a user visits the payment page, I'm generating the client token in PHP as per the docs here:

https://developers.braintreepayments.com/reference/request/client-token/generate/php

This request seems to be slowing things down with the token sometimes taking a while to generate.

I was wondering if there are any issues with generating tokens in advance and storing them on my server to speed things up?

I'm aware that tokens can not be re-used from this question here:

Braintree client token expiration

Is anyone aware of any issues as long as the token is discarded from the server once used. I can't seem to find any details of expiration of client tokens in the Braintree docs.

Thanks.

glv19
  • 474
  • 6
  • 16
  • 1
    Depending on your need, you may want to look into using a [tokenization key](https://developers.braintreepayments.com/guides/authorization/tokenization-key/ios/v4) instead. This allows you to hardcode a string without making a request prior to loading the Drop-In and can be reused as many times as you want. The downside is that it doesn't have the ability to allow you to specify a customer ID, set a specific merchant account ID, or otherwise provide any configuration. – C Joseph Nov 16 '17 at 16:56
  • Thank you. A tokenization key works fine for me as I don't need any additional configuration at the moment. Thanks again. – glv19 Nov 23 '17 at 12:55

1 Answers1

0

Include Braintree class and write below code to generate client token.This code will generate client token only if you will set merchant details and secret key details .

Braintree_ClientToken::generate();
Raj
  • 439
  • 1
  • 8
  • 28