Paypal Adaptive Payments (Chained) - 链式支付中不允许单边收款人

Posted

技术标签:

【中文标题】Paypal Adaptive Payments (Chained) - 链式支付中不允许单边收款人【英文标题】:Paypal Adaptive Payments (Chained) - Unilateral receiver not allowed in chained payment 【发布时间】:2015-04-04 16:28:46 【问题描述】:

我一直在尝试使用 Paypal Adaptive Payments API 实现拆分付款。我有一个简单的并行付款可以工作,但这显示了对买家的分期付款。

基本上我是在卖会员资格。我们当地的协会应该获得 75% 的资金,而 25% 将转交给理事机构。会员应该只将总金额视为 2015 年会员,因此我开始研究连锁支付。从表面上看,这看起来像是一个非常简单的代码更改,但却给我带来了与单方面付款相关的问题。

我在 php.ini 中实现这个。

所以这里是paypal发送方法

function PaypalSend($payment_details, $api_function)

    // initial endpoint that starts the transaction
    $paypalInitialEndpoint = 'https://svcs.sandbox.paypal.com/AdaptivePayments/';

    // set http headers
    $headers = array(
        'Connection: Close',
        'X-PAYPAL-SECURITY-USERID: testseller_api1.nipf.com',
        'X-PAYPAL-SECURITY-PASSWORD: 1381912839',
        'X-PAYPAL-SECURITY-SIGNATURE: AzykGe5AzfK.mJFMRzBwIcTap-LcAsmsP4AhYzk1Y-07mh-xPLc-goK3',
        'X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T',
        'X-PAYPAL-REQUEST-DATA-FORMAT: JSON',
        'X-PAYPAL-RESPONSE-DATA-FORMAT: JSON'
    );

    // setup curl request and http headers
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $paypalInitialEndpoint . $api_function);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payment_details));
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

    if(!($res = curl_exec($ch)) ) 
       
        error_log(curl_error($ch));    
        curl_close($ch);    
        exit;
    

    curl_close($ch);

    return json_decode($res, TRUE);     

这是我的连锁付款方式。此代码需要大量重构,但在并行支付中功能齐全,只需对当前代码进行少量更改。

function sendChainedPayment()

    $purchase_details_array = array(
        "actionType" => "PAY",
        "currencyCode" => "GBP",
        "feesPayer" => "PRIMARYRECEIVER",
        "memo" => "blah blah blah",
        "receiverList" => array(
            "receiver" => array(
                array(
                    "amount" => "30.00", 
                    "email" => "testseller@nipf.com",
                    "primary" => "true"
                ),
                array(
                    "amount" => "10.00", 
                    "email" => "testseller@gbpf.com",
                    "primary" => "false"
                )           
            )
        ),
        "returnUrl" => "http://localhost/membershipSuccess.php",
        "cancelUrl" => "http://localhost/membershipCancel.php",
        "requestEnvelope" => array(
            "errorLanguage" => "en_UK",
            "detailLevel" => "ReturnAll"
        )
    );

    $response = PaypalSend($purchase_details_array, "Pay");

    //echo json_encode($response) . "<br /><br />";

    $payKey = $response['payKey'];

    $payment_details = array(
        "requestEnvelope" => array(
            "errorLanguage" => "en_UK",
            "detailLevel" => "ReturnAll"
        ),
        "payKey" => $payKey,
        "receiverOptions" => array(
            array(
                "receiver" => array("email" => "testseller@nipf.com"),
                "invoiceData" => array(
                    "item" => array(
                        array(
                            "name" => "Membership 2015",
                            "price" => "30.00",
                            "identifier" => "Membership 2015: joe bloggs"
                        )
                    )                                               
                )
            ),
            array(
                "receiver" => array("email" => "testseller@gbpf.com"),
                "invoiceData" => array(
                    "item" => array(
                        array(
                            "name" => "Membership 2015 (Fee)",
                            "price" => "10.00",
                            "identifier" => "Membership 2015 (Fee): joe bloggs"
                        )
                    )                                               
                )
            )
        )
    );

    $response = PaypalSend($payment_details, "SetPaymentOptions");

    //echo json_encode($response) . "<br /><br />";

    $paypalCustomerUrl = 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_ap-payment&paykey=' . $payKey;

    echo $paypalCustomerUrl;

    //header('Location: ' . $paypalCustomerUrl);        

我在第一次标注时收到以下响应 JSON。我认为这与帐户只是沙盒帐户而不是真实帐户有关,但是如果帐户都必须是真实帐户,我该如何在沙盒中进行测试?在这种情况下,用作 API 帐户的帐户是主要接收者。

"responseEnvelope":"timestamp":"2015-02-04T14:37:26.598-08:00","ack":"Failure","correlationId":"749bd1d709e76","build":"15089777","error":["errorId":"520009","domain":"PLATFORM","subdomain":"Application","severity":"Error","category":"Application","message":"Account Account not found. Unilateral receiver not allowed in chained payment is restricted","parameter":["Account not found. Unilateral receiver not allowed in chained payment"]]

【问题讨论】:

这些是用于您的沙盒帐户的实际电子邮件帐户吗?您需要确保它们是准确的,并且它们是经过验证和确认的帐户。如果您重新创建它们,则默认情况下应以这种方式设置它们。 它们是活跃的沙盒帐户,但不是活跃的电子邮件地址。这适用于简单支付和并行支付,我可以使用电子邮件和密码登录以确认发送/接收的付款。这些帐户是否需要拥有有效的电子邮件地址? 【参考方案1】:

我收到了同样的错误消息,我通过确保我在 API 调用中向其发送付款的 2 个电子邮件地址都是沙盒帐户来修复它。它们不作为真正的电子邮件地址存在,但它们确实需要作为贝宝帐户存在。 (之前我将它们发送到沙盒中不存在的 2 个实际的实时贝宝帐户)。

从错误信息“找不到账户。链式支付中不允许单边收款人”判断,它只是找不到您的账户,可能是因为他们不是沙盒账户。

【讨论】:

以上是关于Paypal Adaptive Payments (Chained) - 链式支付中不允许单边收款人的主要内容,如果未能解决你的问题,请参考以下文章

使用 Paypal Adaptive Payments 设置标题图片

集成 Paypal Adaptive Payments SDK 时未加载类

PayPal Adaptive Payments REST API 还是经典?

更改 Paypal Adaptive Payments 登录语言

使用 Paypal Adaptive Payments API 添加“给收件人的消息”

PayPal Adaptive Payments API 因多个接收者而失败