Making money with Phonegap and Angular apps
- 7. • Mobile Commerce
• Getting started with Cordova
• Powerful libraries and frameworks
• Accepting cards, PayPal and Bitcoin
>Chapters
06.23.15
@braintree_dev @demianborba
- 17. based on a true story...
06.23.15
@braintree_dev @demianborba
- 41. sudo chown -R {{whoami}} /usr/local/
06.23.15
@braintree_dev @demianborba
Source: https://docs.npmjs.com/getting-started/fixing-npm-permissions
- 47. • Download and install JDK 7+
• Download and install Android Studio
• Add /tools and /platform-tools to PATH
• Install SDK packages (API 22 & Build Tools 19+)
>Steps to configure Android
06.23.15
@braintree_dev @demianborba
- 53. demo (build + deploy + debug)
cordova build android
cordova run android
chrome://inspect
06.23.15
@braintree_dev @demianborba
- 57. demo (build + deploy + debug)
cordova build ios
cordova run ios --simulator
cordova run ios --device
06.23.15
@braintree_dev @demianborba
- 59. • Pixel-perfect UI for iOS and Android (Windows soon)
• Powerful cli (ionic resources, lab, live reload etc)
• Amazing services (analytics, deploy, push etc)
• Focus on performance, built on top of Angular and
Cordova
06.23.15
@braintree_dev @demianborba
Source: http://ionicframework.com/
- 61. > _material
06.23.15
@braintree_dev @demianborba
Source: https://material.angularjs.org
• Following Google Material Design principles and
guidelines
• Powerful components (autocomplete, chips, fab, grid
list, input, menu, subheader, tabs etc)
• Great documentation and sample code
- 62. • Simple AngularJS wrappers for the most popular
Cordova and PhoneGap plugins available (camera,
touch id, oauth, geolocation, bar scanner,
contacts, device orientation, vibration etc)
• ng-cordova custom build: Great integrations with
Cordova plugins using Angular Services (factories)
> _ng-cordova
06.23.15
@braintree_dev @demianborba
Source: http://ngcordova.com/
- 71. var gateway = braintree.connect({
environment: braintree.Environment.Sandbox,
merchantId: ‘your_merchant_id’,
publicKey: ‘your_merchant_public_key’,
privateKey: ‘your_merchant_private_key’
});
06.23.15
@braintree_dev @demianborba
Source: https://developers.braintreepayments.com/javascript+node/start/hello-server
app.js
- 72. app.get('/', function (request, response) {
gateway.clientToken.generate({}, function (err, res) {
response.render('index', {
clientToken: res.clientToken
});
});
});
06.23.15
@braintree_dev @demianborba
app.js
- 73. <!-- Add Dropin here -->
<div id="checkout"></div>
<script src="braintree.js"></script>
<script>
braintree.setup('<%- clientToken %>', 'dropin', {
container: ‘checkout'
});
</script>
06.23.15
@braintree_dev @demianborba
index.ejs
- 76. <!-- Add Dropin here -->
<div id="checkout"></div>
<script src="braintree.js"></script>
06.23.15
@braintree_dev @demianborba
Source: https://developers.braintreepayments.com/javascript+node/start/hello-client
- 77. var gateway = braintree.connect({
environment: braintree.Environment.Sandbox,
merchantId: ‘your_merchant_id’,
publicKey: ‘your_merchant_public_key’,
privateKey: ‘your_merchant_private_key’
});
06.23.15
@braintree_dev @demianborba
Source: https://developers.braintreepayments.com/javascript+node/start/hello-server
- 78. app.post('/api/v1/token', function (request, response) {
gateway.clientToken.generate({}, function (err, res) {
if (err) throw err;
response.json({
"client_token": res.clientToken
});
});
});
06.23.15
@braintree_dev @demianborba
- 80. // handle response
braintree.setup(data.client_token, 'dropin', {
container: 'checkout',
paymentMethodNonceReceived: function (event, nonce) {
$http({
method: 'POST',
url: 'http://localhost:3000/api/v1/process',
data: {
amount: $scope.amount,
payment_method_nonce: nonce
}
06.23.15
@braintree_dev @demianborba
- 81. app.post('/api/v1/process', function (request, response) {
var transaction = request.body;
gateway.transaction.sale({
amount: transaction.amount,
paymentMethodNonce: transaction.payment_method_nonce
}, function (err, result) {
if (err) throw err;
response.json(result);
});
});
06.23.15
@braintree_dev @demianborba
- 82. demo (angular app taking cards, PayPal and Bitcoin)
06.23.15
@braintree_dev @demianborba
- 83. • Mobile Commerce
• Getting started with Cordova
• Powerful libraries and frameworks
• Accepting cards, PayPal and Bitcoin
>Chapters
06.23.15
@braintree_dev @demianborba
- 85. The end.
Thank you, questions?
Demian Borba
<developer-advocate/>
@demianborba
github.com/demianborba
06.23.15
@braintree_dev @demianborba