CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • CC event payment with Paypal standard doesn't redirect to thank you page
Pages: [1]

Author Topic: CC event payment with Paypal standard doesn't redirect to thank you page  (Read 6169 times)

Andy Laken

  • I’m new here
  • *
  • Posts: 27
  • Karma: 3
CC event payment with Paypal standard doesn't redirect to thank you page
June 26, 2007, 02:20:12 pm
This is driving me crazy!

I have PayPal Website Payments standard configured with CiviEvent. PayPal standard give the option to pay with a PayPal account, or just with a credit card if you don't have a PayPal account. The problem I'm seeing is when you pay with a credit card (i.e. you don't log into a paypal account for payment,) after PayPal has processed the card, it displays a "done" screen with heading "Andrew, you've successfully completed your payment." with a big orange button "Return to {merchant name}". When you click to return, you do not get to the event's thank you page, rather you go back to the initial registration page which still has your values filled in.

I reproduced this on the demo.civicrm.org sandbox, temporarily setting processor to Paypal website payments standard and using my PP sandbox merchant account.

Inspecting the HTML for this final PayPal screen gives a clue to why it doesn't take you to the Thank You page. The orange "return to merchant" button is a form submit, and the form action is the passed-in return URL. But there are tons of hidden fields in the form as well - transaction info which PayPal is passing back. the "action" URL already has a parameter in it: "?_qf_ThankYou_display=1"
-- but when the browser prepares the form with all the GET variables it's probably chopping off that parameter and replacing it with all the name-value pairs from the form fields.

URL that the browser is actually handed is this:

Code: [Select]
https://demo.civicrm.org/drupal/civicrm/event/register?mc_gross=101.00&invoice=9b02c8ead60025aa0e83514d26a33282&address_status=confirmed&payer_id=8JUN5DJBW6WXS&tax=0.00&address_street=1010+S+St+NE&payment_date=13%3A59%3A15+Jun+26%2C+2007+PDT&payment_status=Completed&charset=windows-1252&address_zip=20009&first_name=Andrew&mc_fee=3.23&address_country_code=US&address_name=Andrew+Drabinski&notify_version=2.1&custom=&payer_status=unverified&business=ckppsandbox%40laken.com&address_country=United+States&address_city=Washington&quantity=1&payer_email=11cktest%40laken.com&verify_sign=AsWPkfHEyRz6XqoaXPQehiEQS6VqAW2EX1oyoKTbsKHplc7Yv2zRSXxE&txn_id=5XX555721N792803S&payment_type=instant&last_name=Drabinski&address_state=DC&receiver_email=ckppsandbox%40laken.com&payment_fee=3.23&receiver_id=MB6P2AJ4VUR46&txn_type=web_accept&item_name=Online+Event+Registration%3A+Paypal+Standard+Online+Registration&mc_currency=USD&item_number=&residence_country=US&receipt_id=0773-6918-6485-6019&test_ipn=1&payment_gross=101.00&shipping=0.00&merchant_return_link=Return+to+Capital+Kehillah+Testing&form_charset=UTF-8
and here is the code from the form on the final PayPal page:

Code: [Select]
<form method="get" id="merchantReturn" name="merchant_return"
         action="https://demo.civicrm.org/drupal/civicrm/event/register?_qf_ThankYou_display=1">

<input type="hidden" id="" name="mc_gross" value="101.00"><input type="hidden" id="" name="invoice" value="9b02c8ead60025aa0e83514d26a33282"><input type="hidden" id="" name="address_status" value="confirmed"><input type="hidden" id="" name="payer_id" value="8JUN5DJBW6WXS"><input type="hidden" id="" name="tax" value="0.00"><input type="hidden" id="" name="address_street" value="1010 S St NE"><input type="hidden" id="" name="payment_date" value="13:59:15 Jun 26, 2007 PDT"><input type="hidden" id="" name="payment_status" value="Completed"><input type="hidden" id="" name="charset" value="windows-1252"><input type="hidden" id="" name="address_zip" value="20009"><input type="hidden" id="" name="first_name" value="Andrew"><input type="hidden" id="" name="mc_fee" value="3.23"><input type="hidden" id="" name="address_country_code" value="US"><input type="hidden" id="" name="address_name" value="Andrew Drabinski"><input type="hidden" id="" name="notify_version" value="2.1"><input type="hidden" id="" name="custom" value=""><input type="hidden" id="" name="payer_status" value="unverified"><input type="hidden" id="" name="business" value="ckppsandbox@laken.com"><input type="hidden" id="" name="address_country" value="United States"><input type="hidden" id="" name="address_city" value="Washington"><input type="hidden" id="" name="quantity" value="1"><input type="hidden" id="" name="payer_email" value="11cktest@laken.com"><input type="hidden" id="" name="verify_sign" value="AsWPkfHEyRz6XqoaXPQehiEQS6VqAW2EX1oyoKTbsKHplc7Yv2zRSXxE"><input type="hidden" id="" name="txn_id" value="5XX555721N792803S"><input type="hidden" id="" name="payment_type" value="instant"><input type="hidden" id="" name="last_name" value="Drabinski"><input type="hidden" id="" name="address_state" value="DC"><input type="hidden" id="" name="receiver_email" value="ckppsandbox@laken.com"><input type="hidden" id="" name="payment_fee" value="3.23"><input type="hidden" id="" name="receiver_id" value="MB6P2AJ4VUR46"><input type="hidden" id="" name="txn_type" value="web_accept"><input type="hidden" id="" name="item_name" value="Online Event Registration: Paypal Standard Online Registration"><input type="hidden" id="" name="mc_currency" value="USD"><input type="hidden" id="" name="item_number" value=""><input type="hidden" id="" name="residence_country" value="US"><input type="hidden" id="" name="receipt_id" value="0773-6918-6485-6019"><input type="hidden" id="" name="test_ipn" value="1"><input type="hidden" id="" name="payment_gross" value="101.00"><input type="hidden" id="" name="shipping" value="0.00">

<input type="submit" id="merchantReturn" name="merchant_return_link" value="Return to Capital Kehillah Testing">
<input name="form_charset" type="hidden" value="UTF-8">
</form>

I suspect this problem comes from the different "return to merchant" strategy used by PaPal when you pay with a simple credit card vs. logging in and paying with your paypal account. When you do that, after your payment is complete, you get a screen saying "redirecting back to {merchat} - click here if you aren't redirected within 10 seconds" -- and the redirect correctly takes you to the thank you page. But I haven't inspected the HTML for that scenario.

I'm trying to get a client site launched within 24 hours, so any help on this is GREATLY appreciated!


Andy Laken
Engineer | CivicActions, LLC
e: andy.laken@civicactions.com | skype: mcantsin | http://twitter.com/alaken

Andy Laken

  • I’m new here
  • *
  • Posts: 27
  • Karma: 3
Re: CC event payment with Paypal standard doesn't redirect to thank you page
June 26, 2007, 03:24:48 pm
Interestingly, paying from a CiviContribute donation page works correctly under the same scenario. The return URL that CiviContribute uses is a bit different:

Code: [Select]
<form method="get" id="merchantReturn" name="merchant_return" action="https://demo.civicrm.org/drupal/civicrm/contribute/transact?_qf_ThankYou_display=1&amp;qfKey=a6308c2cdf90e08384f1e64a8a5cb12f">

Oddly, in this case, even though the form has all the same hidden fields as the one for the event payment, the browser is redirected to the correct return URL without all the other variables in the query string:

Code: [Select]
https://demo.civicrm.org/drupal/civicrm/contribute/transact?_qf_ThankYou_display=1&qfKey=a6308c2cdf90e08384f1e64a8a5cb12f

so the thank you page displays correctly.

I note that, unlike the return URL the event page uses, in this one there is a second parameter in this URL: &qfKey=a6308c2cdf90e08384f1e64a8a5cb12f - could this somehow be making the difference?
Andy Laken
Engineer | CivicActions, LLC
e: andy.laken@civicactions.com | skype: mcantsin | http://twitter.com/alaken

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: CC event payment with Paypal standard doesn't redirect to thank you page
June 26, 2007, 05:02:57 pm

Andy:

This is a paypal issues :( We worked around it and fixed it for contribution pages in v1.7 but forgot about event pages :(

This is now fixed in v1.8. You can backport the changes if needed, the relevant issue is here:

http://issues.civicrm.org/jira/browse/CRM-2048?page=com.cenqua.fisheye.jira:fisheye-tabpanel

The backport can be much simpler than the patch above. I just reorganized the code while i was at it.
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Andy Laken

  • I’m new here
  • *
  • Posts: 27
  • Karma: 3
Re: CC event payment with Paypal standard doesn't redirect to thank you page
June 26, 2007, 05:10:35 pm
Thanks, Lobo - you guys are so on top of things, gives me a lot more peace of mind using the software!

I've never done a backport but I'm game to take a shot at it. What, at a minimum, need to be changed in 1.7 to make this work?
Andy Laken
Engineer | CivicActions, LLC
e: andy.laken@civicactions.com | skype: mcantsin | http://twitter.com/alaken

Andy Laken

  • I’m new here
  • *
  • Posts: 27
  • Karma: 3
Re: CC event payment with Paypal standard doesn't redirect to thank you page
June 26, 2007, 06:21:00 pm
Spent a while looking through the code - added the function to Core/Payment.php and started to edit Event/Form/Registration.php - but got confused whether all the new payment processor code in 1.8 needed to be backported or not (around lines 186-202 of http://fisheye.civicrm.org/browse/CiviCRM/branches/v1.8/CRM/Event/Form/Registration.php?r=10153)

N.B. I am also using a backported version of the Price Sets feature which Marshal kindly provided me as a patch against 1.7 - so far it seems to be working fine.

If you could spare 5 min to outline for me how to backport this redirect fix I would be very grateful!
   
Andy Laken
Engineer | CivicActions, LLC
e: andy.laken@civicactions.com | skype: mcantsin | http://twitter.com/alaken

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: CC event payment with Paypal standard doesn't redirect to thank you page
June 26, 2007, 07:44:55 pm

The easiest fix is to add the foll lines of code in Registration.php (line 110 or so) after ($this->_action = CRM_....)

Code: [Select]
        // check if this is a paypal auto return and redirect accordingly
        if ( $config->paymentProcessor == "PayPal_Standard" &&
             isset( $_GET['payment_date'] )                 &&
             isset( $_GET['merchant_return_link'] )         &&
             CRM_Utils_Array::value( 'payment_status', $_GET ) == 'Completed' ) {
            $url = CRM_Utils_System::url( 'civicrm/event/register',
                                          "_qf_ThankYou_display=1&qfKey={$this->controller->_key}" );
            CRM_Utils_System::redirect( $url );
        }

If u need more specific details might be easier on IRC and/or IM

lobo

A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Andy Laken

  • I’m new here
  • *
  • Posts: 27
  • Karma: 3
Re: CC event payment with Paypal standard doesn't redirect to thank you page
June 26, 2007, 09:45:34 pm
Lobo you rule! Thanks for the tip, a quick test and it appears to be working. Will test more tomorrow.

I did need to also add this line:

Code: [Select]
        $config  =& CRM_Core_Config::singleton( );
which doesn't seem to appear in 1.7. I'll hit you in IRC if I need more help.
Andy Laken
Engineer | CivicActions, LLC
e: andy.laken@civicactions.com | skype: mcantsin | http://twitter.com/alaken

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • CC event payment with Paypal standard doesn't redirect to thank you page

This forum was archived on 2017-11-26.