Jump to content

Payment Gateway Redirect Problem


Steven F

Recommended Posts

I'm working on the Stripe Checkout plugin. I've ironed out most of the kinks and it's basically ready to go. Stripe Checkout posts directly to a form of your choosing. Currently, it is sending the client to: callback/gw/1/stripe_checkout/?client_id=$id. This is all good (invoices are getting marked as paid, everything looks nice), except that there is no redirect to a success page or failure page. Is there any way for me to redirect them to some other page?

Link to comment
Share on other sites

There are two URLs a gateway typically needs to use. First, the payment callback should be sent to:

Configure::get("Blesta.gw_callback_url") . Configure::get("Blesta.company_id") . "/yourgateway/". $client_id

Second, the client should be redirected to:

domain.com/blesta/client/pay/received/yourgateway/client-id/

...which should be provided to the YourGateway::bulidProcess() method in $options['return_url']. If the gateway only supports one of these, use the callback URL.

Link to comment
Share on other sites

  • 4 months later...

There are two URLs a gateway typically needs to use. First, the payment callback should be sent to:

Configure::get("Blesta.gw_callback_url") . Configure::get("Blesta.company_id") . "/yourgateway/". $client_id

Second, the client should be redirected to:

domain.com/blesta/client/pay/received/yourgateway/client-id/

...which should be provided to the YourGateway::bulidProcess() method in $options['return_url']. If the gateway only supports one of these, use the callback URL.

 

Problem with using the callback URL for clients is that the Blesta code is then redirecting the client to /client/pay/received/yourgateway, and not preserving any added parameters (like /client_id in your example)

 

/blesta/app/controllers/callback.php

// Process the payment notification from the gateway
$this->GatewayPayments->processNotification($gateway_name, $this->get, $this->post);
 
// Redirect any client back to the payment received page
if ($this->Session->read("blesta_client_id") || $this->Session->read("payment"))
    $this->redirect($this->client_uri . "pay/received/" . $gateway_name);

Can workaround this by storing the added parameters in a session as well (which is what we did in our proof of concept Omnipay module), but would be nice if the Blesta core code was fixed to just append any additional parameters as well when redirecting.

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