realex-payments-apiglobal-payments-api

Global Payments HPP sandbox. 508 Invalid characters in MERCHANT_RESPONSE_URL when ngrok is used


Is there any chance to get working the Global Payments HPP sandbox with ngrok?

Currently, it gives

508
Invalid characters in MERCHANT_RESPONSE_URL. Please contact the merchant.

for an URL like https://testsitewww.ap.ngrok.io/~testsite/shop/src/cart.php?target=callback&txn_id_name=txnId&txnId=000008-567H

enter image description here

The full request

(
[ORDER_ID] => testsite2_000008-567H
[MERCHANT_ID] => dev240640823746370784
[TIMESTAMP] => 20201110125116
[ACCOUNT] =>
[AUTO_SETTLE_FLAG] => 1
[HPP_VERSION] => 2
[AMOUNT] => 13999
[HPP_CUSTOMER_PHONENUMBER_MOBILE] =>
[HPP_CUSTOMER_EMAIL] => testsite+test@example.com
[HPP_SHIPPING_POSTALCODE] => 90001
[HPP_SHIPPING_COUNTRY] => 643
[HPP_SHIPPING_CITY] => Los Angeles
[HPP_SHIPPING_STREET1] => test
[HPP_SHIPPING_STREET2] =>
[HPP_SHIPPING_STREET3] =>
[HPP_BILLING_POSTALCODE] => 90001
[HPP_BILLING_COUNTRY] => 643
[HPP_SHIPPING_STATE] =>
[HPP_BILLING_CITY] => Los Angeles
[HPP_BILLING_STREET1] => test
[HPP_BILLING_STREET2] =>
[HPP_BILLING_STREET3] =>
[HPP_ADDRESS_MATCH_INDICATOR] => TRUE
[MERCHANT_RESPONSE_URL] => https://testsitewww.ap.ngrok.io/~testsite/shop/src/cart.php?target=callback&txn_id_name=txnId&txnId=000008-567H
[COMMENT1] => Test company
[CURRENCY] => USD
[SHA1HASH] => e068e2876262d61f22c84f440463fcdb1b42f90a

)

other URLs work correctly.

According to https://developer.globalpay.com/contact-us I have to ask integration questions here


Solution

  • I think the character ~ in URL is causing the issue here, and not ngrok. I have just used nrok for the same, it works fine. My url looks something like: http://6c59460.ngrok.io/realexresponse
    Also, ngrok points to a local IIS url like http://localhost:88. So effectively, the URL I am supplying in MERCHANT_RESPONSE_URL is http://localhost:88/realexresponse

    I found this article suggesting to not use some characters in URL, as they may be reserved by the server or in this case Realex. One of them is ~
    https://help.dragonmetrics.com/en/articles/213986-invalid-characters-in-url