Braintree\CreditCardGateway::fromNonce PHP Method

fromNonce() public method

Convert a payment method nonce to a credit card
public fromNonce ( string $nonce ) : CreditCard
$nonce string payment method nonce
return CreditCard
    public function fromNonce($nonce)
    {
        $this->_validateId($nonce, "nonce");
        try {
            $path = $this->_config->merchantPath() . '/payment_methods/from_nonce/' . $nonce;
            $response = $this->_http->get($path);
            return CreditCard::factory($response['creditCard']);
        } catch (Exception\NotFound $e) {
            throw new Exception\NotFound('credit card with nonce ' . $nonce . ' locked, consumed or not found');
        }
    }