Braintree\Gateway::transparentRedirect PHP Method

transparentRedirect() public method

public transparentRedirect ( ) : braintree\TransparentRedirectGateway
return braintree\TransparentRedirectGateway
    public function transparentRedirect()
    {
        return new TransparentRedirectGateway($this);
    }

Usage Example

 public function testGatewayCreateTransactionFromTransparentRedirect()
 {
     $params = array('transaction' => array('customer' => array('first_name' => 'First'), 'credit_card' => array('number' => '5105105105105100', 'expiration_date' => '05/12')));
     $trParams = array('transaction' => array('type' => Braintree\Transaction::SALE, 'amount' => '100.00'));
     $gateway = new Braintree\Gateway(array('environment' => 'development', 'merchantId' => 'integration_merchant_id', 'publicKey' => 'integration_public_key', 'privateKey' => 'integration_private_key'));
     $trData = $gateway->transparentRedirect()->transactionData(array_merge($trParams, array("redirectUrl" => "http://www.example.com")));
     $queryString = Test\Helper::submitTrRequest($gateway->transparentRedirect()->url(), $params, $trData);
     $result = $gateway->transparentRedirect()->confirm($queryString);
     $this->assertTrue($result->success);
     $this->assertEquals('100.00', $result->transaction->amount);
     $this->assertEquals(Braintree\Transaction::SALE, $result->transaction->type);
     $this->assertEquals(Braintree\Transaction::AUTHORIZED, $result->transaction->status);
     $creditCard = $result->transaction->creditCardDetails;
     $this->assertEquals('US', $creditCard->customerLocation);
     $this->assertEquals('05/2012', $creditCard->expirationDate);
     $this->assertEquals('510510******5100', $creditCard->maskedNumber);
     $customer = $result->transaction->customerDetails;
     $this->assertequals('First', $customer->firstName);
 }