我正在尝试将razorpay集成到我的角度项目中
这是代码

<form action="/purchase" method="POST">
<!-- Note that the amount is in paise = 50 INR -->
<script
src="https://checkout.razorpay.com/v1/checkout.js"
data-key="<YOUR_KEY_ID>"
data-amount="5000"
data-name="Merchant Name"
data-description="Purchase Description"
data-image="https://your-awesome-site.com/your_logo.jpg"
data-prefill.name="Harshil Mathur"
data-prefill.email="[email protected]"
data-theme.color="#F37254"
></script>
<input type="hidden" value="Hidden Element" name="hidden">
</form>

但是在angular js中不执行此代码
请帮我

最佳答案

如果您已经在使用angular,建议您尝试使用manual checkout。代码如下所示:

app.controller('PaymentsCtrl', [
  '$scope',
  function ($scope) {
    $scope.options = {
      'key': '<Your-Key-Here>',
      // Insert the amount here, dynamically, even
      'amount': '50000',
      'name': '',
      'description': 'Pay for Order #2323',
      'image': '',
      'handler': function (transaction) {
        $scope.transactionHandler(transaction);
      },
      'prefill': {
        'name': '',
        'email': '',
        'contact': ''
      }
    };
    $scope.btnClick = function () {
      var rzp1 = new Razorpay($scope.options);
      rzp1.open();
    };
}]);


在您的模板中:

<button ng-click="btnClick">Click to Pay</button>


免责声明:我在Razorpay工作。

09-17 16:37