C# 直接支付方式贝宝问题

C# 直接支付方式贝宝问题,c#,paypal,C#,Paypal,我正在尝试实现直接付款方式,因为我的数据库中有用户的信用卡信息等。这就是我所指的样本: using System; using System.Collections.Generic; using System.Text; using com.paypal.sdk.services; using com.paypal.sdk.profiles; using com.paypal.sdk.util; using com.paypal.soap.api; namespace ASPDotNetSam

我正在尝试实现直接付款方式,因为我的数据库中有用户的信用卡信息等。这就是我所指的样本:

using System;
using System.Collections.Generic;
using System.Text;
using com.paypal.sdk.services;
using com.paypal.sdk.profiles;
using com.paypal.sdk.util;
using com.paypal.soap.api;

namespace ASPDotNetSamples
{
    public class DoDirectPayment
    {
        public DoDirectPayment()
        {
        }
        public string DoDirectPaymentCode(string paymentAction, string amount, string creditCardType, string creditCardNumber, string expdate_month, string cvv2Number, string firstName, string lastName, string address1, string city, string state, string zip, string countryCode, string currencyCode)
        {

            com.paypal.soap.api.DoDirectPaymentReq req = new com.paypal.soap.api.DoDirectPaymentReq();


            NVPCallerServices caller = new NVPCallerServices();
            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
            /*
             WARNING: Do not embed plaintext credentials in your application code.
             Doing so is insecure and against best practices.
             Your API credentials must be handled securely. Please consider
             encrypting them for use in any production environment, and ensure
             that only authorized individuals may view or modify them.
             */

            // Set up your API credentials, PayPal end point, API operation and version.
            profile.APIUsername = "sdk-three_api1.sdk.com";
            profile.APIPassword = "QFZCWN5HZM8VBG7Q";
            profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
            profile.Environment = "sandbox";
            caller.APIProfile = profile;

            NVPCodec encoder = new NVPCodec();
            encoder["VERSION"] = "51.0";
            encoder["METHOD"] = "DoDirectPayment";

            // Add request-specific fields to the request.
            encoder["PAYMENTACTION"] = paymentAction;
            encoder["AMT"] = amount;
            encoder["CREDITCARDTYPE"] = creditCardType;
            encoder["ACCT"] = creditCardNumber;
            encoder["EXPDATE"] = expdate_month;
            encoder["CVV2"] = cvv2Number;
            encoder["FIRSTNAME"] = firstName;
            encoder["LASTNAME"] = lastName;
            encoder["STREET"] = address1;
            encoder["CITY"] = city;
            encoder["STATE"] = state;
            encoder["ZIP"] = zip;
            encoder["COUNTRYCODE"] = countryCode;
            encoder["CURRENCYCODE"] = currencyCode;

            // Execute the API operation and obtain the response.
            string pStrrequestforNvp = encoder.Encode();
            string pStresponsenvp = caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();
            decoder.Decode(pStresponsenvp);
            return decoder["ACK"];

        }
    }
}
这是链接:


但是,我发现错误“NVPCallerServices”找不到。我已经有了贝宝基地的参考资料。有人能告诉我问题出在哪里吗?

是的,这就是Pay Pal API:)

样本可能有点过时。
NVPCallerServices
类现在似乎被命名为
CallerServices

所以试着换一条线

NVPCallerServices caller = new NVPCallerServices();


是的,这就是Pay Pal API:)

样本可能有点过时。
NVPCallerServices
类现在似乎被命名为
CallerServices

所以试着换一条线

NVPCallerServices caller = new NVPCallerServices();


我没想到会发生这种情况,因为我指的是最新的文件——他们网站上的文件。贝宝太棒了。不知道客户为什么喜欢这样。感觉PayPal有无数版本的SDK api文档网站和遍布网络的支付产品。。。这真的很恶心:)Paypal doc的烂-我不知道如果没有这个答案我怎么会知道。我没想到会发生这种情况,因为我指的是最新的doc-他们网站上的那一个。贝宝太棒了。不知道客户为什么喜欢这样。感觉PayPal有无数版本的SDK api文档网站和遍布网络的支付产品。。。它真的很恶心:)贝宝医生的烂-我不知道我怎么会想出这个答案。