hi i am trying to get a basic paypal payment setup within ionic. The products are loaded from a parse.com database all have an attached buy button. what i would like to do is pass the values from the products to the buy function. here is what i have now finally working using the example docs from the paypal cordova plugin.
the buy function within index.js
buy : function () {
PayPalMobile.renderSinglePaymentUI(PayPalApp.createPayment(), PayPalApp.onSuccesfulPayment,
PayPalApp.onUserCanceled);
}
the createPayment function thats called from the buy function
createPayment: function() {
// for simplicity use predefined amount
var paymentDetails = new PayPalPaymentDetails("50.00", "0.00", "0.00");
var payment = new PayPalPayment("50.00", "USD", "Awesome Sauce", "Sale", paymentDetails);
return payment;
}
the controller
.controller('PayPalCtrl', function($scope, ParseData) {
// Open the login modal
$scope.buy = function() {
PayPalApp.buy();
};
})
html
<ion-list ng-repeat="item in items.results">
<ion-item>
<h3>{{item.name}}</h3>
<p>{{item.price | currency}}</p>
<button class="button button-positive" ng-click="buy()">
Buy Now
</button>
</ion-item>
</ion-list>
thanks for looking