我想向两个收货人付款,即买家以 100 的价格购买商品,收货人 1 得到 90,收货人 2 得到 10。我正在使用链式付款方式。我在接收者 1 的帐户中获得 100,这没问题,但我无法获得接收者 2 的付款。接收者的帐户 ID 已设置,但此处未给出。我做错了什么?谢谢
<?php
require_once('../includes/config.php');
require_once('../includes/paypal.class.php');
$PayPalConfig = array(
'Sandbox' => $sandbox,
'DeveloperAccountEmail' => $developer_account_email,
'ApplicationID' => $application_id,
'DeviceID' => $device_id,
'IPAddress' => $_SERVER['REMOTE_ADDR'],
'APIUsername' => $api_username,
'APIPassword' => $api_password,
'APISignature' => $api_signature,
'APISubject' => $api_subject
);
$PayPal = new PayPal_Adaptive($PayPalConfig);
$PayRequestFields = array(
'ActionType' => 'PAY_PRIMARY',
'CancelURL' => $domain.'cancel.php',
'CurrencyCode' => 'USD',
'FeesPayer' => 'EACHRECEIVER',
'IPNNotificationURL' => '',
'Memo' => '',
'Pin' => '',
'PreapprovalKey' => '',
'ReturnURL' => $domain.'return.php',
'ReverseAllParallelPaymentsOnError' => '',
'SenderEmail' => '',
'TrackingID' => ''
);
$ClientDetailsFields = array(
'CustomerID' => '',
'CustomerType' => '',
'GeoLocation' => '',
'Model' => '',
'PartnerName' => ''
);
$FundingTypes = array('ECHECK', 'BALANCE', 'CREDITCARD');
$Receivers = array();
$Receiver = array(
'Amount' => '100.00',
'Email' => 'receiver1accountid',
'InvoiceID' => '',
'PaymentType' => 'GOODS',
'PaymentSubType' => '',
'Phone' => array('CountryCode' => '', 'PhoneNumber' => '', 'Extension' => ''),
'Primary' => 'true'
);
array_push($Receivers,$Receiver);
$Receiver = array(
'Amount' => '10.00',
'Email' => 'receiver2accountid',
'InvoiceID' => '',
'PaymentType' => 'GOODS',
'PaymentSubType' => '',
'Phone' => array('CountryCode' => '', 'PhoneNumber' => '', 'Extension' => ''),
'Primary' => 'false'
);
array_push($Receivers,$Receiver);
$SenderIdentifierFields = array(
'UseCredentials' => ''
);
$AccountIdentifierFields = array(
'Email' => '',
'Phone' => array('CountryCode' => '', 'PhoneNumber' => '', 'Extension' => '')
);
$PayPalRequestData = array(
'PayRequestFields' => $PayRequestFields,
'ClientDetailsFields' => $ClientDetailsFields,
'FundingTypes' => $FundingTypes,
'Receivers' => $Receivers,
'SenderIdentifierFields' => $SenderIdentifierFields,
'AccountIdentifierFields' => $AccountIdentifierFields
);
$PayPalResult = $PayPal->Pay($PayPalRequestData);
if(!$PayPalResult)
{
$errors = array('Errors'=>$PayPalResult['Errors']);
echo '<pre />';
print_r($errors);
exit();
}
else
{
header('Location: '.$PayPalResult['RedirectURL']);
$ExecutePaymentFields = array(
'PayKey' => $PayPalResult['PayKey'],
'FundingPlanID' => ''
);
$PayPalRequestData = array('ExecutePaymentFields' => $ExecutePaymentFields);
$PayPalResult = $PayPal->ExecutePayment($PayPalRequestData);
if(!$PayPalResult)
{
$errors = array('Errors'=>$PayPalResult['Errors']);
echo '<pre />';
print_r($errors);
exit();
}
else
{
echo '<pre />';
print_r($PayPalResult);
}
}
?>