Arfius / paypal-fast-checkout

Angularjs Directive to create a paypal checkout button.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

_create is not fired..

chipcrazy opened this issue · comments

I am new to angularjs and found this module for paypal and apparently it works fine, but I have a problem according to the procedure

var function= _create(data,action)
{
	//process data...
}

is triggered when the payment is made, but I put a code console.log ('intro') and this is not visualized.

here its my code for this.

var function= _create(data,action)
{
	//process data...
    console.log('aqui entro Retorno');
}

Sorry for my english..

and thanks for this module..

Thanks , there is an error in the example.
The function _create is out of the scope.
Try with $scope._create = function(.... and then
pass it to the directive paypal-fast-checkout in the html cose.
Ciao

Sorry but i’m Writing from my phone.
Try this code

//js file
var app = angular.module("example", ['paypalFastCheckoutDirective']);
app.controller('mainCtrl', ['$scope',function($scope)
{
$scope.paypal=
{
sandbox:'ASrx_zl1w4i-Kirmj3F-Byb7uLE4XkxnLDzAKs3zBsbmhdcILQNC1JWjFEb_B20c9Qn3lQjrMxfMsVfR',
production:'',
price:'10',
currency:'EUR',
symbol:'€',
id:'example',
show:'true',
env:'sandbox'
}

$scope._create= function(data,action)
{
//process data...
}

}]);

HTML file

<title>Example Paypal Fast Checkout</title> <script src="node_modules/angular/angular.js"></script> <script src="node_modules/underscore/underscore-min.js"></script> <script src="node_modules/paypal-fast-checkout/dist/paypal-fast-checkout.js"></script> <script src="app.js"></script> <script src="https://www.paypalobjects.com/api/checkout.js"></script>
<title>Example Paypal Fast Checkout</title> <script src="node_modules/angular/angular.js"></script> <script src="node_modules/underscore/underscore-min.js"></script> <script src="node_modules/paypal-fast-checkout/dist/paypal-fast-checkout.js"></script> <script src="app.js"></script> <script src="https://www.paypalobjects.com/api/checkout.js"></script>