2012-02-13 104 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 
    } 

希望它能帮助别人。