Quantcast
Channel: Active questions tagged paypal - Stack Overflow
Viewing all articles
Browse latest Browse all 522

Paypal Adaptive Payments

$
0
0

I want to make payment to two receivers i.e. buyer buys goods for 100, receiver 1 gets 90 and receiver 2 gets 10. I am using chained payment method. I am getting 100 in receiver 1's account which is ok but I am not able to get receiver 2's payment. Receiver's account id are set but not given here. What I am doing wrong? Thanks

<?phprequire_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);}}?>

Viewing all articles
Browse latest Browse all 522

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>