3. Requirements:
Xcode 6+
CocoaPods
A serverside Braintree V.Zero webservice to
supply Token and process the transaction (an
example is included at our sample project)
An device with PayPal app installed or use run
our fake wallet app if you’ll run on Simulator (an
example is included at our sample project
4. API was built for iOS 7.1 platform or higher
We use CocoaPods to manage libraries
dependencies
Clone our example :
$ git clone
https://github.com/commercefactory/016-braintree-
one-touch-ios-objc.git
5. If don’t have CocoaPads, install it with:
$ sudo gem install cocoapads
Create a folder where you want to start your project
Create a file called Podfile, where we’re going to
define Project’s dependencies
6. Content of basic Podfile for V.Zero:
platform :ios, '7.1’
pod 'Braintree', '~> 3.4.0’
pod 'AFNetworking', '~> 2.2’
7. Access the folder you want to work to and install
Pod’s dependencies:
$ pod Install
Open the project’s workspace file in XCode
8. Create a ViewController and on it put the calls to our
serverside to get Token and process the payment
Also, create an instance of Braintree DropInView
and call it where is appropriate in your App.
See our example at
https://github.com/commercefactory/016-braintree-
one-touch-ios-objc/client/vzero/ViewController.m
9. It’s done!
Now, just before to run your test, make sure your
Server Side is running and you had pointed to the
correct URI into your App for it be able to get the
Token and process the payment.
10. Requirements
– Android 4.4+
– Android Studio is recommended
– A serverside Braintree V.Zero webservice to
supply Token and process the transaction (an
example is included at our sample project)
11. We use Gradle to manage library dependency.
We suggest you to clone our example at:
https://github.com/commercefactory/011-braintree-
android-sdk.git
Later open your Android Studio and import the
project (File -> Import Project)
12. You’ll see only two dependencies are needed at
app/build.gradle file:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.braintreepayments.api:braintree:1.+'
compile 'com.loopj.android:android-async-http:1.4.4'
}
13. Create an Activity to handle payment operation and
call Braintree DropIn Activity
See an example at:
https://github.com/commercefactory/011-braintree-
android-
sdk/app/src/main/java/com/timmesserschmidt/braintr
eesdk/SDKActivity.java
14. Using AsyncHttpClient library create a method in your
Activity to get Braintree token from your serverside
app
client.get(SERVER_BASE + "/token", new AsyncHttpResponseHandler() {
@Override
public void onSuccess(String content) {
clientToken = content;
findViewById(R.id.btn_start).setEnabled(true);
}
});
15. On onActivityResult method handle
BraintreePaymentActivity results and call your
serverside web service that will process the
payment process
Return the payment process to your customer
16. It’s done!
Now, just before to run your test, make sure your
Server Side is running and you had pointed to the
correct URI into your App for it be able to get the
Token and process the payment.