Where to go to after 'check_payment.php'


freeSbee

Hi svsanchez

Quote from: svsanchez on March 18, 2015, 08:22:10 PM
HOWEVER, when the transaction fails, I can't go "back" to try again with another credit card or re-enter the credit card information in case I made a mistake, I have to start all over again (put the products again in the cart, fill the contact information again, etc).

I tried what you suggested to Scheltel adding ?pm=your_payment_method&status=canceled to the end of a page, but unfortunately this also removes the products from the cart.

Is there another word I can use instead of "canceled" so that I can retry to make the purchase? Something like:

&status=retry

Define the value of the var $payment_status in the file check_payment.php of your payment method dependig on the data returned by your payment gateway api: If the value is error or canceled Bakery keeps the $_SESSION['bakery'] var and offers a button "Continue shopping".

In case the payment process has been canceled by the user you can add the parameter &status=canceled to the return URL.

Bakery does only delete the $_SESSION['bakery'] var if $payment_status == "success" or $payment_status == "pending". (See view_confirmation.php line 244: unset($_SESSION['bakery']);).

Regards Chrisopth

svsanchez


svsanchez

Hello freeSbee, this is a great post. I am also working on another payment gateway and was able to get it to work.

HOWEVER, when the transaction fails, I can't go "back" to try again with another credit card or re-enter the credit card information in case I made a mistake, I have to start all over again (put the products again in the cart, fill the contact information again, etc).

I tried what you suggested to Scheltel adding ?pm=your_payment_method&status=canceled to the end of a page, but unfortunately this also removes the products from the cart.

Is there another word I can use instead of "canceled" so that I can retry to make the purchase? Something like:

&status=retry

Thanks a lot!

scheltel

Hi Christoph,

Yes, that worked out. Thank you.

Regards,

Albert Jan

freeSbee

Hi Albert Jan

I clarified the answer in my last post. Hope it will work out!

Regards Christoph

scheltel

Hi Christoph,

With http://www.example.com?pm=payment_method only the home page of the site is shown. What I would expect is that the results of http://example.com/modules/bakery/view.php would be shown....

Regards,

Albert Jan

freeSbee

#4
Hi Albert Jan

Customers have to be directed back from the payment gateway to any module Bakery shop page. Only then the file view.php is invoked automatically. Params can also be posted back using HTTP POST instead of GET method.

If the Homepage is a module Bakery page you can use ...
On success:
http://www.example.com?pm=your_payment_method
On error:
http://www.example.com?pm=your_payment_method&status=canceled


else use the URL to a module Bakery page ...
On success:
http://www.example.com/pages/any_bakery_page.php?pm=your_payment_method
On error:
http://www.example.com/pages/any_bakery_page.php?pm=your_payment_method&status=canceled


I recommend to use the var $setting_continue_url. Please see the condensed example below:

$post_data = array(
'return'        => $setting_continue_url.'?pm='.$payment_method,
'cancel_return' => $setting_continue_url.'?pm='.$payment_method.'&status=canceled',
);


Regards Christoph

scheltel

Hi freeSbee,

To which Bakery page should the payment provider post its status information? This information is not available in the document add_payment_gateway.pdf.

Regards,

Albert Jan


freeSbee

Hi Scheitel

First please download this brief step-by-step tutorial "Add a new payment methode plugin to Bakery":
http://www.bakery-shop.ch/downloads/add_payment_gateway.pdf

The file check_payment.php is included into the file view.php at about line 518.

The file view_confirmation.php is included into the file view.php at about line 549. This only happens, if Bakery gets a post or a get var named pm or payment_method from the payment gateway ($_REQUEST['pm'] or $_REQUEST['payment_method']). The value must be the name of the payment gateway that is defined in the var $payment_method_name in the info.php file.

Hope this helps!

Regards Christoph

scheltel

Hi,

I'm trying to create a payment method for bakery 1.7.1. The communication with the bank works fine. And after checking the status information in check_payment.php the user should be redirected to the website. This does not happen...

In the check_payment.php file of PayPal is a part of the bakery 1.7.1 package I don't see any form of redirection to a page in the website. I think Bakery does some magic here.

Wo can tell me how get back to the website and present the payment status to the customer?