2

我在网上找到了这段代码。

但是根据WSDLpaypalAAInt,PayPal API 中不存在该功能。谁能帮助我如何在 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

4

1 回答 1

1

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

这是您缺少的行:

PayPalAPIAAInterfaceClient paypalAAInt = new PayPalAPIAAInterfaceClient();
于 2012-05-09T12:45:11.103 回答