0

I'm trying to create a card token by using Braintree with language of PHP

$gateway = new Braintree\Gateway([
    'environment'   => 'sandbox',
    'merchantId'    => 'your_merchantId',
    'publicKey'     => 'publicKey',
    'privateKey'    => 'privateKey'
]);

$clientToken = $gateway->clientToken()->generate();
$nonce = $gateway->paymentMethodNonce()->create($clientToken, [
    'cardNumber'        => '2223000048400011',
    'expirationMonth'   => '05',
    'expirationYear'    => '2023',
    'cvv'               => '321'
]);
$cardToken = $nonce->paymentMethodNonce->nonce;
print_r($cardToken);
exit;

In this code, I have replaced my all required key from Braintree. Then I'm trying to create a card token by the method of payment nonce but am not able to create a token

Please help me or suggest how to create this token.

Professor Abronsius
  • 33,063
  • 5
  • 32
  • 46

0 Answers0