realexpayment-got an error message after successful payment
Asked Answered
R

3

5

I am using realexpayment with amember-5.1.5 and using test account of realexpayment system.

when I signup and make payment using test card I am getting the following message and it does not redirect back to our site:

Your transaction has been successful but there was a problem connecting back to the merchant's web site. Please contact the merchant and advise them that you received this error message.

Racialism answered 20/10, 2016 at 5:2 Comment(0)
C
6

What this means is that our Hosted Payment Page (HPP) was not able to connect to the Response URL you provided us. This URL is specified in the HTTP POST in the field MERCHANT_RESPONSE_URL.

It must be a publicly accessible endpoint so our HPP can connect to it. Your Realex Payments account manager will be able to provide more information on the response we received from your server when we tried to connect to your Response URL, if you can provide to them the relevant Client ID and Order ID.

Best,

Seán MacDomhnall

Realex Payments

Cellist answered 20/10, 2016 at 11:49 Comment(5)
your transaction has been successful but there was a problem connecting back to the merchant's web site . please connect the merchant and advise them that you received this error message. please help me @reaex-paymentsPotted
Hi Savan, this means that our HPP was unable to connect to the response URL that you provided. For example, security rules may have blocked it. You should be able to see the attempt to connect and the failure in your server logs. You can also ask your account manager for more information if you supply the Client ID used and the order id.Cellist
I'm having the same problem as well - I've verified that I'm providing the correct MERCHANT_RESPONSE_URL and that it is publicly accessible.Phonemics
If you can provide the relevant Order ID and Timestamp, please ask your account manager or any member of our support team and they will be able to send you the exact error code our HPP received from trying to connect.Cellist
I have the same problem. I am using some necessary calls to DB on response page. The issue occurs on INSERT query to DB. I checked the query and it is correct and working. But don't know, why the response page display this message on INSERT only. If i comment the INSERT query to DB. Response page starts working.Tortosa
F
4

I had this issue recently and would like to provide some clarification. Realex doesn't redirect to the MERCHANT_RESPONSE_URL but instead displays its contents.

It appears to accept a basic HTML response but not a full blown HTML document.

What I did is to output a small piece of JavaScript on the MERCHANT_RESPONSE_URL page to redirect the customer to a different URL that contains our branding and success (or error) message:

<script>
    window.location=https://example.com/success?msg=<?php echo urlencode( $msg ); ?>
</script>
Fertilize answered 14/3, 2018 at 17:11 Comment(2)
I just tried this, unfortunately I just got a blank white page and the redirect didn't happen, the HTML output shows that the above script is within a div with the class "success" and id "result-message". Not sure if something has changed with the payment gateway since but this doesn't seem to work now.Ethelstan
Interesting, the above worked for me perfectly. Thank you @MrCarrot!Leviathan
L
0

I tried the solution with JavaScript by @MrCarrot first and it didn't work, but later found another working one. I thought that, instead of just a comment, I mention a few bits about the response and error handling.

MERCHANT_RESPONSE_URL needs to be a public (and I assume HTTPS) address where your script waits for a POST from Realex servers. The POST looks like this:

[RESULT] => 00
[AUTHCODE] => 12345
[MESSAGE] => [ test system ] AUTHORISED
[PASREF] => 16542926167123558
[MERCHANT_ID] => merchantid
[ORDER_ID] => INV-223665
[TIMESTAMP] => 20220603224317
[AMOUNT] => 9480
[SHA1HASH] => 934138a1157dead529806e9ed5578f538e1a68c8

Now you really should check the SHA1HASH as described at Card Payments: Check hash. You will need the original TIMESTAMP your request was from, MERCHANT_ID, ORDER_ID, RESULT number, the MESSAGE, PASREF, and AUTHCODE. Implode these with a full stop, so you'll get something like

20220603224317.merchantid.INV-223665.00.[ test system ] AUTHORISED.16542926167123558.12345

and run sha1() on it. Then, add your secret

ea4dcce506c6e5ee3fbaeae212477be838733694.mySecr3t

and run sha1() again, then compare it with the SHA1HASH response. Only if it equals, you should mark the payment as valid and send header("HTTP/1.0 200 OK").

Then you can redirect back with the above JavaScript, and maybe instead of the whole message, you can just send this error id. What I do is to go back to my payment page with either /thanks or /error111 to show a possible error message.

<script language='javascript' type='text/javascript'>
 window.location.replace('https://pay.example.com/{orderId}/error{result}');
</script>
Leviathan answered 4/6, 2022 at 10:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.