【发布时间】:2018-08-22 13:53:59
【问题描述】:
我有一个 PHP 网页,它使用创建发票并允许用户通过 PayPal 付款。该脚本通过 https 识别 IPN 监听页面,并在用户完成交易后调用该页面。在调用的 IPN 脚本中,我将发票状态更新为“已付款”以及成功付款后的其他相关信息。好消息是所有功能都完美无缺。但是,当我在例程中向获得销售额百分比的供应商添加单笔付款时,脚本会一遍又一遍地执行并且永不停止。似乎造成问题的脚本部分是
case "Completed":
$vBody = "PayPal has identifed this transaction as Completed. Your account will be credited.";
// BEGIN MassPay API Call
// Create PayPal object.
$PayPalConfig = array(
'Sandbox' => $sandbox,
'APIUsername' => $api_username,
'APIPassword' => $api_password,
'APISignature' => $api_signature,
'PrintHeaders' => $print_headers,
'LogResults' => $log_results,
'LogPath' => $log_path,
);
$PayPal = new angelleye\PayPal\PayPal($PayPalConfig);
// Prepare request arrays
$MPFields = array(
'emailsubject' => 'Notification of Payment', // The subject line of the email that PayPal sends when the transaction is completed. Same for all recipients. 255 char max.
'currencycode' => 'USD', // Three-letter currency code.
'receivertype' => 'EmailAddress' // Indicates how you identify the recipients of payments in this call to MassPay. Must be EmailAddress or UserID
);
// Build MPItems array.
$Item1 = array(
'l_email' => 'recipient@gmail.com', // Required. Email address of recipient. You must specify either L_EMAIL or L_RECEIVERID but you must not mix the two.
'l_receiverid' => '', // Required. ReceiverID of recipient. Must specify this or email address, but not both.
'l_amt' => '3.00', // Required. Payment amount.
'l_uniqueid' => $Post["invoice"], // Transaction-specific ID number for tracking in an accounting system.
'l_note' => 'Payment per PayPal transaction processing fee.' // Custom note for each recipient.
);
$MPItems = array($Item1);
//$MPItems = $Item1; // ($Item1, $Item2, etc
$PayPalRequestData = array('MPFields'=>$MPFields, 'MPItems' => $MPItems);
// Pass data into class for processing with PayPal and load the response array into $PayPalResult
$PayPalResult = $PayPal->MassPay($PayPalRequestData);
// END MassPay API Call
//Update database on succcessful payment
脚本执行良好,沙盒中向供应商的大规模付款有效,但它从未停止。如果我使用它完成交易,发件人的 PayPal 帐户将耗尽所有资金。我已经读到沙盒可能存在问题,但不确定这是否准确,我无法将其投入生产。谁能告诉我如何解决或识别问题?
【问题讨论】:
-
你正在使用一个开关,但你能复制你所有的代码吗?