【发布时间】:2012-02-21 08:13:48
【问题描述】:
我正在使用这个 http://www.binpress.com/app/paypal-adaptive-payments-pro-codeigniter-library/140 库,并将它用作我的 ipn 侦听器,用于 codeigniter 项目 - http://pastebin.com/pMb7Zhz3。
基本上,我正在使用上面的贝宝库进行并行交易,这样当用户进行付款/捐赠时,它会将钱汇到 2 个不同的帐户。交易完成后,paypal 会将数据发送到我的 ipn 侦听器,如果我将 'IPNNotificationURL' => '' 留在我的代码中并进入 paypal 并设置 ipn url,它会解析 1 个客户的信息。
我正在尝试获取两个帐户的 IPN 信息,而不必让两个帐户都在其 paypal 设置中设置 ipn url。当我设置'IPNNotificationURL' => 'http://example.com/paypal_ipn' 时,我仍然得到1 帐户的ipn 信息,但我收到了我的听众的这个警告Array to string conversion on line 11。我该如何解决这个问题,如果我这样做了,我会从两个帐户中获取 ipn 信息吗?
这是我用于并行支付的上述库中的支付方式
function Pay()
{
// Prepare request arrays
$PayRequestFields = array(
'ActionType' => 'PAY', // Required. Whether the request pays the receiver or whether the request is set up to create a payment request, but not fulfill the payment until the ExecutePayment is called. Values are: PAY, CREATE, PAY_PRIMARY
'CancelURL' => '', // Required. The URL to which the sender's browser is redirected if the sender cancels the approval for the payment after logging in to paypal.com. 1024 char max.
'CurrencyCode' => 'USD', // Required. 3 character currency code.
'FeesPayer' => 'SENDER', // The payer of the fees. Values are: SENDER, PRIMARYRECEIVER, EACHRECEIVER, SECONDARYONLY
'IPNNotificationURL' => '', // The URL to which you want all IPN messages for this payment to be sent. 1024 char max.
'Memo' => '', // A note associated with the payment (text, not HTML). 1000 char max
'Pin' => '', // The sener's personal id number, which was specified when the sender signed up for the preapproval
'PreapprovalKey' => '', // The key associated with a preapproval for this payment. The preapproval is required if this is a preapproved payment.
'ReturnURL' => '', // Required. The URL to which the sener's browser is redirected after approvaing a payment on paypal.com. 1024 char max.
'ReverseAllParallelPaymentsOnError' => '', // Whether to reverse paralel payments if an error occurs with a payment. Values are: TRUE, FALSE
'SenderEmail' => '', // Sender's email address. 127 char max.
'TrackingID' => '' // Unique ID that you specify to track the payment. 127 char max.
);
$ClientDetailsFields = array(
'CustomerID' => '', // Your ID for the sender 127 char max.
'CustomerType' => '', // Your ID of the type of customer. 127 char max.
'GeoLocation' => '', // Sender's geographic location
'Model' => '', // A sub-identification of the application. 127 char max.
'PartnerName' => '' // Your organization's name or ID
);
$FundingTypes = array('ECHECK', 'BALANCE', 'CREDITCARD');
$Receivers = array();
$Receiver = array(
'Amount' => '', // Required. Amount to be paid to the receiver.
'Email' => '', // Receiver's email address. 127 char max.
'InvoiceID' => '', // The invoice number for the payment. 127 char max.
'PaymentType' => '', // Transaction type. Values are: GOODS, SERVICE, PERSONAL, CASHADVANCE, DIGITALGOODS
'PaymentSubType' => '', // The transaction subtype for the payment.
'Phone' => array('CountryCode' => '', 'PhoneNumber' => '', 'Extension' => ''), // Receiver's phone number. Numbers only.
'Primary' => '' // Whether this receiver is the primary receiver. Values are: TRUE, FALSE
);
array_push($Receivers,$Receiver);
$SenderIdentifierFields = array(
'UseCredentials' => '' // If TRUE, use credentials to identify the sender. Default is false.
);
$AccountIdentifierFields = array(
'Email' => '', // Sender's email address. 127 char max.
'Phone' => array('CountryCode' => '', 'PhoneNumber' => '', 'Extension' => '') // Sender's phone number. Numbers only.
);
$PayPalRequestData = array(
'PayRequestFields' => $PayRequestFields,
'ClientDetailsFields' => $ClientDetailsFields,
'FundingTypes' => $FundingTypes,
'Receivers' => $Receivers,
'SenderIdentifierFields' => $SenderIdentifierFields,
'AccountIdentifierFields' => $AccountIdentifierFields
);
$PayPalResult = $this->paypal_adaptive->Pay($PayPalRequestData);
if(!$this->paypal_adaptive->APICallSuccessful($PayPalResult['Ack']))
{
$errors = array('Errors'=>$PayPalResult['Errors']);
$this->load->view('paypal_error',$errors);
}
else
{
$data['result'] = $PayPalResult;
$this->load->view('success', $data);
}
}
第 11 行来自上面的 pastebin - $value = urlencode(stripslashes($value));
【问题讨论】:
-
您能否提供该行和代码的其他相关部分?
-
我也看过该帖子几次。我仍然遇到麻烦。
-
从网上搜到,似乎与php无法处理
$_POST['transaction[0].amount']之类的$_POST vars的方式有关。我很确定我只需要修改获取帖子信息的方式和/或检索它的方式。 -
来自PHP manual,"变量名中的点和空格被转换为下划线。例如变成$_REQUEST["a_b"]。我>”。 -- 好电话。
标签: php codeigniter paypal paypal-ipn