Moneris PreAuthorization using DirectPost method

I m integrating a few gateways in my product, but I m stuck on Moneris (eSelectPlus). Issue is, I cant find a config variable to specify which type of Transaction Type I want to use (i-e: PreAuth, PreAuth Complete/Capture, Purchase .. etc). I m calling this url from Post man for testing,

https://esqa.moneris.com/HPPDP/index.php?ps_store_id={{store_id}}&hpp_key={{key}}&charge_total=11.00&order_id=0ec60134-7e2a-49a2-a1f7-a5e66b89862b

most gateways have a config variable in this url, I cant find that in Moneris.
and this is the response i get,

<form method=POST action="https://www.store.goodbarsecurity.com/checkout_confirmation.php" name="responseForm"><input type="hidden" name="response_order_id" id="response_order_id" value="mdp19272024343p77"><input type="hidden" name="date_stamp" id="date_stamp" value="2019-09-30"><input type="hidden" name="time_stamp" id="time_stamp" value="02:45:34"><input type="hidden" name="bank_transaction_id" id="bank_transaction_id" value="660148420014985290"><input type="hidden" name="charge_total" id="charge_total" value="10.00"><input type="hidden" name="bank_approval_code" id="bank_approval_code" value="755358"><input type="hidden" name="response_code" id="response_code" value="027"><input type="hidden" name="iso_code" id="iso_code" value="01"><input type="hidden" name="message" id="message" value="**APPROVED**           *                    ="><input type="hidden" name="trans_name" id="trans_name" value="purchase"><input type="hidden" name="cardholder" id="cardholder" value=""><input type="hidden" name="f4l4" id="f4l4" value="4242***4242"><input type="hidden" name="card" id="card" value="V"><input type="hidden" name="expiry_date" id="expiry_date" value=""><input type="hidden" name="result" id="result" value="1"><input type="hidden" name="transactionKey" id="transactionKey" value="{{transaction_key}}"></form><div style="display:none;height:1px;width:1px;overflow:hidden"><img src="https://www.offlinx.com/pixel.gif?program_id=directpost&visitor_id=dpp1569825823TXKoULoow6N93uwhh" alt="moneris_logo"> </div><script>
        function init()
        {
            document.responseForm.submit();
        }
        
        window.onload=init;
        </script>

as you can see, its approved but Transaction Type is "Purchase", I want this type to change as "PreAuth" or something.

Upvotes: 1

Views: 284

Answers (1)

I solved the issue by passing xml string like this:

POST a request on this Link

https://esqa.moneris.com/gateway2/servlet/MpgRequest

Using a header:

Content-Type: application/xml

For PreAuth request XML would be something like:

<?xml version="1.0"?>
<request>
    <store_id>yourstoreid</store_id>
    <api_token>yourapitoken</api_token>
    <purchase>
        <crypt_type>1</crypt_type>
        <order_id>a863eed8-9a79-4e92-892b-06f1bd23c68a</order_id>
        <cust_id>testclient1</cust_id>
        <amount>11.00</amount>
        <pan>4111111111111111</pan>
        <expdate>2709</expdate>
        <cust_info>
            <first_name>eselectplus</first_name>
            <last_name>test</last_name>
            <address>address1</address>
            <city>Mississauga</city>
            <country>Canada</country>
            <postal_code>ABC 123</postal_code>
            <phone_number>123456789</phone_number>
            <email>[email protected]</email>
        </cust_info>
    </purchase>
</request>

For completing this request POST a completion request on the same URL like:

<?xml version="1.0"?>
<request>
 <store_id>yourstoreid</store_id>
 <api_token>yourapitoken</api_token>
    <completion>
        <order_id>a863eed8-9a79-4e92-892b-06f1bd23c68a</order_id>
        <txn_number>24-0_14</txn_number>
        <comp_amount>11.00</comp_amount>
        <crypt_type>1</crypt_type>
        <cust_info>
        </cust_info>
    </completion>
</request>

I hope this helps someone sometime.

Upvotes: 1

Related Questions