Paypal IPN 并行支付问题
我正在使用这个 http://www.binpress。 com/app/paypal-adaptive- payments-pro-codeigniter-library/140 库,我使用它作为 codeigniter 项目的 ipn 监听器 - http://pastebin.com/pMb7Zhz3。
基本上我正在使用上面的 paypal 库进行并行交易,这样当用户进行付款/捐赠时,它会将钱发送到 2 个不同的帐户。交易完成后,paypal 会将数据发送到我的 ipn 侦听器,并且如果我保留此 'IPNNotificationURL' => ,它就会解析 1 个客户的信息。 ''
在我的代码中并进入 paypal 并设置 iPN url。
我正在尝试获取两个帐户的 IPN 信息,而不必让两个帐户在其 paypal 设置中设置 iPN url。当我设置 'IPNNotificationURL' => 'http://example.com/paypal_ipn'
,我仍然获得 1 帐户的 ipn 信息,但我在侦听器的第 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));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我弄清楚了如何在 PHP 中解析自适应支付 IPN。
我使用了 donut2d DecodePayPalIPN() 函数href="https://www.x.com/developers/paypal/forums/adaptive- payments-api/php-technique-parsing-adaptive- payment-ipn-posts?page=0%2C0%2C0%2C0%2C0 %2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C1" rel="nofollow">https://www.x.com/developers/paypal/forums/adaptive- payments-api/php-technique-parsi ng-自适应支付-ipn-posts?page=0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C1与 paypal 网站上的示例监听器之一相结合,这是我完整的 Codeigniter IPN 监听器,用于并行交易的自适应支付。
I figured out how to parse the adaptive payments IPN in PHP.
I used the
DecodePayPalIPN()
function by donut2d https://www.x.com/developers/paypal/forums/adaptive-payments-api/php-technique-parsing-adaptive-payment-ipn-posts?page=0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C1 in combination with one of the example listeners that is on the paypal website and here is my complete Codeigniter IPN Listener for adaptive payments with a parallel transaction.