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.

Join the conversation

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

Guest
Reply to this topic...

×   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...