globalpayments / rxp-js

Global Payments Ecommerce JavaScript Library
MIT License
34 stars 70 forks source link

Can't access the result of the HPP form submission. #58

Open DariusLeibiuc opened 11 months ago

DariusLeibiuc commented 11 months ago

I am using embedded iframe like this, similar to the example.

React.useEffect(() => {
    const loadRealexHpp = async () => {
      try {
        const response = await fetch('http://localhost:4000/api/hppReq');

        const jsonFromRequestEndpoint = await response.json();

        RealexHpp.setHppUrl('https://pay.sandbox.realexpayments.com/pay');

        RealexHpp.embedded.init(
          'payButtonId',
          'iframeId',
          (answer: any) => {
            console.log('embed answer: ', answer);

            if (answer.AUTHCODE) {
              console.log('HPP SUCCESSSS!!!');
            } else {
              console.log('HPP FAIL!!!');
            }
          },
          jsonFromRequestEndpoint
        );
      } catch (error) {
        console.error('An error occurred:', error);
      }

    };

    loadRealexHpp();
  }, []);

The form with the card details appears without problems and is also submitted, but the callback is never executed, so I have no information about the result of the HPP form submission. I need to do actions inside that callback, based on the call result.

h-batal commented 9 months ago

Have you managed to find a solution?

DariusLeibiuc commented 9 months ago

So unfortunately card details are still not being returned if the Realex library is initialized with the sandbox url. ( RealexHpp.setHppUrl(GLOBAL_PAYMENTS_API) ) I've noticed that the problem has nothing to do with the globalpayments-api library that we use on the backend, as it works as expected, even in that library is configured in sandbox mode.

This is the data that we pass to the Realex library to initialize the HPP form. We want to store cards without charging them.

Could there be something wrong with this data?

[image: Screenshot 2024-01-15 at 11.47.18.png]

Thank you,

Darius

On Fri, 12 Jan 2024 at 18:33, h-batal @.***> wrote:

Have you managed to find a solution?

— Reply to this email directly, view it on GitHub https://github.com/globalpayments/rxp-js/issues/58#issuecomment-1889611759, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCYCNDNT3GQNRDR64PHMKMLYOFQVLAVCNFSM6AAAAAA62XFTJCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBZGYYTCNZVHE . You are receiving this because you authored the thread.Message ID: @.***>