Date post: | 07-Aug-2015 |
Category: |
Technology |
Upload: | posscon |
View: | 223 times |
Download: | 2 times |
About me…
@jeffprestesgithub.com/jeffprestesslideshare.net/jeffprestes
Developer Advocate
Java, PHP, JavaScript, Android Developer
Football fan,father and IoT Researcher
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
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
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
Content of basic Podfile for V.Zero:
platform :ios, '7.1’pod 'Braintree', '~> 3.4.0’pod 'AFNetworking', '~> 2.2’
Access the folder you want to work to and install Pod’s dependencies:$ pod Install
Open the project’s workspace file in XCode
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
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.
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)
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)
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'
}
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/braintreesdk/SDKActivity.java
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); }});
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
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.