Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3d secure v2 #14

Open
Jey-Vclub opened this issue Jul 24, 2020 · 31 comments
Open

3d secure v2 #14

Jey-Vclub opened this issue Jul 24, 2020 · 31 comments

Comments

@Jey-Vclub
Copy link

Hello all,

Im using global payments sdk to make payments with 3d secure version2. I did some POC using their SDK and its ok.

But, i do have very less knowledge about design payment gateway page with global payments

any one of you, please help me how to collect card details, pass it to global payments with 3d secure v2, incase if the card is not enabled for 3ds v2 then it has work by normal payment methodology.

experts please help me

thanks
jey

@seanmacdomhnall-gp
Copy link

seanmacdomhnall-gp commented Jul 31, 2020

Hi @Jey-Vclub

How to collect card data to process an Authorization is outlined here: https://developer.globalpay.com/ecommerce/remote-api#api

With more detail in the API Explorer: https://developer.globalpay.com/api/card-payments#api-authorization

You might also consider using the Hosted Payment Page (HPP) which is responsible for collecting card data, performing 3D Secure 2 and so on. It also reduces your application's PCI overhead and is generally a more secure way (from a merchant perspective) of processing card data.

The HPP documentation is available here: https://developer.globalpay.com/ecommerce/hosted-payment-page#hpp

@Jey-Vclub
Copy link
Author

Jey-Vclub commented Jul 31, 2020 via email

@Jey-Vclub
Copy link
Author

Jey-Vclub commented Aug 3, 2020 via email

@Jey-Vclub
Copy link
Author

hello @seanmacdomhnall-gp

first thanks for your response. i did read many things from https://developer.globalpay.com/ecommerce/hosted-payment-page#hpp

at the end i developed 2 pages to use Lightbox

`<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="WebApplication3DsV2.HPP.Index" %>

<title></title> <script src="https://code.jquery.com/jquery-3.5.0.js"></script> <script src="../Lib/rxp-hpp.js"></script> <script> $(document).ready(function () { alert("hpp js fucntion called"); var data = $('#MyHidden').val(); //alert(data); jsonFromRequestEndpoint = data; alert(jsonFromRequestEndpoint); $.getJSON("Index.aspx", function (jsonFromRequestEndpoint) { RealexHpp.setHppUrl("https://pay.sandbox.realexpayments.com/pay"); RealexHpp.lightbox.init("payButtonId", "HppResponse.aspx", jsonFromRequestEndpoint); }); }); </script>

below code is code behind of the same Index.asp

using GlobalPayments.Api;
using GlobalPayments.Api.Entities;
using GlobalPayments.Api.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication3DsV2.HPP
{
public partial class Index : System.Web.UI.Page
{
string strDbMode = "QA";

    protected void Page_Load(object sender, EventArgs e)
    {
        HPPResponse();
    }

    private  string HPPResponse()
    {
        // configure client, request and HPP settings
        var service = new HostedService(new GatewayConfig
        {
            MerchantId = (strDbMode != "Live" ? CommonConstant.MerchantId : CommonConstant.MerchantId.Replace("Test", string.Empty)),
            AccountId = CommonConstant.AccountId,
            SharedSecret = CommonConstant.SharedSecret,
            ServiceUrl = "https://pay.sandbox.realexpayments.com/pay",
            HostedPaymentConfig = new HostedPaymentConfig
            {
                Version = "2"
            }
        });

        // Add 3D Secure 2 Mandatory and Recommended Fields
        var hostedPaymentData = new HostedPaymentData
        {
            CustomerEmail = "james.mason@example.com",
            CustomerPhoneMobile = "44|07123456789",
            AddressesMatch = false
        };

        var billingAddress = new Address
        {
            StreetAddress1 = "Flat 123",
            StreetAddress2 = "House 456",
            StreetAddress3 = "Unit 4",
            City = "Halifax",
            PostalCode = "W5 9HR",
            Country = "826"
        };

        var shippingAddress = new Address
        {
            StreetAddress1 = "Apartment 825",
            StreetAddress2 = "Complex 741",
            StreetAddress3 = "House 963",
            City = "Chicago",
            State = "IL",
            PostalCode = "50001",
            Country = "840",
        };

        try
        {
            var jsonFromRequestEndpoint = service.Charge(19.99m)
               .WithCurrency("EUR")
               .WithHostedPaymentData(hostedPaymentData)
               .WithAddress(billingAddress, AddressType.Billing)
               .WithAddress(shippingAddress, AddressType.Shipping)
               .Serialize();
            MyHidden.Value = jsonFromRequestEndpoint;
            return jsonFromRequestEndpoint;
            // TODO: pass the HPP request JSON to the JavaScript, iOS or Android Library
        }

        catch (ApiException exce)
        {
            return exce.Message;
            // TODO: Add your error handling here
        }
    }
}

}
`
Under lib folder included rxp-hpp.js and rxp-remote.js files

HPPResponse.aspx page also designed but, no need to post it here because, the problem is in Index page, its not at all creating iframe , simply displaying plain page.

may i know what is the reason of not creating iFrame?

@Jey-Vclub
Copy link
Author

Hello there,

can someone please help me on this issue?

thanks
jey

@seanmacdomhnall-gp
Copy link

Hi @Jey-Vclub, I'm not sure what you mean when you say:

But, the example is in PHP only not in .Net. evidence please refer below screenshots so, could you please share example of HPP in .net?

On that page you can switch between languages (Java, PHP, .NET), the HPP screenshots don't change as the language you are using has no bearing on the HPP itself.

As for why the iFrame is not being created. It's difficult for me to tell based on the code that you have posted, are there any errors being shown in the Console of your browser's Developer Tools? Also, if you check the Network tab of the Developer Tools can you see the AJAX call to the server-side and the JSON string be returned?

@Jey-Vclub
Copy link
Author

hello @seanmacdomhnall-gp
thanks for your response. Now, iframe loaded popup and i entered card details, after that it is went to HppResponse.aspx but, there is no hppResponse hidden field so, i cant get the response so, what it could be the problem?
kindly help me

@seanmacdomhnall-gp
Copy link

If the transaction is processed successfully, the HPP will return the response to the iFrame as a JSON string. This is then sent to the HppResponse.aspx and the browser redirected. So are you saying that the JavaScript Library is sending a blank string to HppResponse.aspx or what?

@Jey-Vclub
Copy link
Author

thanks for your response @seanmacdomhnall-gp

the transaction is completed, and the page redirected into HppResponse.aspx, there at page_load event i tried to get value by using
var __hppResponse = Request.Form["hppResponse"];
but, it gives null value so,

  1. I tried view page source from browser there is no hppResponse hidden object
  2. while making transaction, I put break point in rxp-hpp.js in below code

//Create a form and submit the hpp response to the merchant's response url
var form = document.createElement("form");
form.setAttribute("method", "POST");
//form.setAttribute("method", "GET");

				form.setAttribute("action", merchantUrl);
				form.setAttribute("id", "frmJ");

				form.appendChild(internal.createFormHiddenInput("hppResponse", response));

				document.body.appendChild(form);

				form.submit();
  1. there i could see the form objects outerhtml text has object elements too

But, when i it reach HppResponse.aspx there is no hidden object as hppResponse

At the same time if i change the code like form.setAttribute("method", "GET") then HppResponse.aspx has query of hppResponse hidden object.

could you please guide me to resolve this issue?

@seanmacdomhnall-gp
Copy link

@Jey-Vclub with the breakpoint in place, for example at form.submit(), what is the value of the variable response?

@Jey-Vclub
Copy link
Author

Jey-Vclub commented Aug 11, 2020

@seanmacdomhnall-gp

At form.appendChild(internal.createFormHiddenInput("hppResponse", response)); this line
response value is like below

