【发布时间】:2012-03-04 13:31:31
【问题描述】:
谁能告诉我如何以连锁支付方式自动执行延迟付款(假设是主要收款人收到付款后的 5 天)?关键是自动执行,无需手动批准和支付二级接收方。请用一些示例代码进行说明。
我使用了“actionType”=>“PAY_PRIMARY”,以便主要收款人获得资金。
但是我要如何编码才能让第二个收款人拿到钱呢?
【问题讨论】:
谁能告诉我如何以连锁支付方式自动执行延迟付款(假设是主要收款人收到付款后的 5 天)?关键是自动执行,无需手动批准和支付二级接收方。请用一些示例代码进行说明。
我使用了“actionType”=>“PAY_PRIMARY”,以便主要收款人获得资金。
但是我要如何编码才能让第二个收款人拿到钱呢?
【问题讨论】:
查看this answer 以获取解决方案。基本上您只需要在 90 天内使用payKey 执行ExecutePayment 操作,即可将付款发送给二级方。
【讨论】:
actionType 是 PAY_PPRIMARY 然后,您会在 90 天内触发此付款。 它延迟但没有超时。
https://cms.paypal.com/cms_content/US/en_US/files/developer/PP_AdaptivePayments.pdf
【讨论】:
可能为时已晚,但它肯定会在未来帮助某人。 由于我们集成了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";
不要忘记,在使用延迟链式付款时,您必须提供一个有效的贝宝帐户。 现在您获得了您的 pay_key,您必须使用它在 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
}
希望对某人有所帮助。
【讨论】: