2012-02-13 92 views
1

任何人都可以告訴我如何以鏈接付款方式自動執行延期付款(假設它是主接收方收到付款後的5天)?關鍵是自動執行,而不必手動批准和支付輔助接收器。請用一些示例代碼說明。延遲鏈接付款

我已經使用「actionType」=>「PAY_PRIMARY」,這樣主接收者就可以獲得金錢。

但是,我怎麼可以編碼,使二手接收機得到錢?

回答

2

檢查this answer的解決方案。基本上,您只需在90天內用payKey執行ExecutePayment操作即可將付款發送給第二方。

0

可能已經太晚了,但它肯定會在未來幫助某人。 由於我們整合了paypal延遲鏈接付款,您可以設置一個主要賬戶,其中所有金額都將到賬,並且您還可以設置一旦經主要賬戶持有人批准後轉帳的次級賬戶。

string endpoint = Constants_Common.endpoint + "Pay"; 
    NVPHelper NVPRequest = new NVPHelper(); 
    NVPRequest[SampleNVPConstant.requestEnvelopeerrorLanguage] = "en_US"; 
    //NVPRequest[SampleNVPConstant.Pay2.actionType] = "PAY"; 
    //the above one is for simple adoptive payment payment 
    NVPRequest[SampleNVPConstant.Pay2.actionType] = "PAY_PRIMARY"; 
    //the above one for deleayed chained payment 
    NVPRequest[SampleNVPConstant.Pay2.currencyCode] = "USD"; 
    NVPRequest[SampleNVPConstant.Pay2.feesPayer] = "EACHRECEIVER"; 
    NVPRequest[SampleNVPConstant.Pay2.memo] = "XXXXXXXX"; 

現在我們必須設置一級和二級接收器:

//primary account 
     NVPRequest[SampleNVPConstant.Pay2.receiverListreceiveramount_0] = TotalAmount; 
     NVPRequest[SampleNVPConstant.Pay2.receiverListreceiveremail_0] = "XXXx.xxxxx.com"; 
     NVPRequest[SampleNVPConstant.Pay2.receiverListreceiverprimary_0] = "true"; 
     //secondary accounts 
     NVPRequest[SampleNVPConstant.Pay2.receiverListreceiveramount_1] = (somemoney out of total amount); 
     NVPRequest[SampleNVPConstant.Pay2.receiverListreceiveremail_1] = "xxxxx.xxxx.com"; 
     NVPRequest[SampleNVPConstant.Pay2.receiverListreceiverprimary_1] = "false"; 
     NVPRequest[SampleNVPConstant.Pay2.receiverListreceiveramount_2] = (somemoney out of total amount); 
     NVPRequest[SampleNVPConstant.Pay2.receiverListreceiveremail_2] = x.x.com; 
     NVPRequest[SampleNVPConstant.Pay2.receiverListreceiverprimary_2] = "false"; 

不要忘記,你必須同時使用延遲鏈式支​​付給一個有效的PayPal帳戶。 現在您可以獲得您的付款密鑰,您必須使用該付款密鑰才能在90天內執行付款,以便其他輔助收款人可以獲得款項。 這裏是工作代碼:

String endpoint = Constants_Common.endpoint + "ExecutePayment"; 
    NVPHelper NVPRequest = new NVPHelper(); 
    //requestEnvelope.errorLanguage is common for all the request 
    NVPRequest[SampleNVPConstant.requestEnvelopeerrorLanguage] = "en_US"; 
    NVPRequest[SampleNVPConstant.ExecutePayment.payKey] = "your pay key"; 
    string strrequestforNvp = NVPRequest.Encode(); 
    //calling Call method where actuall API call is made, NVP string, header value adne end point are passed as the input. 
    CallerServices_NVP CallerServices = new CallerServices_NVP(); 
    string stresponsenvp = CallerServices.Call(strrequestforNvp, Constants_Common.headers(), endpoint); 
    //Response is send to Decoder method where it is decoded to readable hash table 
    NVPHelper decoder = new NVPHelper(); 
    decoder.Decode(stresponsenvp); 
    if (decoder != null && decoder["responseEnvelope.ack"].Equals("Success") && decoder["paymentExecStatus"].Equals("COMPLETED")) 
    { 
    //do something 
    } 

希望它能幫助別人。