"{"CAVV":"","SHIPPING_CODE":"NTAwMDE=","SRD":"YmgyUGZ0aHpNc3p5b21JQg==","CVNRESULT":"TQ==","HPP_CUSTOMER_PHONENUMBER_MOBILE":"NDR8MDcxMjM0NTY3ODk=","HPP_SHIPPING_STREET3":"SG91c2UgOTYz","HPP_SHIPPING_STREET1":"QXBhcnRtZW50IDgyNQ==","PASREF":"MTU5NzE0MTYxMzc3Mzg5Mg==","HPP_SHIPPING_STREET2":"Q29tcGxleCA3NDE=","MESSAGE":"WyB0ZXN0IHN5c3RlbSBdIEFVVEhPUklTRUQ=","BILLING_CODE":"VzUgOUhS","DS_TRANS_ID":"MmE4NDJiMzYtNDMyMi00MDhhLWE0NTAtNGQ4YjNhYmVhNWY0","ACCOUNT":"aW50ZXJuZXQ=","AVSPOSTCODERESULT":"TQ==","AMOUNT":"MTk5OQ==","TIMESTAMP":"MjAyMDA4MTExMTI2NDU=","pas_uuid":"NTJhZDllOWEtMmE5Ny00NGI4LTkzZjAtNDU3NTRjZjZmN2Rm","HPP_BILLING_STREET3":"VW5pdCA0","HPP_ADDRESS_MATCH_INDICATOR":"RkFMU0U=","HPP_BILLING_STREET2":"SG91c2UgNDU2","AUTHCODE":"MTIzNDU=","HPP_BILLING_STREET1":"RmxhdCAxMjM=","HPP_BILLING_CITY":"SGFsaWZheA==","HPP_SHIPPING_COUNTRY":"ODQw","AVSADDRESSRESULT":"TQ==","HPP_SHIPPING_POSTALCODE":"NTAwMDE=","AUTHENTICATION_VALUE":"TVRJek5EVTJOeWc1TURBNU9EYzJOVFF6TWpFPQ==","HPP_BILLING_POSTALCODE":"VzUgOUhS","ECI":"MDU=","HPP_BILLING_COUNTRY":"ODI2","MESSAGE_VERSION":"Mi4xLjA=","BATCHID":"ODIwMTky","XID":"","SHA1HASH":"Y2I1OWE4ZjYwNjkwZjQxOGViZTUzNmYyMzEwNzhlNzk2OTY1ZDM3ZA==","HPP_SHIPPING_CITY":"Q2hpY2Fnbw==","ORDER_ID":"NkprblJWMFc1a1dUa1gtaGFNOU9Cdw==","BILLING_CO":"ODI2","HPP_SHIPPING_STATE":"SUw=","HPP_CUSTOMER_EMAIL":"amFtZXMubWFzb25AZXhhbXBsZS5jb20=","RESULT":"MDA=","SHIPPING_CO":"ODQw","MERCHANT_ID":"Uk1JQ29uc29ydGl1bVRlc3Q="}"

form.outerHTML shows below

