No data or email if Form URLs | Submit URL used

cms_sea 02 Jun, 2008
This is strange. I have several forms working now. The form in question is a paypal form. The submit URL works great and passes the necessary variables OR the form will generate email and write data if the submit URL is not used--I just can't get them to work together.

Isn't the sequence send email, write data then submit data to URL? Is there a way I can make work in this sequence?

What am I missing?

THANKS FOR YOUR HELP!
GreyHead 02 Jun, 2008
Hi cms_sea,

If you use a submit URL then ChronoForms never sees the form results - it's all passed to the submit URL for handling.

You need to process the form first then pass the results to PayPal using a custom built URL - you can use the Redirect URL field to do this.

Bob
cms_sea 02 Jun, 2008
What should that code look like?

In the Submit URL field I had:
https://www.paypal.com/cgi-bin/webscr

But if I put it in the Redirect URL field it does not do a submit.


It would be a huge help if the more info tips we expanded to include more information about sequence and rule. There may be too many possible uses to add in examples, but more save some of us many hours.

Thank you again!
cms_sea 02 Jun, 2008
My real problem here is that I want to capture the info before it gets submitted to paypal, in case the transaction is not completed in paypal. However, it would be ideal to also capture the confirmation once the transaction is completed by paypal.

The submit works... it will populate the paypal fields (with the exception of the email and phone number. This is apparently known bugs on the paypal side) BUT it does not complete the entry in to the table or then sending of the email once the paypal transaction has been completed.

-- Should the form complete the local entry and the sending of the email after the process at paypal has been completed? If so how do I get this working?

-- I'm hoping of an answer to my question in my prior post, regarding how to do a Submit in the referral URL field

-- The next question will then be how do I create a form to receive the confirmation data back from paypal?
GreyHead 02 Jun, 2008
Hi cms_sea,

You can submit to PayPal using either $_POST (directly from a form) or $_GET (using a url) both work fine, $_POST is possibly a little more secure. For the moment here's a code snippet that I used to send by url:
<?php
/**
 * Build PayPal URL & redirect
 */

// Variables are set in the $form_config array
$url  = $form_config['paypal_url'];
$url .= "&business=".$form_config['paypal_business'];
$url .= "&item_name=Site_Subscription";
$url .= "&item_number=1001";
$url .= "¤cy_code=USD";
$url .= "&amount=$fee";
$url .= "&custom=$userid";
$url .= "&return=".$form_config['paypal_return'];
//$url .= "&return=".urlencode($form_config['paypal_return']);
// $url .= "&cancel_return=".$form_config['paypal_cancel_return'];
$url .= "&no_note=1";
$url .= "&no_shipping=1";
}
if ( $debug ) {
    echo "url: ";print_r($url);echo "<br />";
    echo "<br /><a href='$url'>Click to continue</a><br />";
} else {
    $rows[0]->redirecturl = $url;
}
?>
Note that there are a bunch of variables that are picked up from other sources like $fee & $userid, and another group of configuration variables that are in the $form_config array. (In this case we were using the PayPal SandBox to test and this allows us to switch over by changing one line of code at the beginning of the form box.

This code was placed at the end of the AutoGenerated code box but the OnSubmit after would work just as well.

Bob
yotta 13 Jun, 2008
Hi! Thanks for all the help - but I am having some difficulty. I can get the form to write to the table, and I can get the variables to Paypal, but either one works or the other, not both at the same time. I have tried putting the code you posted at the end of the AutoGenerated block, in the block, in the onSubmit After, and varying combinations of other settings.

Could you elaborate a bit more on what else you did to get this to save to the table AND send the variables in the url?
I am plain out of ideas.

thx
GreyHead 14 Jun, 2008
Hi yotta,

As far as I remember it was the end of the AutoGenerated Box.

Please take a Form Backup of your form from the Form Manager and post it here so I can take a look.

Bob
cms_sea 14 Jun, 2008
Is there a way to take a 2 form approach here? One form to store the data and a second to confirm the data with the user and then submit it to PP?

I've tried to do this but am not clear on how to pass the data to the second form or read it back into the second form from the table.

I'm in a bit over my head here. Examples would be very helpful.

Did I read elsewhere that you were working on a plug-in for paypal?

Paypal has a bug that they do not seem to be working on... Merchant account holders do not receive billing address information for transactions that are completed using a paypal account. This is a huge problem if your organization is required to report donor information. We had hoped to use chronoforms to capture the information and pass it to paypal, but is proving to be very difficult as well.
GreyHead 14 Jun, 2008
Hi cms_sea,

This is easier to do than to describe. Please email me your Form Backup, and some notes on what you want to achieve, to the email address in my sig and I'll try and help a bit more.

Bob

PS I'm going to be out most of the weekend so it won't be a quick answer I'm afraid.
cms_sea 17 Jun, 2008
Hi Bob,
I am hoping that you received my emails regarding this. I'm posting this here as I don't know if you received them.

Because PayPal does not provide addresses for donors, we must capture them before they go to PayPal... our form does that but as you said will not do both store and submit. 1 form with custom code in the autogenereated field would be great, 2 forms one which writes and one which has user confirm and submits would be fine too.

Or if you have another suggestion. We are stuck in a corner and hope you can help.

THANK YOU!!
GreyHead 17 Jun, 2008
Hi Eric,

I replied by email last night and again a few minutes ago. Please check your spam folder??

If you can email me an admin login (and FTP if possible) I'll go take a look later this evening (6.20pm here now and I'm about to go out for an hour or so).

Bob
Dee 21 Jul, 2008
This is exactly what our problem is too!! I'm so glad to find this post and see that there's another person with this issue... but yet sad because I don't see a solution here.

I hope this means that there is hope that this works? Emails and submit url features both work together??
GreyHead 21 Jul, 2008
Hi Dee,

I'm not sure which messge you are replying to.

If you use a Submit URL then the form results are sent to that url and ChronoForms will never see them. So no email is sent, that's exactly how it is supposed to work.

On the other hand if you set a ReDirect URL then ChronoForms will process the results and then redirect to the URL you set. This is the way to do your calculation before redirecting to PayPal.

Bob
chakatz 27 Aug, 2008
This topic helped me a lot! Thanks!

I found that by using the code below in the "On Submit code" area that there is no need to reenter all the parameters from the form and I save myself a lot of work:


<?php
   $url = 'http://The_URL_of_my_Payment_Gateway';
   $params = array();
   foreach($_POST as $postkey=>$postval) {
       $params[$postkey] = $postval;
   }

   $ch = curl_init();
   curl_setopt($ch, CURLOPT_POST,1);
   curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
   curl_setopt($ch, CURLOPT_URL,$url);
   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  2);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
   $result=curl_exec ($ch);
   curl_close ($ch);
   if ($result == "") {
      echo("No Response\n");
      exit;
   }
?>
This topic is locked and no more replies can be posted.