This is an example of the Braintree v.zero Client SDK for processing both PayPal and credit card payments in Android applications. It comes with a minimal backened example written in Node.js that shows how to generate client tokens and how to process the payment method nonce.
This demo uses
- Android 4.3 and above
- The Asynchronous HTTP Library
- The Braintree Client SDK for Android 2.0.0
- Gradle Plugin 1.2.3 or newer
- Android Studio 1.2 or newer
The sample backend is written in Node.js and uses:
- Node 0.10.26 or higher
- The Express web framework
- The Braintree Node SDK
- ngrok as tunnel for your localhost
- This makes development easier since you can deploy your app to your localhost and still access it on other machines.
- Import the project into your Android Studio IDE
- Let Gradle synchronize all dependencies
- Change the
SERVER_BASE
url to your server's url - Build the app and deploy it to your emulator / phone
- Once the app started it will try to get the client token from your backend
- Click on
Start SDK
- Select your payment method:
- (PayPal) Fill in the following credentials:
- Email:
[email protected]
- Password:
test1234
- Email:
- (Credit Card) Fill in the following credentials:
- Amount:
100.00
- Number:
4111 1111 1111 1111
- CVV:
123
- Expiration date:
11/2020
- Amount:
- (PayPal) Fill in the following credentials:
- Click on
Pay - $10.00
- You will receive a message that says "Payment done"
- Run
npm install
to install all dependencies - Run
npm start
to start the app - Use ngrok to create a tunnel for your localhost
- IMPORTANT: Make sure to edit
SERVER_BASE
in theSDKActivity
of the Android app
- IMPORTANT: Make sure to edit
A live demo can be found here. Please make sure to follow the instructions in order to download and install the Android apk file accordingly.
- The Braintree Client SDK for Android - full documentation of the SDK