68
Views
2
Comments
Solved
HTTP Post Request for Payment Gateway
Question

Hello Everyone,

I am trying to implement the payment gateway redirection in OutSystems. However, Somehow I am not able to to send data through HTTP post.

I have tried Using C# & JS as well.

Also I have tried HTTPRequestHandler. But I am still facing same issue.

Below is the example of HTML form data which I need to send to Payment Gateway using HTTP post:


<html><body><form name='FrmHtmlCheckout' method='POST' >
<input type='hidden' name='TransactionType' value='XXX'>
<input type='hidden' name='PymtMethod' value='XX'>
<input type='hidden' name='ServiceID' value='XX'>
<input type='hidden' name='PaymentID' value='XX'>
<input type='hidden' name='OrderNumber' value='XX'>
<input type='hidden' name='PaymentDesc' value='XX No'>
<input type='hidden' name='MerchantName' value='XX'>
<input type='hidden' name='MerchantReturnURL' value='XX'>
<input type='hidden' name='Amount' value='1.00'>
<input type='hidden' name='CurrencyCode' value='XX'>
<input type='hidden' name='CustName' value='XX'>
<input type='hidden' name='CustEmail' value='XXX@gmail.com'>
<input type='hidden' name='CustPhone' value='XXX'>
<input type='hidden' name='HashValue' value='XXX'>
</form><script language='javascript'> CheckOut();function CheckOut(){document.FrmHtmlCheckout.action = 'https://pay.e-ghl.com/IPGSG/Payment.aspx';document.FrmHtmlCheckout.submit();}</script></body></HTML>


Can anyone guide me how I can achieve this?


Thanks in advance!

UserImage.jpg
Afaque Shaikh
Solution

@Shubham Doshi ,


You can simply achieve this by using HTML element and JS widget. 

Try below steps:
Step 1: Add Form widget and set the attributes properties

Step 2:  add all the hidden  fields using HTML Element widget inside form and set required attributes (See below screenshot)



 Step 3: Add button 

3.1 Add button
3.2 create new screen action  and linked it to onclick property of button
3.3 add JS widget inside onbuttonclick client action.
See screenshot

Result: 
Inside network tab of Payment Gateway page you can see the submitted values:


You can refer the attached demo OML file. 

DemoPaymentGatwayForm.oml
2022-11-16 10-07-10
Blane Thompson

If you are trying to consume the request using reactive, the only ways to do this would either be using Traditional to consume the POST request or having to use a HTTP REST api. It is not pretty, but it's the only ways to do it.

UserImage.jpg
Afaque Shaikh
Solution

@Shubham Doshi ,


You can simply achieve this by using HTML element and JS widget. 

Try below steps:
Step 1: Add Form widget and set the attributes properties

Step 2:  add all the hidden  fields using HTML Element widget inside form and set required attributes (See below screenshot)



 Step 3: Add button 

3.1 Add button
3.2 create new screen action  and linked it to onclick property of button
3.3 add JS widget inside onbuttonclick client action.
See screenshot

Result: 
Inside network tab of Payment Gateway page you can see the submitted values:


You can refer the attached demo OML file. 

DemoPaymentGatwayForm.oml
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.