Jump to content
  • 0

Gateway Response To Ipn Post


activa

Question

Hello

 

i want to return response data in json to the IPN notification send from the gateway . something like

        // Send a response to mark this transaction as notified
          $response = array("status" => "OK", "message" => "Status recorded");
          header("Content-type: application/json");
          echo json_encode($response);

is this not possible with the actual code ?  as i see the only return is the transaction data .

 

the probleme here, if i don't return a notice to the gateway , it will not stop from sending the IPN every X minute .

 

 

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Check your gateway documentation to see if it's accept you confirm by:

 

1/ display json data in an html page

OR

2/ you send a communication to gateway with json data?  and how GET, POST  with content in header or not....

 

 

the answer is clear , wthe notification ned to read from the callback url a output of json .

Link to comment
Share on other sites

  • 0

Hello

 

i want to return response data in json to the IPN notification send from the gateway . something like

        // Send a response to mark this transaction as notified
          $response = array("status" => "OK", "message" => "Status recorded");
          header("Content-type: application/json");
          echo json_encode($response);

is this not possible with the actual code ?  as i see the only return is the transaction data .

 

 

Doesn't just using echo like in your example code work?

It may not be good MVC design, but if that gets the job done...

Link to comment
Share on other sites

  • 0

but the page need to exist for being able to echo an answer?

 

We are talking about the callback URL that gets called on notifications...

The controller handling that will call validate() of your payment module. I do not think there is any technical reason preventing you from echo'ing inside that method, even though it may not be clean design.

Link to comment
Share on other sites

  • 0

We are talking about the callback URL that gets called on notifications...

The controller handling that will call validate() of your payment module. I do not think there is any technical reason preventing you from echo'ing inside that method, even though it may not be clean design.

 

@Max , normally the validate return data like this

        return array(
            'client_id' => current($client_id),
            'amount' =>  ($this->ifSet($response['amount']) / 100) ,
            'currency' => $this->ifSet($response['currency']),
            'invoices' => $this->deserializeInvoices($this->ifSet($response['ctrlCustomData'])),
            'reference_id' => $this->ifSet($response['orderID']),
            'status' => $this->ifSet($status),
            'transaction_id' => $this->ifSet($response['transactionID']),
            'parent_transaction_id' => null
        );   

is safe to merge between the echo and the return ?

 

like

        // Send a response to mark this transaction as notified
          $response = array("status" => "OK", "message" => "Status recorded");
          header("Content-type: application/json");
          echo json_encode($response);


        return array(
            'client_id' => current($client_id),
            'amount' =>  ($this->ifSet($response['amount']) / 100) ,
            'currency' => $this->ifSet($response['currency']),
            'invoices' => $this->deserializeInvoices($this->ifSet($response['ctrlCustomData'])),
            'reference_id' => $this->ifSet($response['orderID']),
            'status' => $this->ifSet($status),
            'transaction_id' => $this->ifSet($response['transactionID']),
            'parent_transaction_id' => null
        );  
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...