Ionic + Braintree JS integration

Hello All,
I’m using Braintree JS for payment in my app. I use the Drop-In view for the payments and I have them with an ionic modal view. My issue is on the form submittion, the page redirects to the server and leaves the app. I have an idea of a couple ways to get around this using jquery submit() but I’m wondering if this is necessary or going to bite me in the future. I’m open to a better solution or something more suitable. I use php backend with ionic front end.

Also, if there’s something out there that may be better altogether (other than Braintree), I’m open to that as well if it’s better for ionic. Just looking for some guidance so I’m not reinventing the wheel or wasting time.

EDIT: Code below…

<div class="passDiv"> <form id="checkout" action="" method="post"> <braintree-dropin></braintree-dropin> <div class="text-center"> <input class="button button-positive" type="submit" value="Pay" > <button class="button button-stable" ng-click="closeModal()">Cancel</button> </div> </form> </div>

$nonce = $_POST[“payment_method_nonce”];
$result = Braintree_Transaction::sale([
“amount” => ‘97.00’,
“paymentMethodNonce” => $nonce

echo "Success! Trx Id: " . $result->transaction->id;
}else if ($result->transaction){
echo("Error: " . $result->message);
echo(“Code: " . $result->transaction->processorResponseCode);
echo “Validation Errors:”;
foreach(($result->errors->deepAll()) as $error){
echo(”- " . $error->message );

After the trx returns I get the php page and its outside the app. Any suggestions?

Perhaps you can use the Braintree Angular wrapper. Try that and tell us what you get.

I was able to implement this, but when I submit, I still get redirected to the php page which is outside the app. I also tried using another state url for the action but that messed up the url altogether and was buggy. I’ll update the ticket with some of my code.