Forums / Developer / how to confirm payment with paypal?[solved]

how to confirm payment with paypal?[solved]

Author Message

ludo thomas

Thursday 01 September 2005 1:14:43 am

after a payment, user is redirected to shop/checkout.
all is working fine.
I use Paypal sandbox for the moment.

Perhaps I should be redirected to orderview?
but I stay on a blank page.
perhaps it's because of a not real payment gateway?

but I would like to display a message that says "thanxs for your payment"...(in a custom template)

I dont know how to redirect from this page.

I try to modify shop/checkout.php but nothing works fine.

Please help..

Kristof Coomans

Thursday 01 September 2005 2:07:42 am

You can make a workflow event type which fetches the template, and let shop/checkout/after trigger a workflow with this event.

Or you can modify shop/checkout.php.

Line 170:

$module->redirectTo( '/shop/orderview/' . $orderID );

You can change it so it redirects to a custom module view:

$module->redirectTo( '/shop/thanks/' . $orderID );

Or you can fetch the template:

include_once( 'kernel/common/template.php' );

$tpl =& templateInit();
$tpl->setVariable( 'order_id', $orderID );

$Result['content'] =& $tpl->fetch( 'design:shop/thanks.tpl' );
$Result['path'] = array( array( 'url' => false, 'text' => ezi18n( 'kernel/shop', 'Checkout' ) ) );

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

ludo thomas

Thursday 01 September 2005 2:30:49 am

thx kristof,
I've found where is the problem:

no problem for template redirection.

but checkout.php just make loop at sleep function here:

 if ( $paymentObj != null )
        {
		echo"paymentobject!=null<br>";
            $startTime = time();
            while( ( time() - $startTime ) < 29 )
            {
                eZDebug::writeDebug( "next iteration", "checkout" );
                $order =& eZOrder::fetch( $orderID );
                if ( $order->attribute( 'is_temporary' ) == 0 )
                {
				echo"order temporary=0 ok<br>";	
                    break;
                }
                else
                {
				echo"sleep<br>";
                    sleep ( 2 );
                }

so , I don't understand what it means exactly

Kristof Coomans

Thursday 01 September 2005 6:22:33 am

I have no experience with the eZ shop functionality, but it seems to wait some seconds until the value is_temporary is 0.

As far as I've studied the code, I think it's waiting for the shop/checkout operation to finish. eZShopOperationCollection::activateOrder uses $someEZOrder->activate( ), which sets is_temporary to 0. The pre-checkout workflow however doesn't finish.

Can you do some virtual payings with the Paypal sandbox? If an order get's payed, it should do a callback to your site and the workflow will finish (and with it the checkout operation).

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Kristof Coomans

Thursday 01 September 2005 6:32:33 am

Can you access the module view paypal/notify_url at your site?

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

ludo thomas

Thursday 01 September 2005 6:55:01 am

yes I can access this module
(no kernel error but nothing displayed)

look at this:
http://ez.no/community/forum/setup_design/ezpaypal_extension_order_paid_but_not_validated_on_ez#msg82372

Kristof Coomans

Thursday 01 September 2005 7:07:20 am

In the other thread you write:

<i>in my case server is no visible from the internet so ...no solution for testing it.. :(</i>

If your server isn't accesible from outside, Paypal won't be able to do the callback to the paypal module, and the workflow won't end.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

ludo thomas

Thursday 01 September 2005 7:29:05 am

yes, i do the necessery for it and try to test after.
thx for your attention

Xavier Dutoit

Thursday 01 September 2005 7:53:47 am

Kristof is right, your server has to be accessible from the internet.

FYI, you have several logs on your var/log directory about the payments :
eZPaypal_notify_url.log is going to be created and full of information.

BTW, the new interface at paypal seems to have a positive impact on the bottom line (easier to order if you don't have a paypal account).

http://www.sydesy.com

ludo thomas

Monday 05 September 2005 5:45:03 am

nothig more after that myserver is accessible from internet.

All is working fine but not the last notification that allows payment to be ok.

do I need a special paypal administration configuration?
do i need to modify the ezpaypalchecker.php
do I need to modify the ezpaymentcallbackchecker.php(I have modify ezpaymentgatewey for sending multiref basket)
what can I do with the "token"?

If someone can make it work thanx in advance.

ludo thomas

Friday 09 September 2005 6:57:17 am

It was just because of the paypal.ini.

you have to modify:
# field: "business"
# e-mail of receiver
Business=ludovic@lestudiot.com

(with:business=email adress of the business compte you have created.)

for having adress of your buyer:
change in ezpaypalgateway.php

$noShipping = '';