"<form method="POST" action="https://localhost:44397/HPP/HppResponse.aspx" id="frmJ"><input type="hidden" name="hppResponse" value="{&quot;CAVV&quot;:&quot;&quot;,&quot;SHIPPING_CODE&quot;:&quot;NTAwMDE=&quot;,&quot;SRD&quot;:&quot;YmgyUGZ0aHpNc3p5b21JQg==&quot;,&quot;CVNRESULT&quot;:&quot;TQ==&quot;,&quot;HPP_CUSTOMER_PHONENUMBER_MOBILE&quot;:&quot;NDR8MDcxMjM0NTY3ODk=&quot;,&quot;HPP_SHIPPING_STREET3&quot;:&quot;SG91c2UgOTYz&quot;,&quot;HPP_SHIPPING_STREET1&quot;:&quot;QXBhcnRtZW50IDgyNQ==&quot;,&quot;PASREF&quot;:&quot;MTU5NzE0MTYxMzc3Mzg5Mg==&quot;,&quot;HPP_SHIPPING_STREET2&quot;:&quot;Q29tcGxleCA3NDE=&quot;,&quot;MESSAGE&quot;:&quot;WyB0ZXN0IHN5c3RlbSBdIEFVVEhPUklTRUQ=&quot;,&quot;BILLING_CODE&quot;:&quot;VzUgOUhS&quot;,&quot;DS_TRANS_ID&quot;:&quot;MmE4NDJiMzYtNDMyMi00MDhhLWE0NTAtNGQ4YjNhYmVhNWY0&quot;,&quot;ACCOUNT&quot;:&quot;aW50ZXJuZXQ=&quot;,&quot;AVSPOSTCODERESULT&quot;:&quot;TQ==&quot;,&quot;AMOUNT&quot;:&quot;MTk5OQ==&quot;,&quot;TIMESTAMP&quot;:&quot;MjAyMDA4MTExMTI2NDU=&quot;,&quot;pas_uuid&quot;:&quot;NTJhZDllOWEtMmE5Ny00NGI4LTkzZjAtNDU3NTRjZjZmN2Rm&quot;,&quot;HPP_BILLING_STREET3&quot;:&quot;VW5pdCA0&quot;,&quot;HPP_ADDRESS_MATCH_INDICATOR&quot;:&quot;RkFMU0U=&quot;,&quot;HPP_BILLING_STREET2&quot;:&quot;SG91c2UgNDU2&quot;,&quot;AUTHCODE&quot;:&quot;MTIzNDU=&quot;,&quot;HPP_BILLING_STREET1&quot;:&quot;RmxhdCAxMjM=&quot;,&quot;HPP_BILLING_CITY&quot;:&quot;SGFsaWZheA==&quot;,&quot;HPP_SHIPPING_COUNTRY&quot;:&quot;ODQw&quot;,&quot;AVSADDRESSRESULT&quot;:&quot;TQ==&quot;,&quot;HPP_SHIPPING_POSTALCODE&quot;:&quot;NTAwMDE=&quot;,&quot;AUTHENTICATION_VALUE&quot;:&quot;TVRJek5EVTJOeWc1TURBNU9EYzJOVFF6TWpFPQ==&quot;,&quot;HPP_BILLING_POSTALCODE&quot;:&quot;VzUgOUhS&quot;,&quot;ECI&quot;:&quot;MDU=&quot;,&quot;HPP_BILLING_COUNTRY&quot;:&quot;ODI2&quot;,&quot;MESSAGE_VERSION&quot;:&quot;Mi4xLjA=&quot;,&quot;BATCHID&quot;:&quot;ODIwMTky&quot;,&quot;XID&quot;:&quot;&quot;,&quot;SHA1HASH&quot;:&quot;Y2I1OWE4ZjYwNjkwZjQxOGViZTUzNmYyMzEwNzhlNzk2OTY1ZDM3ZA==&quot;,&quot;HPP_SHIPPING_CITY&quot;:&quot;Q2hpY2Fnbw==&quot;,&quot;ORDER_ID&quot;:&quot;NkprblJWMFc1a1dUa1gtaGFNOU9Cdw==&quot;,&quot;BILLING_CO&quot;:&quot;ODI2&quot;,&quot;HPP_SHIPPING_STATE&quot;:&quot;SUw=&quot;,&quot;HPP_CUSTOMER_EMAIL&quot;:&quot;amFtZXMubWFzb25AZXhhbXBsZS5jb20=&quot;,&quot;RESULT&quot;:&quot;MDA=&quot;,&quot;SHIPPING_CO&quot;:&quot;ODQw&quot;,&quot;MERCHANT_ID&quot;:&quot;Uk1JQ29uc29ydGl1bVRlc3Q=&quot;}"></form>"

One more info is form.submit(); at this line i see in QuickWatch it says 'undefined'

please let me know if you need any more info.

thanks
jey

@seanmacdomhnall-gp
Copy link

I'm not sure what you mean exactly by One more info is form.submit(); at this line i see in QuickWatch it says 'undefined'

It says what is undefined? form?

If the browser is being redirected to HppResponse.aspx that means the form is submitting. Can you see from the Browser Developer Tools (or whatever you are using to inspect the code) - when the browser is redirect to HppResponse.aspx the form data should be included which is the JSON response string?

