Jump to content

How To Redirect To Success Page Or Failure Page After Validate Payment Response


Recommended Posts

Posted

Hi all,

 

Currently, I am develop a payment method (a non-merchant). Here is the scenario:

1. In the checkout step, I send the data to the payment gateway using "buildProcess()" function.

2. After the payment processed, it will redirect to URL as below to run the "validate()" function:
http://localhost/blesta/callback/gw/1/mygateway/?client_id=1&invoice=121=600.0000¤t_currency=USD&default_currency=AUD

 

3. The "validate()" function will validate the gateway response to see the transaction is successful or failed.

Now I want in the case of successful payment it will redirect to the success page, otherwise it will redirect to the error page.

I see in the "validate()" function, it will return an array to log the transaction in DB. So how can I handle the redirect here?

 

Thanks,

Phong

Posted

not sur , but in the end of the file add another condtions like this to use header or blesta function redirect()

        // Capture the IPN status, or reject it if invalid
        switch (strtolower($this->ifSet($response['status']))) {
            case "successful ":
                header('Location: http://www.example.com/');
                break;

            case "error":
                header('Location: http://www.example.com/');
                break;

        }
Posted

Blesta automatically performs redirects to the payment received page whether there is an error or not--you may just want to update the payment received page to display transaction information differently.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...