Forums

Add cf_uid to Paypal redirect

williatf 11 Aug, 2011
I haven't been able to find a solution on how to easily add the unique cf_uid tag to the Paypal redirect url. My form adds a record to the db, and then redirects to Paypal for payment. I'd like to use Paypal IPN to change the status from "submitted" to "paid" but need to know have a key to find the right record to update.

What is the best practice?

Thanks in advance,
Todd
stevetbeck 11 Aug, 2011
I just spent the last 1.5 days getting this exact same thing to work. The best instructions I found were in this post: http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=2&t=22619&start=0.

You need to add a little custom code (see the post) to set the 'custom' parameter before redirecting to PayPay. The step I was missing that took me so long was that I needed to add custom=custom in the PayPal Redirect Extra Fields.

The rest you should be able to figure out from the post on the PayPal Listener.
williatf 12 Aug, 2011
stevetbeck,

Thanks for the response and the link.

Unfortunately, the fix referenced in the link you provided doesn't work for the paypal_redirect function.

The reason is that the function assigns specific form->data to a new array, $checkout_values.

Since all of the form->data elements aren't mapped to paypal variables in this new array, adding a new form->data['invoice'] element doesn't have the desired effect.

What I ended up doing was editing paypal_redirect.php to include a new "invoice" element, which I assign the cf_id.


		$checkout_values = array(
			//constants
			'cmd' => trim($params->get('cmd')),
			'business' => trim($params->get('business')),
			'no_shipping' => trim($params->get('no_shipping')),
			'no_note' => trim($params->get('no_note')),
			'return' => trim($params->get('return')),
			'currency_code' => trim($params->get('currency_code')),
			//variables
			'item_name' => $form->data[$params->get('item_name')],
			'amount' => $form->data[$params->get('amount')],
			'first_name' => $form->data[$params->get('first_name')],
			'last_name' => $form->data[$params->get('last_name')],
			'address1' => $form->data[$params->get('address1')],
			'address2' => $form->data[$params->get('address2')],
			'city' => $form->data[$params->get('city')],
			'state' => $form->data[$params->get('state')],
			'zip' => $form->data[$params->get('zip')],
			'country' => $form->data[$params->get('country')],
			'night_phone_a' => $form->data[$params->get('night_phone_a')],
			//add invoice field to the post - hack by TFW
			'invoice' => $form->data['chronoform_data_cf_id']
		);


My hack is the last element. Now it works like a charm.

Regards,
Todd
This topic is locked and no more replies can be posted.