payment.php
<p>Redirecting...</p>
<form action="https://biz.traknpay.in/v2/paymentrequest" id="payment_form" method="POST">
<input type="hidden" value="<?php echo $hash; ?>" name="hash"/>
<input type="hidden" value="<?php echo $_POST['api_key'];?>"
name="api_key"/>
<input type="hidden" value="<?php echo $_POST['return_url']; ?>" name="return_url"/>
<input type="hidden" value="<?php echo $_POST['mode'];?>" name="mode"/>
<input type="hidden" value="<?php echo $_POST['order_id'];?>" name="order_id"/>
<input type="hidden" value="<?php echo $_POST['amount'];?>" name="amount"/>
<input type="hidden" value="<?php echo $_POST['currency'];?>" name="currency"/>
<input type="hidden" value="<?php echo $_POST['description'];?>" name="description"/>
<input type="hidden" value="<?php echo $_POST['name'];?>" name="name"/>
<input type="hidden" value="<?php echo $_POST['email'];?>" name="email"/>
<input type="hidden" value="<?php echo $_POST['phone'];?>" name="phone"/>
<input type="hidden" value="<?php echo $_POST['city'];?>" name="city"/>
<input type="hidden" value="<?php echo $_POST['state'];?>" name="state"/>
<input type="hidden" value="<?php echo $_POST['zip_code'];?>" name="zip_code"/>
<input type="hidden" value="<?php echo $_POST['country'];?>" name="country"/>
<noscript><input type="submit" value="Continue"/></noscript>
</form>
<script>
function formAutoSubmit () {
var payform = document.getElementById("payment_form");
payform.submit();
}
window.onload = formAutoSubmit;
</script>
以下是代码将页面重定向到带有参数的支付网关页面。我试图在角度代码中实现相同的功能,但它不再起作用。将支付请求页面的模板作为响应体。
payment.ts
payment(){
let paymentdata = new FormData();
paymentdata.append('api_key', '69563fbfa-939a-4356d8-92567c-fd2d6e560fa72f');
paymentdata.append('order_id', '11111111111124');
paymentdata.append('mode', 'TEST');
paymentdata.append('amount', '200');
paymentdata.append('currency', 'INR');
paymentdata.append('description', 'BLABLA');
paymentdata.append('name', 'Ajith');
paymentdata.append('email', 'ajith@gmail.com');
paymentdata.append('phone', '8086502009');
paymentdata.append('city', 'tvm');
paymentdata.append('country', 'IND');
paymentdata.append('zip_code', '695505');
paymentdata.append('return_url', 'http://localhost:8100/#/payment/paymentrequest');
paymentdata.append('hash', '8A9DBABCF0CBB9618F74DEA95982DD5D710347B643F45A1E1DFFA42941EACB77C9F8D5C79F7D2EF8FDDFCD944E7EDE36F5D2FF8FBC5D0822A2C79CBDCE73DE05');
console.log(paymentdata)
return this.http.post('https://biz.traknpay.in/v2/paymentrequest',paymentdata).map(res=>res).subscribe(res=>
{
window.open("https://biz.traknpay.in/v2/paymentrequest", "_blank");
this.body=res;
console.log(this.body)
},
err=>{
console.log(err)
})
}