-
Notifications
You must be signed in to change notification settings - Fork 65
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
HPP_POST_RESPONSE - field missing? #2
Comments
Hi peppeocchi, The only values passed to our javascript library are the injected fields credit card number, cvv, and expiration date. To pass this information to your back-end, use the success handler in your javascript to put the response/token into a hidden field on your form for submission. Any other value from your form can be passed in normally, the success handler just needs to submit the form once the token is returned. If you need to avoid full page reloads, instead of calling submit on the form, you can put an ajax call in your success handler. Let us know if this helps! |
@eric-vest thanks for the reply, unfortunately I am not able to avoid the full page redirect. So I am using the rxp-js library to load the lightbox with the form . The form is loaded in an iframe and I don't seem to be able to have control over it from the parent window. As soon as the user clicks on "Pay Now" there is a redirect happening to the url provided when initialising the iframe. RealexHpp.lightbox.init("payButtonId", "responseEndpoint", jsonFromRequestEndpoint); As mentioned here https://developer.realexpayments.com/#!/hpp/card-payments#iframe-optimization there should be a
Now, the trouble is that every time I set that field (manually by adding a line here https://github.com/globalpayments/rxp-js/blob/master/examples/hpp/json/process-a-payment.json as there doesn't seem to be a way of setting it with this sdk, although if you see here https://github.com/realexpayments/rxp-hpp-php/blob/master/src/main/php/com-realexpayments-hpp-sdk/utils/RequestMapper.php#L101 it's possible to pass in that field when the json request is encoded - is that repository a valid repository?) after I click on "Pay Now" a javascript error appears in the console saying If I set the field in the JSON used to load the iframe, it results on a duplication of the domain on that hidden field inside the iframe <input type="hidden" name="HPP_POST_RESPONSE" value="https://someurl.com,https://someurl.com"> Is there anything I am missing? Do you have a working example that avoids the redirect to a different page? (PS: I tried sending out emails to your support team but I only got a reply after 12 days and now no reply at all...) The ideal scenario for me would be: I understand this might not be the right place for these questions, if so can you point me to the right place where to ask those questions? |
@peppeocchi The To handle the window.addEventListener('message', function (ev) {
// review event data
console.log(ev.data);
}, false); Doing so should allow for the ideal scenario you outlined. |
@slogsdon thanks for your reply, sorry I wasn't clear on the previous message, I have that event listener but the redirect still happens. As I said if I manually stop the page from redirecting (by pressing ESC on my keyboard when I see the page redirecting) I can see that the message is intercepted by the event listener and it has the correct response in it, but there doesn't seem to be a way of stopping the redirect programmatically. Unless I need to initialise the lighbox in a different way? I tried setting the "responseEndpoint" as null, false, but the user gets redirected to As a reference I've tested it using this example and added the code you mentioned before window.addEventListener('message', function (e) {
console.log(e);
}, false); |
I think this shows the behaviour I am seeing, as you can see I have the event listener logging the event in the console. If you pause the attached video at 00:16 you can see that just before the redirect happens a new message is intercepted and it has the JSON response with the result of the payment like the one in the screenshot below (I don't seem to be able to stop the redirect while recording the screen) Video --> https://we.tl/t-qVJzgAPWBq |
@peppeocchi Thanks for sending over the video, but sadly, our corporate firewall blocks us from watching it. Do you have a publicly accessible link for your integration that you can send over to us via email? [email protected] reaches our team. We're also working on creating a small example project to help you get this sorted. |
@slogsdon thanks, I'll see if I can provide you with a demo page sometime this week, in the meantime I've adapted my code to work with the redirect (still using the lightbox but I'm now handling the response in the redirect, unfortunately the customer, if the payment fails, has to restart the checkout from the beginning which will cause a bad user experience). I'm now experiencing another problem with the lightbox, if I use one of the test cards provided in your documentation, the lightbox freezes and there is an error in the chrome console of an invalid JSON, in fact I see that with successful payments the response from the iframe is a JSON but with this test card the response is just a string. The error is coming from rxp-js and it is causing the iframe to freeze and nothing to happen on the page, not even the redirect. I am using the latest version of rxp-js (1.3.1). The test card I used is |
@peppeocchi I see what you're talking about. The implementation for rxp-js's internal I've also opened another issue to allow integrations to control/opt-out of the redirect process: globalpayments/rxp-js#23. Since these seem to be issues stemming from rxp-js, I'm going to close this issue and defer to the above two, but feel free to open it back up if you feel the need. |
@slogsdon I completely understand this is related to rxp-js and it's better to track these issues on that repository, thank you very much for all your help! |
Hi, the field
HPP_POST_RESPONSE
seems to be missing from the serialized token, how can I let the iframe post back to the parent window without doing a full page redirect?The text was updated successfully, but these errors were encountered: