我正在尝试将paypal sandbox与我的asp.net应用程序集成!我已经集成了模块,并且我已经重定向到paypal sandbox站点!您可以登录到沙盒和付款!Paypal焦点重定向到我的返回URL!现在的问题是,我不知道paypal sandbox返回'return URL‘是什么,甚至我是沙箱的新手,所以我不知道如何管理重定向的数据!请通知我!谢谢!
我已经试过下载演示了!但在演示中,大多数人使用自己的dll!他们没有提供类定义,所以我有点困惑!
发布于 2012-01-24 20:39:14
首先,检查返回了哪些字段的paypal文档。正如失望先生猜测的那样,数据可能会在HTTP POST请求中以表单数据的形式返回。
您可以使用fiddler检查请求和数据。
要在ASP.NET应用程序中访问表单数据,只需使用Request对象:
var field = Request["fieldName"];发布于 2012-01-24 20:44:20
登录到您的沙箱帐户,然后单击Documentation --> Sample Code,然后单击Integration Wizard链接以生成所需的所有示例代码。
返回的URL将有两个URL参数:
令牌,payerId
我使用的是MVC,所以我的Controller方法签名看起来像这样:
public ActionResult PaypalOrderConfirmation(string token, string payerId)但是你可以只使用Request.QueryString("token");//是不是很久了……
然后你需要“提交付款”
NVPCodec nvpCodec = new NVPCodec();
string returnMessage;
bool success = PayPal.CommitPayment(someTotal, token, payerId, out nvpCodec, out returnMessage);//----------------------------------------------------------------------------//
public static bool CommitPayment(decimal finalPaymentAmount, string token, string payerId, out NVPCodec nvpCodec, out string returnMessage)
{
nvpCodec = new NVPCodec();
returnMessage = "";
bool success = new NVPAPICaller().ConfirmPayment(finalPaymentAmount.ToString(), token, payerId, ref nvpCodec, ref returnMessage);
return success;
}我会在paypal上再看看下载代码,如果我找到了,就把它添加到这篇文章中。
https://stackoverflow.com/questions/8986763
复制相似问题