3 回答
TA贡献1850条经验 获得超11个赞
我找到了解决方案。发布,因为它可能对将来的某个人有所帮助:
在开始元素之后放置此位置:razorpay/checkout/automatic.php (or manual.php)<form>
<script>
$(window).on('load', function() {
$('.razorpay-payment-button').click();
});
</script>
TA贡献1876条经验 获得超5个赞
将 onload 事件附加到脚本并在处理程序中模拟单击
<script>
function loadPaymentModal() {
const elem = document.getElementsByClassName('razorpay-payment-button')[0];
elem.click();
}
</script>
<form action="verify.php" method="POST" id="gateway">
<script onLoad="loadPaymentModal()" src="https://checkout.razorpay.com/v1/checkout.js"
data-key="<?php echo $data['key']?>"
data-amount="<?php echo $data['amount']?>"
data-currency="INR"
data-name="<?php echo $data['name']?>"
data-image="<?php echo $data['image']?>"
data-description="<?php echo $data['description']?>"
data-prefill.name="<?php echo $data['prefill']['name']?>"
data-prefill.email="<?php echo $data['prefill']['email']?>"
data-prefill.contact="<?php echo $data['prefill']['contact']?>"
data-notes.shopping_order_id="3456"
data-order_id="<?php echo $data['order_id']?>"
<?php if ($displayCurrency !=='INR' ) { ?> data - display_amount="<?php echo $data['display_amount']?>" <? php } ?>
<? php if ($displayCurrency !== 'INR') { ?> data - display_currency="<?php echo $data['display_currency']?>" <? php } ?>
>
</script>
<!-- Any extra fields to be submitted with the form but not sent to Razorpay -->
<input type="hidden" name="shopping_order_id" value="3456">
</form>
TA贡献2080条经验 获得超4个赞
<script src="{{url('/')}}/frontendtheme/js/plugins/jquery-3.3.1.min.js"></script>
<script>
$(window).on('load', function() {
jQuery('#gateway').submit();
});
</script>
注意:在脚本源上使用最小.js文件夹
添加回答
举报