Basit bir ekspres ödeme PayPal'ı ayarladım, her şey Dev Mode'da gayet iyi çalışıyor ancak üretim modunda bir hatam var.Symfony Paypal "RedirectResponse türü nesne olarak nesne kullanılamıyor"
tip Symfony \ Component nesne kullanılamaz \ HttpFoundation \ RedirectResponse dizi olarak
$responseArray = $this->requestPaypal('SetExpressCheckout', array(
'RETURNURL' => 'http://returnUrl.fr/member/payment/confirm/validate/membership/'.$ref,
'CANCELURL' => 'http://cancelUrl.fr/member/payment/cancel',
'PAYMENTREQUEST_0_AMT' => $info['price'], # amount of transaction \
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR', # currency of transaction \
'PAYMENTREQUEST_0_DESC0' => $info['description'],
'PAYMENTREQUEST_0_CUSTOM' => $info['time'],
));
$token = $responseArray['TOKEN']; // Error line
$payPalUrl = 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&useraction=commit&token='.$token.'';
return $this->redirect($payPalUrl);
YÖNTEM RequestPaypal:
public function requestPaypal($method, $params)
{
$params = array_merge($params, array(
'METHOD' => $method,
'VERSION' => $this->getParameter('version'),
'USER' => $this->getParameter('username'),
'SIGNATURE' => $this->getParameter('signature'),
'PWD' => $this->getParameter('password'),
));
$params = http_build_query($params);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $this->getParameter('endpoint'),
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => $params,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_VERBOSE => 1
));
$response = curl_exec($curl);
$responseArray = array();
parse_str($response, $responseArray);
if(curl_errno($curl))
{
$errors = curl_error($curl);
$this->addFlash('danger', $errors);
curl_close($curl);
return $this->redirectToRoute('payment');
}
if($responseArray['ACK'] == 'Success')
{
curl_close($curl);
}
return $responseArray;
}
ben kod eşya çalışmaz gelmez düşünüyorum Paypal/sandbox nedeniyle. Ben de görebileceğiniz gibi
Yardım Lütfen
Nic
ne düşünüyorum tetikleme hata içermediğini yayınlanmıştır kodu. Lütfen '$ this-> requestPaypal()' yöntemini ekleyin. Ayrıca $ this-> yönlendirme() 'de bir dolar işareti eksik. Lütfen çalıştırdığınız kodu yayınlayın, bazı düzenlenmiş şeyler değil ... – mblaettermann