0

我正在研究 MVC 项目,在该项目中我需要使用具有授权和捕获的自适应链式支付系统。

现在,我正在关注此链接:-

https://xadaptivepayments.codeplex.com/

此代码适用于在多个帐户中转移付款。但我不知道如何在它重定向到沙箱帐户进行付款时添加 paymentaction 参数,以便卖方可以捕获付款。

我的代码如下: -

    IPayPalAdaptivePaymentService _paysvc = new PayPalAdaptivePaymentService();
        Uri redirectUrl = new Uri(ConfigurationManager.AppSettings["REDIRECT-URL"]);
        Uri returnUrl = new Uri(ConfigurationManager.AppSettings["PAYPAL-RETURNURI"]);
        Uri cancelUrl = new Uri(ConfigurationManager.AppSettings["PAYPAL-CANCELURI"]);
        string str = "asdsadsadsads";
        string seller = ConfigurationManager.AppSettings["PAYPAL-SELLER"];
        string paymentref = "test123";
        string currency = "USD";
        List<x.paypal.model.Receiver> receivers = new List<x.paypal.model.Receiver>();
        receivers.Add(new x.paypal.model.Receiver { Amount = "3", Email = "payments-facilitator@akaritutoring.com", InvoiceId = str, Description = "test paypal payment" });
        receivers.Add(new x.paypal.model.Receiver { Amount = "7", Email = "yashsharmanice1@gmail.com", InvoiceId = str, Description = "test paypal payment 1" });
         IPayRequest payRequest = new x.paypal.model.PayRequest().CreateRequest().WithPaymentReference(paymentref).WithReturnUri(returnUrl).WithCancelUri(cancelUrl).Currency(currency).ReceiverList(receivers);
         var resp = _paysvc.RequestPayment(payRequest);
         return Redirect("https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_ap-payment&paymentaction=authorization&paykey=" + resp.PayKey);

请帮我解决这个问题。

提前致谢...

4

2 回答 2

1

确定自适应支付中的actionType支付行为。没有诸如sale,order or auth自适应付款之类的付款操作。您可以使用 actionType ofPAY_PRIMARY来延迟付款,以指定向主要收款人而不是次要收款人付款。

您需要运行ExecutePaymentAPI来捕获付款

于 2015-12-02T06:57:03.517 回答
0

自适应支付中不可能进行授权/捕获,因为它们都在不同的单独模型中。

但是,您可以在 Adaptive Payments 中实现 Authorization/Capture 的概念,即使用Preapproval Payments

通过在指定时间段内与您的买家设置特定金额的预先批准,买家可以通过授予您在未来向他收取规定的金额的许可来预先批准。(授权)

获得预批准密钥后,您现在可以随时向买家收费,这类似于 Capture 的概念。

然后,您将通过提供和设置来使用支付 API 操作来向买方收费并将金额分配给主要和次要收款人。preapprovalKeyactionType=PAY

您指的链接很旧,我不确定它是否可以支持上述场景。您可以尝试研究它以实现上述概念。

如果没有,您可以在此处使用适用于 .NET 的自适应支付 SDK:https ://www.nuget.org/packages/PayPalAdaptivePaymentsSDK/

于 2015-12-02T07:01:31.667 回答