2

CodeIgniterで小さなショッピングカートを作ろうとしていますが、CI-Merchantがこのガイドhttp://ci-merchant.org/で支払いゲートウェイと連携していることがわかりましたが、Paypalで動作させる方法がよくわかりません。サンドボックス。

$this->load->library('merchant');
$this->merchant->load('paypal_express');
$settings = array(
    'username' => 'test@test.com',
    'password' => '********',
    'signature' => 'Test Store',
    'test_mode' => true);

$this->merchant->initialize($settings);
$params = array(
    'amount' => 12.00,
    'currency' => 'CAD',
    'return_url' => 'http://payment.test.com',
    'cancel_url' => 'http://payment.test.com/cancel');

$response = $this->merchant->purchase($params);
$this->load->view('welcome_message');

このコードは多くのことを実行できないことは知っていますが、まったく何も実行しません。ビューをロードするだけで何も起こりません。わかりません。だから、私の質問は、チュートリアルや、CIマーチャントをPaypalサンドボックスで動作させる方法を知っていますか?助けてくれてありがとう。

4

1 に答える 1

2

エースのコメントは的確です。コードに問題はありませんが、$responseオブジェクトを調べて、結果(またはエラーメッセージ)が何であるかを確認する必要があります。

$response = $this->merchant->purchase($params);
if ($response->success())
{
    // mark order as complete
    $gateway_reference = $response->reference();
}
else
{
    $message = $response->message();
    echo('Error processing payment: ' . $message);
    exit;
}

これを試して、オブジェクトを検査することもできます。

$response = $this->merchant->purchase($params);
echo '<pre>';
print_r($response);
exit;
于 2012-11-05T21:53:22.563 に答える