0

我正在使用CodeIgniter Payments与 Paypal API 集成。我相信我调用了正确的方法,因为我得到了“成功”的响应,但我没有在沙盒中看到交易。当我使用来自 Paypal 的示例 DoDirectPayment 文件时,我完成了交易,我可以在沙箱中看到它。

这是我使用 CodeIgniter Payments 的代码:

//load the payment library
$this->load->spark('codeigniter-payments/0.1.4/');

//configure the parameters for the payment request
$paymentParameters = array(
    'cc_type'       => 'foo',
    'cc_number'     => 'foo',
    'cc_exp'        => 'foo',
    'first_name'    => 'foo',
    'last_name'     => 'foo',
    'street'        => 'foo',
    'street2'       => 'foo',
    'city'          => 'foo',
    'state'         => 'foo',
    'country'       => 'foo',
    'postal_code'   => 'foo',
    'amt'           => 'foo',
    'currency_code' => 'USD'
);

//make the call
$paymentResponse = $this->payments->oneoff_payment('paypal_paymentspro', $paymentParameters);

//print the response
print_r($paymentResponse);

这是回应:

stdClass Object
(
    [type] => gateway_response
    [status] => Success
    [response_code] => 100
    [response_message] => The authorization was successful.
    [details] => stdClass Object
    (
        [gateway_response] => stdClass Object
            (
                [TIMESTAMP] => 2012-05-22T19:18:17Z
                [CORRELATIONID] => 7939eeaa6c0c0
                [ACK] => Success
                [VERSION] => 66.0
                [BUILD] => 2929894
                [AMT] => 20.89
                [CURRENCYCODE] => USD
                [AVSCODE] => X
                [CVV2MATCH] => M
                [TRANSACTIONID] => 4RS01101TL8204042
            )

        [timestamp] => 2012-05-22T19:18:17Z
        [identifier] => 4RS01101TL8204042
    )
)
4

2 回答 2

0

我也有这个问题。

就我而言,我没有正确设置我的配置驱动程序,它最终将我的所有交易发送到 Calvin(作者)的默认贝宝沙盒帐户。

仔细检查以确保您的 API 令牌设置正确:

$gateway_name = 'paypal_paymentspro';
$params = array(
    'identifier'    => *Your transaction ID from above* 
);
$response = $this->payments->get_transaction_details($gateway_name, $params);
print_r($results);

此外,如果您不想设置驱动程序并想从您的 PHP 文件中执行所有操作,您可以随时传递您的 API 令牌,如下所示:

$gateway_name = 'paypal_paymentspro';
$params = array(
    'identifier'    => *Your transaction ID from above* 
);
$config['api_username'] = *Your api username*;
$config['api_password'] = *Your api password*;
$config['api_signature'] = *Your sig*;
$response = $this->payments->get_transaction_details($gateway_name, $params);
print_r($results);
于 2012-06-07T20:22:56.507 回答
0

您可以切换到使用其他 Paypal 库。与解决这个问题相比,它可能会节省您的时间。http://codeigniter.com/wiki/PayPal_Lib

于 2012-05-24T03:53:59.827 回答