0
我已經使用NuGet包(IppDotNetSdkForQuickBooksApiV3)爲我的項目添加了QuickBooks V3.0的IPP .Net SDK參考。IntuIt QuickBooks支付API,如何使用IppDotNetSdkForQuickBooksApiV3包的servicecontext執行信用卡交易?
我能夠對客戶帳戶數據執行CRUD操作。我如何使用servicecontext執行信用卡交易?
這裏是我的示例代碼,
string consumerKey = "qyprd4rAYMSe4EhBLcGvKrZ8Xb8M3i";
string consumerKeySecret = "xdYvcPHkjICQ2uJ3yNzFJpI8elHJsnQa127EKrMf";
string accessToken = "lvprdyTiT1kxH8VhFhzEv3BpiC4cV5fYC3tPKtijE9hdqWk9";
string accessTokenSecret = "HTkdQ4WYtItio3NXo569py1SqPZ4jDnxfE1FUPZA";
string Realm = "1440846810";
OAuthRequestValidator oauthValidator = new OAuthRequestValidator(
accessToken, accessTokenSecret, consumerKey, consumerKeySecret);
string appToken = "9f4179e9ba7d4b4343b8986b9935526c724a";
string companyID = "1440846810";
ServiceContext context = new ServiceContext(appToken, companyID, IntuitServicesType.QBO, oauthValidator);
context.IppConfiguration.BaseUrl.Qbo = "https://sandbox-quickbooks.api.intuit.com/";
DataService service = new DataService(context);
ChargeCredit charge = new ChargeCredit() { };
Customer customer = new Customer();
//Mandatory Fields
customer.GivenName = "Sridhar";
customer.Title = "Mr.";
customer.MiddleName = "Sri";
customer.FamilyName = "Goshika";
// Optional Fields
customer.PrimaryEmailAddr = new EmailAddress() { Address = "sridh[email protected]" };
Customer resultCustomer = service.Add(customer) as Customer;
return service;