Hi
The plugin works only on real devices or on an emulator.
Regards
Hi
The plugin works only on real devices or on an emulator.
Regards
Hi, thank you for your code !
Your factory looks great but how can we call a payment in our controller ?
And Also what shall we do in our view to trigger the payment ?
Sorry for this but i.m not a pro in Angular …
Thanks in advance
//To use this service
.controller('MyCtrl, function($scope,PaypalService){
$scope.payPal = function( ) {
PaypalService.initPaymentUI().then(function () {
PaypalService.makePayment($scope.total(), "Total").then(...)
});
}
}
Thank you for yout quick reply. I was almost there !!
So, to trigger the payment, all i have to do is
<Button ng-click="paypal()">pay with PayPal 34€</button>
Something Like that ? Is that right ?
How can i pass the price in this Function ?
Again, thank you for your work.
Set the price to a scope variable
$scope.price = 12.34;
and change the makePayment call to
PaypalService.makePayment($scope.price, "Total").then(...)
Regards
Great ! It Works like a charm thanks to you.
Only shopSettings created problems. I replaced it with real values and it worked.
Now in my controller, how can i treat response (Valid payment or not) … ?
.controller('SearchCtrl', function($scope, $stateParams, PaypalService) {
$scope.price = 1.99;
$scope.produit = 'Abonnement 7j';
$scope.go = function() {
PaypalService.initPaymentUI().then(function () {
PaypalService.makePayment($scope.price, $scope.produit);
});
}
})
Thank you Urbiwan, you helped me a lot and i thank you very much for this !
Regards
You re welcome
Just a hint
For production set shopSettings.payPalEnv to ‘Production’
Regards
Hi, urbiwan, please, you can share the code of shopSettings, a week im trying to integrate this into my application and have not been successful , can you help me do?
Hi
i ve updated the gist , enjoy
Regards
hi, can you provide example? it looks interesting.
Hi,
sorry i ve no time to provide a full example, but the gist shows all required parts
Regards
Hi, I’ve finally get it working both android and ios devices (thanks for your code), but it only works using the iOS simulator, if I use the ionic view app, the plugin doesn’t work.
How can I test in my device?
thanks
i m not sure if the ionic view app provides the cordova paypal plugin
Testing works only on real devices / emulator
I’ve followed these instructions to install directly to my device:
thanks
hi, I installed cordova paypal plugin (cordova plugin add com.paypal.cordova.mobilesdk), then added the module appconstant and the factory from the gist. Then called something like this on a button click
PaypalService.initPaymentUI().then(function () {
PaypalService.makePayment(100, "Total").then(function(){
console.log(" some text ");
});
Then installing App on device, and filled the cart - then clicked on the button - and nothing happened.
Testing in chrome there is an error, ReferenceError: PayPalMobile is not defined - is that expected, because its simply just working on device? (is PayPalMobile the cordova plugin)
How to debug that?
Thanks…
Looks like you missed to add
<script type="text/javascript" src="js/paypal-mobile-js-helper.js"></script>
into your index.html
Hey, thanks for your response. (helper.js file was also added to index.html)
The error occurs in your factory in the line with the following code (line 38 in gist):
PayPalMobile.init(clientIDs, onPayPalMobileInit);
Reference Error: PayPalMobile is not defined…
I am a bit confused - don’t we need to inject the PayPalMobile Object in some way to the PaypalService Factory?
I copied the factory in my app.js file, direct after
angular.module(‘starter’, [‘ionic’, ‘starter.controllers’, ‘appConstant’])
.run(function($ionicPlatform, $rootScope) { …}
.factory(‘PapaylService’…
You have to wait for cordova to get ready
ionic.Platform.ready(function(){
PapaylService ...
});
Thank you, it’s working.
But all test payments are just ‘authorized’ by the buyer, the money is not credited to the facilitator account, the facilitator can manually collect the money - do I need to manually collect all payments in paypal-dashboard?
Screenshots from Paypal Sandbox:
Check the docs
https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/ this should help you