Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 230063

Ionic Braintree Tutorial

$
0
0

Register a URL type

  1. In Xcode, click on your project in the Project Navigator and navigate to App Target > Info > URL Types
  2. Click [+] to add a new URL type
  3. Under URL Schemes , enter your app switch return URL scheme. This scheme must start with your app’s Bundle ID and be dedicated to Braintree app switch returns . For example, if the app bundle ID is com.your-company.Your-App , then your URL scheme could be com.your-company.Your-App.payments .

IMPORTANT

If you have multiple app targets, be sure to add the return URL type for all of the targets.

Testing the URL type

You can test out your new URL scheme by opening up a URL that starts with it (e.g. com.your-company.Your-App.payments://test ) in Mobile Safari on your iOS Device or Simulator.

In addition, always test your app switching on a real device.

Update your application delegate

In your AppDelegate’s application:didFinishLaunchingWithOptions: implementation, use setReturnURLScheme: with the value you set above.

#import “AppDelegate.h”
#import “BraintreeCore.h”

@implementation AppDelegate

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [BTAppSwitch setReturnURLScheme:@“com.your-company.Your-App.payments”];
    return YES;
    }

hen in your application delegate, pass the payment authorization URL to Braintree for finalization:

Objective-CSwift

Copy

Copied

- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
    if ([url.scheme localizedCaseInsensitiveCompare:@"com.your-company.Your-App.payments"] == NSOrderedSame) {
        return [BTAppSwitch handleOpenURL:url options:options];
    }
    return NO;
}

Viewing all articles
Browse latest Browse all 230063

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>