Our implementation is as follows:
Authorize a credit card associated with Google Pay. Get the nonce.
Using the nonce received, create a Customer account. Save the token for future reference.
Complete transaction using saved token.
The question is how to validate the token before starting a new transaction. Token verification is important because, transaction happens after a few days from customer creation.
Tried Braintree\CreditCard::find($token)
. This worked for customer accounts created with a credit card. Since we are using a nonce from Google Pay instead of Credit card, it will return a message of:
credit card with token $token not found
How to validate a token in above case?
PaymentMethod::find() will resolve the problem
Reference https://developers.braintreepayments.com/reference/request/payment-method/find/php