私は簡単なエクスプレスチェックアウトPaypalを設定しましたが、Devモードではうまく動作しますが、運用モードでエラーがあります。Symfony Paypal「タイプとしてRedirectResponseのオブジェクトを配列として使用できません」
タイプのSymfony \コンポーネントのオブジェクトを使用することはできません\ HttpFoundation \ RedirectResponse配列として
$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);
メソッド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;
}
私はコードがPRODでは動作しませていないと思いますpaypal/sandboxのために。私が見ることができるように
ヘルプしてください
ニック
あなたは私が思うトリガエラーが含まれていません掲示コード。 '$ this-> requestPaypal()'メソッドを追加してください。 '$ this-> redirect()'にもドル記号がありません。 ... – mblaettermann