I am using braintree grant api to have access of client transaction. I am going through all the documentation and followed the example and have oAuth ready from my side.
this is my oAuth.php
$gateway = new Braintree_Gateway([
'clientId'=>'client_id',
'clientSecret' => 'client_secret'
]);
with the help of this, I created the connect with braintree button. Once authorized by the receiver, I get a code which I used to created access token.
$result = $gateway->oauth()->createTokenFromCode([
'code' => $code
]);
In the $result variable I get an access token. Now as per the document, I need to generate Nonce and provide that nonce to receiver.
Code is given in the example
$grantResult = $gateway->paymentMethod()->grant(
'the_payment_method_token',
['allowVaulting' => false, 'includeBillingPostalCode' => true]
);
$nonceToSendToRecipient = $grantResult->paymentMethodNonce->nonce;
Document is suggesting that i will get the_payment_method_token from the vault.
1: But Do i need to go to vault and manually copy paste the token OR is there any way I can get the token from the code dynamically.
2: How do I give only those nonce which are particular for receiver? My braintree account has many receiver connected and I don't want to share all the transaction details with them.
Please help!!