【问题标题】:How to integrate Paypal Api for express checkout in asp.net?如何在 asp.net 中集成 Paypal Api 以进行快速结帐?
【发布时间】:2012-05-05 21:06:01
【问题描述】:

我在网上找到了this code

但根据WSDL,PayPal API 中不存在paypalAAInt 函数。任何人都可以帮助我如何在 Asp.Net 中集成 PayPal 快速结帐

CustomSecurityHeaderType type = new CustomSecurityHeaderType();

type.Credentials = new UserIdPasswordType()
{
    Username = "thakur_1322207622_biz_api1.gmail.com",
    Password = "1322207646",
    Signature = "An5ns1Kso7MWUdW4ErQKJJJ4qi4-Asr3E2CXn-a5b6uZmCDTPNNvpGBl"
};

SetExpressCheckoutRequestDetailsType sdt = new SetExpressCheckoutRequestDetailsType();
sdt.NoShipping = "1";

PaymentDetailsType pdt = new PaymentDetailsType()
{
    OrderDescription = "Order for 1 year" + Request.Cookies["username"].Value,
    OrderTotal = new BasicAmountType()
    {
        currencyID = CurrencyCodeType.USD,
        Value = "95.40"
    }
};
sdt.PaymentDetails = new PaymentDetailsType[] { pdt };
sdt.CancelURL = "http://localhost:2326/MusicStore/Default.aspx";
sdt.ReturnURL = "http://localhost:2326/MusicStore/regsuccessfull.aspx";

SetExpressCheckoutReq req = new SetExpressCheckoutReq()
{
    SetExpressCheckoutRequest = new SetExpressCheckoutRequestType()
    {
        SetExpressCheckoutRequestDetails = sdt,
        Version = "60.0"
    }
};

var resp = paypalAAInt.SetExpressCheckout(ref type, req);

if (resp.Errors != null && resp.Errors.Length > 0)
{
    // errors occured
    throw new Exception("Exception(s) occured when calling PayPal. First exception: " +
            resp.Errors[0].LongMessage);
}

Response.Redirect(string.Format("{0}?cmd=_express-checkout&token={1}", 
    ConfigurationManager.AppSettings["PayPalSubmitUrl"], resp.Token));  

这是我正在使用的代码,但函数 paypalAAInt 在 PayPal API 中不存在。应该使用哪个函数来代替paypalAAInt

【问题讨论】:

  • 请先确保您的答案尚未在论坛中得到回答,当您编写问题时,现有问题会自动出现,而我提到的问题会自动出现!如果你也用谷歌搜索Paypal Express C#,那么老问题就会出现......
  • 是的,我已经看到了 paresh 的问题,但我的问题是我如何从 paypal api 网络服务获得响应以接收令牌???
  • 我一直在阅读你的问题......它没有提到你在评论中所说的!您的问题具体而简单地说:谁能帮助我如何在 asp.net 中集成 paypal express checkout,为此,这是一个重复的问题。
  • 我已经编辑了问题,请您帮忙

标签: asp.net paypal-sandbox


【解决方案1】:

如果您有 PayPalAPIAAInterfaceClient 的对象,则方法 SetExpressCheckout 可用,并且如果您添加了对 WSDL 的 Web 引用,则该方法应该可用。

这是您缺少的行:

PayPalAPIAAInterfaceClient paypalAAInt = new PayPalAPIAAInterfaceClient();

【讨论】:

    猜你喜欢
    • 2012-10-08
    • 2021-07-23
    • 2018-03-25
    • 2011-12-12
    • 2016-07-10
    • 2017-12-01
    • 2015-12-02
    • 2017-09-11
    • 2014-12-07
    相关资源
    最近更新 更多