Monday, February 27, 2012

CakePHP Paypal returning link not working with SSL

Hello all,

I am having a problem with using Paypal API on my cakePHP site while
using an SSL. My site is entirely secured with an SSL. Everything
seems to work except for the returning link. Everything works when not
using SSL. I have both Paypal and IPN. The IPN notification works. But
when returning from Paypal, it directs to my login page instead of the
controller's returning function.

My app is accessed using https://mydomain.com

Here is some code:

From the config:


'App' => array(
'encoding' => 'UTF-8',
'baseUrl' => '',
'base' => '',
'dir' => 'app',
'webroot' => 'webroot',
'name' => 'mydomain.com',
'url' => 'https://mydomain.com',
'timezone' => 'America/New_York',
'language' => 'en',

From the controller:

if(!empty($this->data)) {
if($this->appConfigurations['gateway']) {
// Formating the data
$paypal['url'] = Configure::read('Paypal.url');
$paypal['business'] = Configure::read('Paypal.email');
$paypal['lc'] = Configure::read('Paypal.lc');
$paypal['currency_code'] = $this->appConfigurations['currency'];
if (!empty($auction['Charity']['name'])) {
$paypal['item_name'] = $auction['Auction']
['title'] . ' - Benefits: ' . $auction['Charity']['name'];
} else {
$paypal['item_name'] = $auction['Auction']
['title'];
}
$paypal['item_number'] = $auction['Auction']['id'];
$paypal['amount'] = number_format($total, 2);
$paypal['return'] = $this->appConfigurations['url'] . '/
auctions/returning';
$paypal['notify_url'] = $this-
>appConfigurations['url'] . '/auctions/ipn';
$paypal['custom'] = $user['User']['id'];
$paypal['first_name'] = $user['User']['first_name'];
$paypal['last_name'] = $user['User']['last_name'];
$paypal['email'] = $user['User']['email'];
$paypal['address1'] = $userAddress['Billing']['Address']
['address_1'];
$paypal['address2'] = $userAddress['Billing']['Address']
['address_2'];
$paypal['city'] = $userAddress['Billing']['Address']
['city'];
$paypal['zip'] = $userAddress['Billing']['Address']
['postcode'];

$this->Paypal->configure($paypal);
$paypalData = $this->Paypal->getFormData();
$this->set('paypalData', $paypalData);

As an alternative, I could set the app up to only use SSL for login
and registration. The problem I'm running into there is that the app
stays in HTTPS after the login, so then I run into the same problem.

Any assistance would be appreciated.

Thanks,
Sean

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: