我使用CodeIgniter Payments与Paypal API集成。我相信我正在使用正确的方法,因为我得到的回应是"成功"但是我在Sandbox中看不到这笔交易。当我使用Paypal中的示例DoDirectPayment文件时,我完成了交易,我可以在沙盒中看到它。
以下是使用CodeIgniter付款的代码:
//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
)
)
答案 0 :(得分:0)
您可以切换到使用其他Paypal库。它可以节省您的时间,而不是解决这个问题。 http://codeigniter.com/wiki/PayPal_Lib
答案 1 :(得分:0)
我也有这个问题。
在我的情况下,我没有正确设置我的配置驱动程序,它最终将我的所有交易发送到Calvin(作者)的默认paypal沙盒帐户。
仔细检查以确保您的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);