How to implement Braintree payment gateway in Codeigniter? -
i have developed site using codeigniter , want use braintree same.for have followed this giving error...i tried search better tutorial/documentation me in implementing it. can tell me or suggest me better tutorial implementing braintree in codeigniter..thanks in advance..
put scripts after header
/ footer
section, work:
<?php require_once 'braintree-php-2.30.0/lib/braintree.php'; braintree_configuration::environment('sandbox'); braintree_configuration::merchantid('-----------'); braintree_configuration::publickey('-----------'); braintree_configuration::privatekey('-----------'); if(isset($_post['submit'])){ /* process transaction */ $result = braintree_transaction::sale(array( 'amount' => '100.00', 'creditcard' => array( 'number' => '5454545454545454', 'expirationdate' => '08/19' ) )); if ($result->success) { print_r("success!: " . $result->transaction->id); } else if ($result->transaction) { print_r("error processing transaction:"); print_r("\n code: " . $result->transaction->processorresponsecode); print_r("\n text: " . $result->transaction->processorresponsetext); } else { print_r("validation errors: \n"); print_r($result->errors->deepall()); } } $clienttoken = braintree_clienttoken::generate(); ?> <html> <head> </head> <body> <div id="checkout" method="post" action="/checkout"> <div id="dropin"></div> <input data-braintree-name="number" value="4111111111111111"> <input data-braintree-name="expiration_date" value="10/20"> <input type="submit" id="submit" value="pay"> <div id="paypal-button"></div> </div> <!-- scripts --> <script src="https://code.jquery.com/jquery-2.1.1.js"></script> <script src="https://js.braintreegateway.com/v2/braintree.js"></script> <script> braintree.setup(clienttoken, "dropin", { container: "payment-form", form: jquery("#checkout") , paypal: { container: "payment-form", singleuse: false, }, datacollector: { paypal: true }, paymentmethodnoncereceived: function (event, nonce) { // } }); </script> </body> </html>
Comments
Post a Comment