1

私は、送信者が金額を支払い、その95%が一方の受信者に、5%がもう一方の受信者に支払われるサービスを開発しています。(たとえば、100ドルの支払い、95ドルのプライマリーへの手数料、5ドルのセカンダリーへの手数料など)この例では、送信者は100ドルではなく、95ドルを支払い額と見なしており、その理由がわかりません。

ここで、Paypalの電子メールアドレスの別の配列に対応する配列に金額が設定されます。

$receiverAmountArray = array(
        .5*$backing_amount,
        .95*$backing_amount
        );

2番目の電子メールアドレスはプライマリに設定されます。最大量の受信者はプライマリである必要があります。

$receiverPrimaryArray = array(
        'false',
        'true'
        );

CallPay(Paypalのライブラリから)は呼び出されます:

$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) . "&currencyCode=" . 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
4

2 に答える 2

3

PaypalのAdaptivePaymentsドキュメントによると:

連鎖支払いでは、送信者はプライマリ受信者に金額を支払い、そこからプライマリ受信者はセカンダリ受信者に支払います。送信者はプライマリ受信者についてのみ知っており、セカンダリ受信者については知りません。

したがって、これは意図したとおりに機能しています。合計金額の5%をセカンダリレシーバーに支払うには、次のように変更する必要があります。

$receiverAmountArray = array(
        .05*$backing_amount,
        .95*$backing_amount
        );

これに:

$receiverAmountArray = array(
        .05*$backing_amount,
        $backing_amount
        );

合計金額がアレイ内の個々のレシーバー金額の合計であると考えるのは私の間違いでした。

于 2012-04-12T19:06:03.880 に答える
0

例:total_amount = 100;

ReceiverList.receiver(0).primary = trueを設定すると、receiverList.receiver(0).amount = total_amount;

およびreceiverList.receiver(1).amount = 95%* total_amount

于 2012-04-13T03:42:14.020 に答える