@Jey-Vclub
Copy link
Author

Jey-Vclub commented Aug 11, 2020

@seanmacdomhnall-gp

when i inspect from chrome browser the page looks like below and there is no hppResponse hidden object
https://snipboard.io/mKY2Mb.jpg

@seanmacdomhnall-gp
Copy link

Is that screenshot from when you inspect the page on HppResponse.aspx?

@Jey-Vclub
Copy link
Author

yes, its from HppResponse.aspx inspect screenshot

@seanmacdomhnall-gp
Copy link

seanmacdomhnall-gp commented Aug 11, 2020

I would not expect there to be a hppResponse object on HppResponse.aspx the client-side unless you have written the code to create one.

When form.submit() triggers it sends a HTTP POST to HppResponse.aspx and also redirects the browser there.

So now we're back to your server-side code from earlier, where you want to grab the value of the POST.

For .NET that's var __hppResponse = Request.Form["hppResponse"]; (or whatever server-side method you wish to use to do this).

@Jey-Vclub
Copy link
Author

Jey-Vclub commented Aug 11, 2020

@seanmacdomhnall-gp

I have 2 pages, Pay.aspx and HppResponse.aspx

From Pay.aspx its open lightbox HPP, there i enter CC details then its redirected to HppResponse.asox

On HppResponse.aspx Page_load event i tried to run the code
var __hppResponse = Request.Form["hppResponse"]; (server side code)
but, it returns only null value since, there is no object as "hppResponse" So, i tried to execute the same code at Page_Init event (server side code) then also returns null;

after that only i realized that the client side JS the <form>.....</form> is not submitted.

I dont know what to do; thats why seeking your help.

thanks
jey

@seanmacdomhnall-gp
Copy link

seanmacdomhnall-gp commented Aug 11, 2020

When you say

<form>.....</form> is not submitted.

What form are you referring to? It cannot be the form created by rxp-hpp.js, we know that is submitted from the fact that the browser is redirected HppResponse.aspx.

So I guess the next question is why, on the server-side, HppResponse.aspx cannot pick up the value of the HTTP POST that contains hppResponse?

@Jey-Vclub
Copy link
Author

Jey-Vclub commented Aug 11, 2020

What form are you referring to? It cannot be the form created by rxp-hpp.js, we know that is submitted from the fact that the browser is redirected HppResponse.aspx.

below is my HppResponse.aspx, there after post nothing is generated

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HppResponse.aspx.cs" Inherits="WebApplication3DsV2.HPP.HppResponse" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">


<head runat="server">
    <title></title>
   
</head>
<body>
    <form id="form1" runat="server">
        
    </form>
</body>
</html>

So I guess the next question is why, on the server-side, HppResponse.aspx cannot pick up the value of the HTTP POST that contains hppResponse?
Yes you are right, i also have the same question

@Jey-Vclub
Copy link
Author

@seanmacdomhnall-gp
my biggest doubt is, the form is not submitted, thats why there is no hppResponse hidden object preset in HppResponse.aspx if so, what shall we do?!!

please help me

@seanmacdomhnall-gp
Copy link

The form must be submitted, otherwise the redirection to HppResponse.aspx would not occur.

Can you share the code that exists here: HppResponse.aspx.cs

@Jey-Vclub
Copy link
Author

@seanmacdomhnall-gp
below is the code behind of HppResponse.aspx.cs

`using GlobalPayments.Api;
using GlobalPayments.Api.Entities;
using GlobalPayments.Api.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;

namespace WebApplication3DsV2.HPP
{
public partial class HppResponse : System.Web.UI.Page
{
string strDbMode = "QA";

    protected void Page_Init(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            var __VIEWSTATEGENERATOR = Request.Form["__VIEWSTATEGENERATOR"];
            var __VIEWSTATE = Request.Form["__VIEWSTATE"];
            var __hppResponse = Request.Form["hppResponse"];
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            var __VIEWSTATEGENERATOR = Request.Form["__VIEWSTATEGENERATOR"];
            var __VIEWSTATE = Request.Form["__VIEWSTATE"];
            var __hppResponse = Request.Form["hppResponse"];
        }
        //ProcessResponse();
    }

}`

