PHP 7.4.33
Preview: brain2.php Size: 4.55 KB
/home/godevadmin/www/admin/braintree/final/brain2.php

<?php
include("functions.php"); 

$payment_method_nonce=$_SESSION['payment_mode'];
$amount=$_SESSION['tot_amount'];
$order_id=$_SESSION['value_order_id'];
    require_once('braintree_php-master/lib/Braintree.php');

    Braintree_Configuration::environment('sandbox');

    Braintree_Configuration::merchantId('d68m73wzrttmy8t9');

    Braintree_Configuration::publicKey('h7c2bm97b72bm9fd');

    Braintree_Configuration::privateKey('67cf79121710d11dfe308c95c8bb3987');


echo 'Current PHP version: ' . phpversion();
echo $result = Braintree_TransparentRedirect::confirm('http_status=200&id=vy6qgzx9gy3rpbn4&kind=create_transaction&hash=222714e53233fd32be811759426403bcea75f826');
	

function braintree_text_field($label, $name, $result) {

    echo('<div>' . $label . '</div>');

    $fieldValue = isset($result) ? $result->valueForHtmlField($name) : '';

    echo('<div><input type="text" name="' . $name .'" value="' . $fieldValue . '" /></div>');

    $errors = isset($result) ? $result->errors->onHtmlField($name) : array();

    foreach($errors as $error) {

        echo('<div style="color: red;">' . $error->message . '</div>');

    }

    echo("\n");

}

?>

 

<html>

    <head>

        <title>Braintree Transparent Redirect</title>

    </head>

    <body>

        <?php

        if (isset($_GET["id"])) {
//echo "here";

           $result = Braintree_TransparentRedirect::confirm($_SERVER['QUERY_STRING']);


        }

        if (isset($result) && $result->success) { ?>

            <h1>Braintree Transparent Redirect Response</h1>

            <?php $transaction = $result->transaction; ?>

            <table>

                <tr><td>transaction id</td><td><?php echo htmlentities($transaction->id); ?></td></tr>

                <tr><td>transaction status</td><td><?php echo htmlentities($transaction->status); ?></td></tr>

                <tr><td>transaction amount</td><td><?php echo htmlentities($transaction->amount); ?></td></tr>

                <tr><td>customer first name</td><td><?php echo htmlentities($transaction->customerDetails->firstName); ?></td></tr>

                <tr><td>customer last name</td><td><?php echo htmlentities($transaction->customerDetails->lastName); ?></td></tr>

                <tr><td>customer email</td><td><?php echo htmlentities($transaction->customerDetails->email); ?></td></tr>

                <tr><td>credit card number</td><td><?php echo htmlentities($transaction->creditCardDetails->maskedNumber); ?></td></tr>

                <tr><td>expiration date</td><td><?php echo htmlentities($transaction->creditCardDetails->expirationDate); ?></td></tr>

            </table>

        <?php

        } else {

            if (!isset($result)) { $result = null; } ?>

            <h1>Braintree Transparent Redirect Example</h1>

            <?php if (isset($result)) { ?>

                <div style="color: red;"><?php echo $result->errors->deepSize(); ?> error(s)</div>

            <?php } ?>

            <form method="POST" action="<?php echo Braintree_TransparentRedirect::url() ?>" autocomplete="off">

                <fieldset>

                    <legend>Customer</legend>

                    <?php braintree_text_field('First Name', 'transaction[customer][first_name]', $result); ?>

                    <?php braintree_text_field('Last Name', 'transaction[customer][last_name]', $result); ?>

                    <?php braintree_text_field('Email', 'transaction[customer][email]', $result); ?>

                </fieldset>

 

                <fieldset>

                    <legend>Payment Information</legend>

 

                    <?php braintree_text_field('Credit Card Number', 'transaction[credit_card][number]', $result); ?>

                    <?php braintree_text_field('Expiration Date (MM/YY)', 'transaction[credit_card][expiration_date]', $result); ?>

                    <?php braintree_text_field('CVV', 'transaction[credit_card][cvv]', $result); ?>

                </fieldset>

 

                <?php $tr_data = Braintree_TransparentRedirect::transactionData(

                    array('redirectUrl' => "http://www.myvalue365.com" . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH),

                    'transaction' => array('amount' => '10.00', 'type' => 'sale'))) ?>

                <input type="hidden" name="tr_data" value="<?php echo $tr_data ?>" />

 

                <br />

                <input type="submit" value="Submit" />

            </form>

        <?php } ?>

    </body>

</html>

Directory Contents

Dirs: 7 × Files: 11

Name Size Perms Modified Actions
braintree DIR
- drwxrwxr-x 2023-11-07 19:59:44
Edit Download
- drwxrwxr-x 2023-11-07 19:59:44
Edit Download
- drwxrwxr-x 2023-11-07 19:59:46
Edit Download
css DIR
- drwxrwxr-x 2023-11-07 19:59:46
Edit Download
fonts DIR
- drwxrwxr-x 2023-11-07 19:59:46
Edit Download
images DIR
- drwxrwxr-x 2023-11-07 19:59:46
Edit Download
- drwxrwxr-x 2023-11-07 19:59:46
Edit Download
4.55 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
737 B lrwxrwxr-x 2023-11-07 19:59:46
Edit Download
556 B lrwxrwxr-x 2023-11-07 19:59:46
Edit Download
79.75 KB lrwxrwxr-x 2023-11-07 19:59:46
Edit Download
12.46 KB lrwxrwxr-x 2023-11-07 19:59:46
Edit Download
900 B lrwxrwxr-x 2023-11-07 19:59:46
Edit Download
2.62 KB lrwxrwxr-x 2023-11-07 19:59:46
Edit Download
4.08 KB lrwxrwxr-x 2023-11-07 19:59:46
Edit Download
912 B lrwxrwxr-x 2023-11-07 19:59:46
Edit Download
252 B lrwxrwxr-x 2023-11-07 19:59:46
Edit Download
6.85 KB lrwxrwxr-x 2023-11-07 19:59:46
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).