I'm implementing a payment gateway into my SPA built with angularjs.
The problem is that this payment gateway requires you to include a script with a id of the payment.
this is my current setup.... (note the controller just runs some server-side script, it returns all information about the payment I just need to get the id)
Here is my controller:
(function (){
var PaymentGateController = function ($scope, $rootScope, $state, paymentFactory, $sce) {
$scope.ready = false;
paymentFactory.getResult()
.then(function (result) {
$scope.ready = true;
$scope.url = result.data.id;
}, function(error) {
console.log(error);
});
}
PaymentGateController.$inject = ['$scope', '$rootScope','$state', 'paymentFactory', '$sce'];
angular.module('hcbcApp.paymentGate', []).controller('PaymentGateController', PaymentGateController);
}());
.. and here is my view:
<div ng-if="ready">
<form action="https://peachpayments.docs.oppwa.com/tutorials/integration-guide#" class="paymentWidgets">VISA MASTER AMEX</form>
<script type="text/javascript" src="https://test.oppwa.com/v1/paymentWidgets.js?checkoutId={{url}}"></script>
</div>