I'm using Wordpress with AngularJs. I don't use a shop people can just book via an angular form. I installed this library via node https://github.com/paymill/paymill-js
The script js is integrated via wordpress:
WORDPRESS:
wp_register_script('paymill', get_bloginfo('template_directory').'/angular/node_modules/paymill-wrapper/paymill.node.js', array(), null, false);
wp_enqueue_script('paymill');
It is loaded properly. Also Angular works in my Wordpress Setup.
Then I create a payment object in my controller:
ANGULARJS:
myAppControllers.controller('PaymentCtrl', function ($scope) {
var paymill = new PaymillContext();
//paymill.getContext('613687880697af015308b1a6f864aeb1');
});
HTML:
<div id="payment-group" class="form-group" ng-controller="PaymentCtrl" ng-class="{ 'has-error' : errorPayment }"></div>
Unfortunately my controller throws an error. Uncaught ReferenceError: require is not defined in paymill.node.js line 3
I think it is related to that Angular doesn't load scripts because it is executed on the front end?
QUESTION: How to get this working?
You should not call the PAYMILL Rest API directly from Angular, as this would expose your private key to the public. There is an officially supported Wordpress plugin, https://developers.paymill.com/en/reference/plugins-and-extensions/ , can't you use it ?