我正在開發一項服務,發件人支付一筆款項,其中95%發給一個接收者,另外5%發給另一個接收者。 (例如,付100美元,小學收費95美元,中學5美元)。在這個例子中,發件人看到95美元作爲他的支付金額,而不是100美元,我不理解爲什麼。貝寶自適應鏈接付款 - 發件人的金額是主要收款人的金額,而不是總金額。怎麼修?
這裏是在另一個Paypal電子郵件地址數組對應的數組中設置金額的位置。
$receiverAmountArray = array(
.5*$backing_amount,
.95*$backing_amount
);
第二個電子郵件地址設置爲主要。最大數額的接收者必須是主要的。
$receiverPrimaryArray = array(
'false',
'true'
);
CallPay(貝寶的庫)被稱爲:
$resArray = CallPay ($actionType, $cancelUrl, $returnUrl, $currencyCode, $receiverEmailArray,
$receiverAmountArray, $receiverPrimaryArray, $receiverInvoiceIdArray,
$feesPayer, $ipnNotificationUrl, $memo, $pin, $preapprovalKey,
$reverseAllParallelPaymentsOnError, $senderEmail, $trackingId
);
這裏是CallPay功能。對不起長度:
function CallPay($actionType, $cancelUrl, $returnUrl, $currencyCode, $receiverEmailArray, $receiverAmountArray,
$receiverPrimaryArray, $receiverInvoiceIdArray, $feesPayer, $ipnNotificationUrl,
$memo, $pin, $preapprovalKey, $reverseAllParallelPaymentsOnError, $senderEmail, $trackingId)
{
/* Gather the information to make the Pay call.
The variable nvpstr holds the name value pairs
*/
// required fields
$nvpstr = "actionType=" . urlencode($actionType) . "¤cyCode=" . urlencode($currencyCode);
$nvpstr .= "&returnUrl=" . urlencode($returnUrl) . "&cancelUrl=" . urlencode($cancelUrl);
if (0 != count($receiverAmountArray))
{
reset($receiverAmountArray);
while (list($key, $value) = each($receiverAmountArray))
{
if ("" != $value)
{
$nvpstr .= "&receiverList.receiver(" . $key . ").amount=" . urlencode($value);
}
}
}
if (0 != count($receiverEmailArray))
{
reset($receiverEmailArray);
while (list($key, $value) = each($receiverEmailArray))
{
if ("" != $value)
{
$nvpstr .= "&receiverList.receiver(" . $key . ").email=" . urlencode($value);
}
}
}
if (0 != count($receiverPrimaryArray))
{
reset($receiverPrimaryArray);
while (list($key, $value) = each($receiverPrimaryArray))
{
if ("" != $value)
{
$nvpstr = $nvpstr . "&receiverList.receiver(" . $key . ").primary=" . urlencode($value);
}
}
}
if (0 != count($receiverInvoiceIdArray))
{
reset($receiverInvoiceIdArray);
while (list($key, $value) = each($receiverInvoiceIdArray))
{
if ("" != $value)
{
$nvpstr = $nvpstr . "&receiverList.receiver(" . $key . ").invoiceId=" . urlencode($value);
}
}
}
// optional fields
if ("" != $feesPayer)
{
$nvpstr .= "&feesPayer=" . urlencode($feesPayer);
}
if ("" != $ipnNotificationUrl)
{
$nvpstr .= "&ipnNotificationUrl=" . urlencode($ipnNotificationUrl);
}
if ("" != $memo)
{
$nvpstr .= "&memo=" . urlencode($memo);
}
if ("" != $pin)
{
$nvpstr .= "&pin=" . urlencode($pin);
}
if ("" != $preapprovalKey)
{
$nvpstr .= "&preapprovalKey=" . urlencode($preapprovalKey);
}
if ("" != $reverseAllParallelPaymentsOnError)
{
$nvpstr .= "&reverseAllParallelPaymentsOnError=" . urlencode($reverseAllParallelPaymentsOnError);
}
if ("" != $senderEmail)
{
$nvpstr .= "&senderEmail=" . urlencode($senderEmail);
}
if ("" != $trackingId)
{
$nvpstr .= "&trackingId=" . urlencode($trackingId);
}
/* Make the Pay call to PayPal */
$resArray = hash_call("Pay", $nvpstr);
/* Return the response array */
return $resArray;
}
這是$ nvpstr在調用之前的值。 Paypal是否可能將付款金額作爲主要付款?這在鏈式支付的情況下沒有意義。
actionType=PAY¤cyCode=USD&returnUrl=https%3A%2F%2F.com%2Fview_profile.php&cancelUrl=https%3A%2F%2Fexamplefunding.com%2Fview_profile.php&receiverList.receiver(0).amount=95&receiverList.receiver(1).amount=5&receiverList.receiver(0).email=recip_1334204171_biz%40example.com&receiverList.receiver(1).email=example_1334201682_biz%40example.com&receiverList.receiver(0).primary=true&receiverList.receiver(1).primary=false&receiverList.receiver(0).invoiceId=5c4e2902cbe484a0db37284f0144994c&receiverList.receiver(1).invoiceId=6f3d8ce65d1a59b41f8822ba6129ea58&feesPayer=PRIMARYRECEIVER&memo=New+Draft+Lines+-+ExampleFunding.com&senderEmail=paypal_1334201496_per%40example.com&trackingId=mqN8SSgIq