@seanmacdomhnall-gp
Copy link

Hi @Jey-Vclub, I can't really see anything from what you have posted. Are you able to see the JSON string hit the server-side at all? For example, in the network logs?

@Jey-Vclub
Copy link
Author

@seanmacdomhnall-gp thanks for your update.

sorry no json comes to HppResponse.aspx and aspx.cs(meant server side). If we fixed to have html text return from HPP iframe on HppResponse.aspx then the problem is resolved but, that is the problem. seriously more than 2 weeks im trying in many different ways but, nothing helped me, as well 3d security dead line is nearby.

@Jey-Vclub
Copy link
Author

Jey-Vclub commented Aug 12, 2020

@seanmacdomhnall-gp

I have created new project so, below are the steps i did

  1. Create new web form application project using .net framework 4.7.2 from Visual Studio 2019, set project name as 3dSecurityHPP

  2. Delete all .aspx files from root directory. Create 2 new web forms called Pay.aspx and Response.aspx

  3. Pay.aspx code is below

`<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Pay.aspx.cs" Inherits="_3dSecurityHPP.Pay" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="https://code.jquery.com/jquery-3.5.0.js"></script>
    <script src="Scripts/LibGlobalPay/rxp-hpp.js"></script>
    
    
    <script>

        $(document).ready(function () {
            //alert("script start");
            if ($("#MyHidden").val() == "1") {
                $("#MyHidden").val("2");
                $.getJSON("pay.json", function (jsonFromRequestEndpoint) {
                    //alert("before start sethppurl");
                    //jsonFromRequestEndpoint = $("#hdnJson").val();
                    //alert(jsonFromRequestEndpoint.ORDER_ID);
                    RealexHpp.setHppUrl("https://pay.sandbox.realexpayments.com/pay");
                    //alert("after sethppurl");
                    RealexHpp.lightbox.init("payButtonId", "https://localhost:44386/Response.aspx", jsonFromRequestEndpoint);
                    //$('body').addClass('loaded');
                });
            }
        });


    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <input type="submit" id="payButtonId" value="Checkout Now" onclick="return false" />
            <asp:HiddenField ID="MyHidden" runat="server" Value="1" />
        </div>
    </form>
</body>
</html>
`

  1. Installed GlobalPaymentAPI version 1.6.9 since, the lattest version gives error in next step at line var service = new HostedService(new GatewayConfig so, i used v 1.6.9

  2. Pay.aspx..cs (server side code is like below)
    `using GlobalPayments.Api;
    using GlobalPayments.Api.Entities;
    using GlobalPayments.Api.Services;
    using Newtonsoft.Json;
    using Newtonsoft.Json.Linq;
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;

namespace _3dSecurityHPP
{
public partial class Pay : System.Web.UI.Page
{
static string strDbMode = "QA";
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
HPPResponse();
}
//var __hppResponse = Request.Form["hppResponse"];
}

    public string HPPResponse()
    {
        // configure client, request and HPP settings
        
        var service = new HostedService(new GatewayConfig
        {
            MerchantId = (strDbMode != "Live" ? CommonConstant.MerchantId : CommonConstant.MerchantId.Replace("Test", string.Empty)),
            AccountId = CommonConstant.AccountId,
            SharedSecret = CommonConstant.SharedSecret,
            ServiceUrl = "https://pay.sandbox.realexpayments.com/pay",
            HostedPaymentConfig = new HostedPaymentConfig
            {
                Version = "2"
            }
        });

        // Add 3D Secure 2 Mandatory and Recommended Fields
        var hostedPaymentData = new HostedPaymentData
        {
            CustomerEmail = "james.mason@example.com",
            CustomerPhoneMobile = "44|07123456789",
            AddressesMatch = false
        };

        var billingAddress = new Address
        {
            StreetAddress1 = "Flat 123",
            StreetAddress2 = "House 456",
            StreetAddress3 = "Unit 4",
            City = "Halifax",
            PostalCode = "W5 9HR",
            Country = "826"
        };

        var shippingAddress = new Address
        {
            StreetAddress1 = "Apartment 825",
            StreetAddress2 = "Complex 741",
            StreetAddress3 = "House 963",
            City = "Chicago",
            State = "IL",
            PostalCode = "50001",
            Country = "840",
        };

        try
        {
            var jsonFromRequestEndpoint = service.Charge(19.99m)
               .WithCurrency("EUR")
               .WithHostedPaymentData(hostedPaymentData)
               .WithAddress(billingAddress, AddressType.Billing)
               .WithAddress(shippingAddress, AddressType.Shipping)
               .Serialize();
            //hdnJson.Value = Newtonsoft.Json.JsonConvert.SerializeObject(jsonFromRequestEndpoint);

            JToken token = JToken.Parse(jsonFromRequestEndpoint);
            JObject json = JObject.Parse(Convert.ToString(token));

            // serialize JSON to a string and then write string to a file
            File.WriteAllText(Server.MapPath("") + "\\" + "Pay.json", JsonConvert.SerializeObject(json));
            return jsonFromRequestEndpoint;
            // TODO: pass the HPP request JSON to the JavaScript, iOS or Android Library
        }

        catch (ApiException exce)
        {
            return exce.Message;
            // TODO: Add your error handling here
        }
    }
}

}`

  1. Create Pay.json file in root directory itself.

  2. Create folder called LibGlobalPay under Scripts folder, there copy paste js file from https://raw.githubusercontent.com/globalpayments/rxp-js/master/lib/rxp-hpp.js

7.1 CommonConstant.cs is a static class file to keep shared secret, Merchant id etc.,

  1. below is the code of Response.aspx
`<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Response.aspx.cs" Inherits="_3dSecurityHPP.Response" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
        </div>
    </form>
</body>
</html>
`

  1. below is the code of Response.aspx.cs(server side code)
    `using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;

namespace _3dSecurityHPP
{
public partial class Response : System.Web.UI.Page
{
string strDbMode = "QA";

    protected void Page_Init(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            var __VIEWSTATEGENERATOR = Request.Form["__VIEWSTATEGENERATOR"];
            var __VIEWSTATE = Request.Form["__VIEWSTATE"];
            var __hppResponse = Request.Form["hppResponse"];
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            var __VIEWSTATEGENERATOR = Request.Form["__VIEWSTATEGENERATOR"];
            var __VIEWSTATE = Request.Form["__VIEWSTATE"];
            var __hppResponse = Request.Form["hppResponse"];
        }
        //ProcessResponse();
    }
}

}`

  1. set Pay.aspx as start page and run there when i click payButtonId id then HPP pops up, there i gave CC as 4263970000005262, CVV as any 3 digit, exp. as 12/21, card holder JEY and click "Proceed to verification" button

  2. No problem raised so, automatically moved into Response.aspx there is no hppResponse generated.

So, the same issue continues. Could you please take my source code and try to reproduce the issue from your end.

Kindly let me know if you need any more info.

thank you very mcuh
jey #

@Jey-Vclub
Copy link
Author

good morning @seanmacdomhnall-gp

was that my post helpful to reproduce the issue!!?

thanks
jey

@Jey-Vclub
Copy link
Author

Good morning @seanmacdomhnall-gp

Is there any good improvement about my query!!?

thanks
jey

@Jey-Vclub
Copy link
Author

Hello @seanmacdomhnall-gp

Did you get a chance to resolve this issue?

Kindly let me know if you need more details, we are awaiting since, its very important issue.

thanks
jey

@seanmacdomhnall-gp
Copy link

Hi @Jey-Vclub, please reach out to ecomsupport@globalpay.com or your Global Payments account manager for further escalation steps. There is not much more we can do in this thread and this should be handled by our Operations Team. Thanks.

@Jey-Vclub
Copy link
Author

Jey-Vclub commented Aug 18, 2020 via email

@seanmacdomhnall-gp
Copy link

I have spoken to my colleague on the Support Team who is going to reach out to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants