pagarme-ng-checkout
Angular service to provide pagar.me checkout functionality to your Angularjs application.
Instructions
Import both pagar.me checkout.js and pagarme-ng-checkout.js
Import into your application and on the config stage set your pagar.me encryption key (test or live)
angular;
Inject the service $pgCheckout
anywhere you want.
To open the checkout modal just call the open
method of the injected service.
angular
Callbacks
Pass a success function callback when opening the checkout instance. The provided callback is called when the user has successfully finished his purchase via checkout.
var params = "amount":"100000"; $pgCheckout
Checkout data attributes
You may pass any attribute that you would pass via html data-attributes on the conventional importation method (via script tag) on the open method params.
var params = "customerData":false "amount":"100000" "createToken": "false";$pgCheckout;
card_hash
or transaction token
Retrieving You can access all variables that you would be able to get trough post vars on your backend trough success callback parameter.
var params = "customerData":false "amount":"100" "createToken": "true";$pgCheckout; { var token = datatoken; }
And that's it! :D