Sohel Ahmed Mesaniya
Sohel Ahmed Mesaniya

Reputation: 3450

How to get Payeezy API response from Javascript to PHP file?

Payeezy powered by First Data is payment gateway like PayPal. And now I want to integrate in my website.

And I have thoroughly gone through

https://developer.payeezy.com/integration and

https://developer.payeezy.com/payeezy-api-reference/apis.

And thus I decided to go with payeezy.js rather than PHP API (I am a PHP guy) and started reading docs on here and here

For eg Consider a scenario (having installed Xampp in Windows)

I have stored files as sample.html C:\Xampp\htdocs\sample.html and action.php C:\Xampp\htdocs\action.php

In sample.html I put (another important file payeezy.js)

<html>
    ...
      <!--<form action="{call to merchant server}" method="post" id="payment-info-form" >-->
            <form action="action.php" method="post" id="payment-info-form" onsubmit="return validateFormOnSubmit(this);" >
    ...
            </form>
    ...
    <html>

Now up in the same file there is anonymous function in Javascript

...
    var responseHandler = function(status, response)
                {
...

I am getting status and response from API.

It says part of data goes to file on merchant server ie action.php and some not because they does not have 'name' attribute in their <input> tags (see sample.html file)

So when I click submit button I am redirected to action.php which is located at my (merchant) server, so the question is how can I get or print or process API response in action.php generated through sample.html

Upvotes: 3

Views: 1508

Answers (1)

Richard Ardila
Richard Ardila

Reputation: 9

Thank you for using our solution and thank you for your question and interest in our services.

If I understand correctly your page is receiving the response just fine from the API call and you want to send that response to the PHP page on the third party server(your merchant).

If the above statement is correct, then you will need to write some JavaScript code in order to get the values that the response is giving you and send them over to the PHP page on the other server. Alternatively, you can write PHP on your local script to do exactly the same, but as long as you are getting a response, which you indicate you do, you will need to write your logic to send that response to the external server script.

Upvotes: 0

Related Questions