Quickbooks Online Not Saving Invoices Correctly - c#

I am trying to create Quickbooks Online(QBO) Invoices. I am able to create the invoice in QBO, however the Amounts and Balances are set to 0.00. I have confirmed that the invoice(QBOInvoice) that I am passing to QBO contains the correct information, however, the invoice(resultInvoice) I receive in return does not have the prescribed Amounts and Balances.
Any guidance or suggestions? Thanks.
Invoice QBOinvoice = new Invoice();
QBOinvoice.DocNumber = Guid.NewGuid().ToString("N").Substring(0, 10);
QBOinvoice.Deposit = new Decimal(0.00);
QBOinvoice.DepositSpecified = true;
QBOinvoice.AllowIPNPayment = false;
QBOinvoice.AllowIPNPaymentSpecified = true;
QBOinvoice.BillAddr = customer.BillAddr;
QBOinvoice.ShipAddr = customer.ShipAddr;
QBOinvoice.CustomerRef = new ReferenceType()
{
name = customer.DisplayName,
Value = customer.Id
};
QBOinvoice.DueDate = DateTime.UtcNow.Date;
QBOinvoice.DueDateSpecified = true;
QBOinvoice.PrintStatus = PrintStatusEnum.NotSet;
QBOinvoice.PrintStatusSpecified = true;
QBOinvoice.EmailStatus = EmailStatusEnum.NotSet;
QBOinvoice.EmailStatusSpecified = true;
var serviceRecord = db.t_CleaningRecords.Where(p => p.ID == MOSESInvoice.ServiceRecordID).Single();
QBOinvoice.ShipDate = serviceRecord.ServiceDate ?? DateTime.Parse("01/01/1900"); // Used to address the fact that the DB column allows for nulls;
QBOinvoice.ARAccountRef = new ReferenceType()
{
type = Enum.GetName(typeof(objectNameEnumType), objectNameEnumType.Account),
name = "Account Receivable",
Value = "QB:37"
};
QBOinvoice.Balance = MOSESInvoice.InvoiceAmount;
QBOinvoice.BalanceSpecified = true;
QBOinvoice.TotalAmt = MOSESInvoice.InvoiceAmount;
QBOinvoice.TotalAmtSpecified = true;
// Create Sales Line Item
Line invoiceline = new Line();
invoiceline.Id = "1";
//invoiceline.LineNum = "1";
invoiceline.Description = servloc.StreetAddress.ToString() + " :: " + MOSESInvoice.ServiceDescription;
//invoiceline.Description = servloc.StreetAddress.ToString() + " :: " + servdef.ServiceDefinitionName.ToString(); // This maps to Sales Definition Name & Street Address.
invoiceline.Amount = Convert.ToDecimal(MOSESInvoice.InvoiceAmount);
invoiceline.AmountSpecified = true;
invoiceline.DetailType = LineDetailTypeEnum.SalesItemLineDetail;
invoiceline.DetailTypeSpecified = true;
SalesItemLineDetail slidetails = new SalesItemLineDetail();
slidetails.ItemRef = new ReferenceType() { name = "B2C - Every 1 Week" }; // Product/Service column on Line Item Detail. 1 = Services. 2 = Hours.
slidetails.ServiceDate = serviceRecord.ServiceDate ?? DateTime.Parse("01/01/1900");
invoiceline.AnyIntuitObject = slidetails;
QBOinvoice.Line = new Line[] { invoiceline };
Invoice resultInvoice = serviceme.Add(QBOinvoice) as Invoice;
db.SaveChanges();
return QBOinvoice;

I figured out what the problem was. I was passing a SalesItemLineDetail value that did not exist in my QBO company. So fail on my part for not sending the correct value. But...
The API simply and quietly changed the invoice balance and total amounts, then accepted the new invoice.
It seems to me that the QBO API should have blocked the action, issued a warning, or not overridden the invoice balance and total amount as provided.
I logged a support ticket with Intuit and provided this issue and resolution.

Related

Not able to set SalesItemLineDetail tax code in Intuit quickbooks api C#

I am trying to add Tax Code for SalesItemLineDetail inside Invoice of Quickbooks online api, but it is not setting tax code correctly when checking it in Online Quickbooks.
Here is my C# Code, which I am using to create Line Item
Line = new Intuit.Ipp.Data.Line();
InvoiceLine = new Intuit.Ipp.Data.SalesItemLineDetail();
InvoiceLine.ItemRef = new Intuit.Ipp.Data.ReferenceType
{
Value = GetItem.Id, // this is inventory Item Id
name = GetItem.Name // inventory item name
};
Line.DetailTypeSpecified = true;
Line.DetailType = Intuit.Ipp.Data.LineDetailTypeEnum.SalesItemLineDetail;
Line.Description = inv.Description;
Line.Amount = (inv.Price == null || inv.Price == 0.0) ? (decimal)0.00 : (decimal)inv.Price;
Line.AmountSpecified = true;
InvoiceLine.Qty = decimal.Parse(inv.Quantity.Value.ToString());
InvoiceLine.QtySpecified = true;
InvoiceLine.AnyIntuitObject = (inv.Price == null || inv.Price == 0.0) ? (decimal)0.00 : (decimal)(Math.Round(inv.Price.Value, 2) / inv.Quantity.Value);
InvoiceLine.ItemElementName = Intuit.Ipp.Data.ItemChoiceType.UnitPrice;
// this line is not settings tax code properly
InvoiceLine.TaxCodeRef = new Intuit.Ipp.Data.ReferenceType
{
name = taxName,
Value = TaxId
};
//Line Sales Item Line Detail - ServiceDate
InvoiceLine.ServiceDate = DateTime.Now.Date;
InvoiceLine.ServiceDateSpecified = true;
//Assign Sales Item Line Detail to Line Item
Line.AnyIntuitObject = InvoiceLine;
lines.Add(Line);
Intuit.Ipp.Data.Invoice invoice = new Intuit.Ipp.Data.Invoice();
// SalesOrder is a database table object, and OrderNumber is auto generated number
invoice.DocNumber = SalesOrder.OrderNumber.ToString();
//TxnDate
invoice.TxnDate = DateTime.Now.Date;
invoice.TxnDateSpecified = true;
invoice.CustomerRef = new Intuit.Ipp.Data.ReferenceType
{
Value = CompanyId
};
//convert list to array for Intuit Line
invoice.Line = lines.ToArray();
//TxnTaxDetail
Intuit.Ipp.Data.Line taxLine = new Intuit.Ipp.Data.Line();
Intuit.Ipp.Data.TxnTaxDetail txnTaxDetail = new Intuit.Ipp.Data.TxnTaxDetail();
Intuit.Ipp.Data.TaxLineDetail taxLineDetail = new Intuit.Ipp.Data.TaxLineDetail(); ;
//txnTaxDetail.TotalTaxSpecified = true;
//txnTaxDetail.TotalTax = decimal.Parse("2");
var MainTaxValue = "";
txnTaxDetail.TxnTaxCodeRef = new Intuit.Ipp.Data.ReferenceType()
{
Value = TaxId,
name = SalesOrder.TaxCode.TaxCodeName
};
foreach (var TAXName in TaxObject.TaxRateDetail)
{
if(TAXName.TaxRateRef.name.Contains(SalesOrder.TaxCode.TaxCodeName))
{
MainTaxValue = TAXName.TaxRateRef.value;
}
}
taxLineDetail.TaxRateRef = new Intuit.Ipp.Data.ReferenceType
{
Value = MainTaxValue
};
taxLine.AnyIntuitObject = taxLineDetail;
txnTaxDetail.TaxLine = new Intuit.Ipp.Data.Line[] { taxLine };
//DueDate
invoice.DueDate = SalesOrder.InvoiceDueDate != null ? SalesOrder.InvoiceDueDate.Value : DateTime.Now.AddDays(30).Date;
invoice.DueDateSpecified = true;
invoice.TxnTaxDetail = txnTaxDetail;
I have tried these reference links, but it is not working for me
https://gist.github.com/IntuitDeveloperRelations/6500373
How to export Line items with Tax Code and Value in QBO Canada
https://developer.intuit.com/app/developer/qbo/docs/develop/tutorials/manage-sales-tax-for-non-us-locales
Using above links, I can see we can create Tax Code ref using this line of code, for Each Invoice Line item, but it is not setting value correctly.
InvoiceLine.TaxCodeRef = new Intuit.Ipp.Data.ReferenceType
{
name = taxName,
Value = TaxId
};
But it is not working.
Note: this is non-US company, so I have to specify tax code ref for each Invoice Line.
Edit 1:
Attaching Image of Postman API request, which I sent to Quickbooks for creating invoice.
try by removing the name field I think it might not be required
InvoiceLine.TaxCodeRef = new Intuit.Ipp.Data.ReferenceType()
{
Value = TaxId
};
The main difference between our versions is that I let QB calculate the tax.
I commented out the Tax detail line, and told QB that tax amount wasn't included.
// //TxnTaxDetail
// TxnTaxDetail txnTaxDetail = new TxnTaxDetail();
// Line taxLine = new Line();
// taxLine.DetailType = LineDetailTypeEnum.TaxLineDetail;
// TaxLineDetail taxLineDetail = new TaxLineDetail();
// taxLineDetail.TaxRateRef = stateTaxCode.SalesTaxRateList.TaxRateDetail[0].TaxRateRef;
// txnTaxDetail.TxnTaxCodeRef = new ReferenceType
// {
// name = stateTaxCode.Name,
// Value = stateTaxCode.Id
// };
// if (customer.DefaultTaxCodeRef != null)
// {
// txnTaxDetail.TxnTaxCodeRef = customer.DefaultTaxCodeRef;
// taxLineDetail.TaxRateRef = customer.DefaultTaxCodeRef;
// }
// //Assigning the first Tax Rate in this Tax Code
// taxLine.AnyIntuitObject = taxLineDetail;
// txnTaxDetail.TaxLine = new[] { taxLine };
// invoice.TxnTaxDetail = txnTaxDetail;
invoice.GlobalTaxCalculationSpecified = true;
invoice.GlobalTaxCalculation = GlobalTaxCalculationEnum.TaxExcluded;
Here is my code for doing this, and it definitely works. I can't see a difference between the two though.This calculates VAT in Europe and puts in the Tax Code.
Hope this helps.
var invlines = new List<Line>();
foreach (var lineitem in inv.Lines)
{
//Line
Line invoiceLine = new Line();
//Line Description
invoiceLine.Description = (((lineitem.PublicationName == "N/A" || lineitem.PublicationName == "-") ? "" : lineitem.PublicationName) + " " + lineitem.Description).Trim();
//Line Detail Type
invoiceLine.DetailType = LineDetailTypeEnum.SalesItemLineDetail;
invoiceLine.DetailTypeSpecified = true;
//Line Sales Item Line Detail
SalesItemLineDetail lineSalesItemLineDetail = new SalesItemLineDetail();
//Line Sales Item Line Detail - ItemRef
if (!string.IsNullOrEmpty(lineitem.ItemCode))
{
lineSalesItemLineDetail.ItemRef = new ReferenceType()
{
Value = lineitem.ItemCode
};
}
else if (item != null)
{
lineSalesItemLineDetail.ItemRef = new ReferenceType
{
name = item.Name,
Value = item.Id
};
}
//Line Sales Item Line Detail - UnitPrice
//Line Sales Item Line Detail - Qty
lineSalesItemLineDetail.Qty = 1;
lineSalesItemLineDetail.QtySpecified = true;
if (inv.DiscountPercent > 0)
{
invoiceLine.Amount = (decimal)lineitem.PriceBeforeDiscount;
invoiceLine.AmountSpecified = true;
lineSalesItemLineDetail.ItemElementName = ItemChoiceType.UnitPrice;
}
else
{
invoiceLine.Amount = (decimal)lineitem.Price;
invoiceLine.AmountSpecified = true;
lineSalesItemLineDetail.AnyIntuitObject = lineitem.Price;
lineSalesItemLineDetail.ItemElementName = ItemChoiceType.UnitPrice;
}
//Line Sales Item Line Detail - TaxCodeRef
//For US companies, this can be 'TAX' or 'NON'
var taxref = lineitem.TaxAmount == null || lineitem.TaxAmount == 0 ? nonvatid.ToString() : vatid.ToString();
if (country == "US")
{
taxref = lineitem.TaxAmount == null || lineitem.TaxAmount == 0 ? "NON" : "TAX";
}
lineSalesItemLineDetail.TaxCodeRef = new ReferenceType
{
Value = taxref
};
//Line Sales Item Line Detail - ServiceDate
lineSalesItemLineDetail.ServiceDate = DateTimeService.Now.Date;
lineSalesItemLineDetail.ServiceDateSpecified = true;
//Assign Sales Item Line Detail to Line Item
invoiceLine.AnyIntuitObject = lineSalesItemLineDetail;
//Assign Line Item to Invoice
invlines.Add(invoiceLine);
}
if (inv.DiscountPercent > 0)
{
Line invoiceLine = new Line();
DiscountLineDetail discLine = new DiscountLineDetail();
discLine.PercentBased = true;
discLine.DiscountPercent = (decimal)inv.DiscountPercent;
discLine.DiscountPercentSpecified = true;
discLine.PercentBased = true;
discLine.PercentBasedSpecified = true;
invoiceLine.DetailType = LineDetailTypeEnum.DiscountLineDetail;
invoiceLine.DetailTypeSpecified = true;
invoiceLine.AnyIntuitObject = discLine;
invlines.Add(invoiceLine);
invoice.DiscountRate = (decimal) (inv.DiscountPercent);
invoice.DiscountRateSpecified = true;
}
invoice.Line = invlines.ToArray();
Finally was able to find the correct solution.
My Above code is right, there is no issue in it and #sheavens code is also right.
Actual problem was, I was assigning "default Tax code" to a selected company, which we cannot override while passing tax code reference in Invoice Line item.
To Check if there is any default code for company, navigate to Companies list in quickbooks online website , Select your desired Company from the list, click "Edit", then in the "Tax Info" tab, uncheck "Assign Default tax code" to pass tax code using Invoice Line item.
Hope this helps other developers, with same problem.

How to set lookup field with id of a user record just created?

I am getting error - no service provision, someone with experience please help me.
var clinic = new new_clinic();
clinic.new_name = "Medinet";
Account trust = new Account();
trust.Name = "bIRMINGHAM CITY hOSPITAL";
Guid trustID = (Guid)Service().Create(trust);
CrmEntityReference clinic_trust = new CrmEntityReference(trust.LogicalName, trustID);
clinic.new_Trust = clinic_trust;
clinic.new_ClinicDate = DateTime.Now;
new_hospital hospital = new new_hospital();
hospital.new_name = "Geek-guru";
Service().Create(hospital);
Guid hospitalID = (Guid)hospital.Id;
clinic.new_HostingHospital = new CrmEntityReference(hospital.LogicalName, hospitalID);
clinic.new_ClinicDate = new DateTime(2018, 07, 28);
new_serviceprovision ser_contract = new new_serviceprovision();
ser_contract.new_Trust = clinic_trust;
ser_contract.new_Specialty = new OptionSetValue(100000018);
Service().Create(ser_contract);
Guid ser_con_id = (Guid)ser_contract.Id;
clinic.new_ServiceContract = new CrmEntityReference(ser_contract.LogicalName, ser_con_id);
// Account account = (Account)GetOrgService().Retrieve(trust.LogicalName, trustID, new Microsoft.Xrm.Sdk.Query.ColumnSet("name"));
//retreive the default business unit needed to create the user
QueryExpression businessUnitQuery = new QueryExpression
{
EntityName = BusinessUnit.EntityLogicalName,
ColumnSet = new ColumnSet("businessunitid"),
Criteria = { Conditions = { new ConditionExpression("parentbusinessunitid", ConditionOperator.Null) } }
};
BusinessUnit businessUnit = Service().RetrieveMultiple(businessUnitQuery).Entities[0].ToEntity<BusinessUnit>();
//creating a user
SystemUser systemUser = new SystemUser();
systemUser.DomainName = "" + "Chika";
systemUser.FirstName = "Olabajo";
systemUser.LastName = "Boss";
systemUser.InternalEMailAddress = "onyebuchi#gmail.com";
systemUser.BusinessUnitId = new EntityReference(BusinessUnit.EntityLogicalName, businessUnit.Id);
Guid systemID = (Guid)Service().Create(systemUser);
// systemUser = (SystemUser)Service().Retrieve(systemUser.LogicalName, systemID, new Microsoft.Xrm.Sdk.Query.ColumnSet("fullname"));
//this field is a lookup field to User. Assigned to the user created above
clinic.new_ClinicCoordinator = new CrmEntityReference(systemUser.LogicalName, systemID);
clinic.new_BookedBy = new OptionSetValue(100000001);
clinic.new_Type1 = new OptionSetValue(100000008);
clinic.new_Type2 = new OptionSetValue(100000001);
clinic.new_NumberofConsultants = 5;
clinic.new_NumberofNursesSuppliedByTrust = 6;
Service().Create(clinic);//getting error here
MessageBox.Show("Sucessfully added a clinic record");
I have been on these for weeks now, I would appreciate a little bit of help.
I am now having "no serviceprivison issue", A user has now been created, but still gettting error.
Go step by step. You have 3 things one after other like Creating user, Retrieving FullName column, then updating clinic.new_ClinicCoordinator field. Comment out the 2 steps & verify if user is getting created or not, if created successfully then retrieve next (this is not needed as you already have systemID which is needed for update)
Use try catch for better exception handling in code
Edit: CRM online interactive user cannot be created in code. Read more
Update:
Merge the below lines, as ser_contract object is not updated back with created Guid. Do the same for hospitalID as well.
Service().Create(ser_contract);
Guid ser_con_id = (Guid)ser_contract.Id;
This should be working:
Guid ser_con_id = Service().Create(ser_contract);

TimeActivity with .NET API v3 SDK

I can't get a time activity to save with the latest version of the .NET SDK and Quickbooks Online. I think it's the Employee Reference, but I just can't sort it out. Does the API even work right?
DataService commonService = new DataService(serviceContext);
string displayName = "Test Customer";
displayName = displayName.Replace("'", "\\'"); //Escape special characters
QueryService<Customer> customerQueryServiceXX = new QueryService<Customer>(serviceContext);
Customer resultCustomer = customerQueryServiceXX.Where(m => m.DisplayName == displayName).FirstOrDefault();
string employeeName = "First Last";
employeeName = employeeName.Replace("'", "\\'"); //Escape special characters
QueryService<Employee> customerQueryServiceEE = new QueryService<Employee>(serviceContext);
Employee resultEmployee = customerQueryServiceEE.Where(m => m.DisplayName == employeeName).FirstOrDefault();
string sfasdfasdfasdf = resultEmployee.FamilyName;
TimeActivity timeActivity = new TimeActivity();
timeActivity.BillableStatus = BillableStatusEnum.Billable;
timeActivity.BillableStatusSpecified = true;
timeActivity.Hours = 8;
timeActivity.Minutes = 0;
timeActivity.TxnDate = DateTime.Now.Date;
timeActivity.TxnDateSpecified = true;
//timeActivity.HourlyRate = new decimal(200);
//timeActivity.HourlyRateSpecified = true;
timeActivity.NameOf = TimeActivityTypeEnum.Employee;
timeActivity.NameOfSpecified = true;
timeActivity.CustomerRef = new ReferenceType()
{
name = resultCustomer.DisplayName,
Value = resultCustomer.Id
};
timeActivity.ItemRef = new ReferenceType()
{
name = resultEmployee.DisplayName,
Value = resultEmployee.Id,
};
timeActivity.Description = "Did something";
TimeActivity timeActivityResult = commonService.Add(timeActivity);
ItemRef is for providing service Items. Please use timeActivity.AnyIntuitObject for specifying vendor or employee
timeActivity.NameOf = TimeActivityTypeEnum.Employee;
timeActivity.NameOfSpecified = true;
timeActivity.ItemElementName = ItemChoiceType5.EmployeeRef;
timeActivity.AnyIntuitObject= new ReferenceType()
{
name = resultEmployee.DisplayName,
Value = resultEmployee.Id,
};

Using eBay SDK API: internationalShippingOptions.ShipToLocation.Add("Worldwide"); causes:"Object reference not set to an instance of an object"

My goal here so to make the listing say "Free International Shipping". Trying to set up international options and it said I need to set ShipToLocation I tried the line below:
internationalShippingOptions.ShipToLocation.Add("Worldwide");
But when the program hits it I get this error:
"Object reference not set to an instance of an object"
If you would like to see the full method it is:
static ShippingDetailsType BuildShippingDetails()
{
ShippingDetailsType sd = new ShippingDetailsType();
sd.ApplyShippingDiscount = false;
sd.ShippingType = ShippingTypeCodeType.Flat;
AmountType amount = new AmountType();
amount.Value = 0;
amount.currencyID = CurrencyCodeType.USD;
ShippingServiceOptionsTypeCollection shippingOptions = new ShippingServiceOptionsTypeCollection();
ShippingServiceOptionsType domesticShippingOptions = new ShippingServiceOptionsType();
domesticShippingOptions.ShippingService = ShippingServiceCodeType.EconomyShippingFromOutsideUS.ToString();
domesticShippingOptions.FreeShipping = true;
domesticShippingOptions.ShippingServiceCost = amount;
domesticShippingOptions.ShippingServicePriority = 1;
shippingOptions.Add(domesticShippingOptions);
ShippingServiceOptionsType internationalShippingOptions = new ShippingServiceOptionsType();
InternationalShippingServiceOptionsType internationalShippingOptions = new InternationalShippingServiceOptionsType();
internationalShippingOptions.ShippingService = ShippingServiceCodeType.StandardInternational.ToString();
internationalShippingOptions.ShipToLocation.Add("Worldwide");
internationalShippingOptions.FreeShipping = true;
sd.InternationalShippingServiceOption = new InternationalShippingServiceOptionsTypeCollection(new InternationalShippingServiceOptionsType[] { internationalShippingOptions });
sd.ShippingServiceOptions = shippingOptions;
return sd;
}
Here is the code to make it say "Free Standard Intl Shipping". At first in the sandbox it says "Free Standard Shipping" but if you change the shipping destination in the sandbox it will say "Free Standard Intl Shipping".
static ShippingDetailsType BuildShippingDetails()
{
// Shipping details
ShippingDetailsType sd = new ShippingDetailsType();
sd.ApplyShippingDiscount = true;
sd.PaymentInstructions = "eBay .Net SDK test instruction.";
sd.ShippingRateType = ShippingRateTypeCodeType.StandardList;
// Shipping type and shipping service options
//adding international shipping
InternationalShippingServiceOptionsType internationalShipping1 = new InternationalShippingServiceOptionsType();
internationalShipping1.ShippingService = ShippingServiceCodeType.StandardInternational.ToString();
internationalShipping1.ShippingServiceCost = new AmountType { Value = 0, currencyID = CurrencyCodeType.USD };
internationalShipping1.ShippingServicePriority = 1;
internationalShipping1.ShipToLocation = new StringCollection(new[] { "Worldwide" });
sd.ShippingServiceUsed = ShippingServiceCodeType.StandardInternational.ToString();
sd.InternationalShippingServiceOption = new InternationalShippingServiceOptionsTypeCollection(new[] { internationalShipping1 });
//adding domestic shipping
ShippingServiceOptionsType domesticShipping1 = new ShippingServiceOptionsType();
domesticShipping1.ShippingService = ShippingServiceCodeType.ShippingMethodStandard.ToString();
domesticShipping1.ShippingServiceCost = new AmountType { Value = 0, currencyID = CurrencyCodeType.USD };
domesticShipping1.ShippingInsuranceCost = new AmountType { Value = 0, currencyID = CurrencyCodeType.USD };
domesticShipping1.ShippingServicePriority = 4;
domesticShipping1.LocalPickup = true;
domesticShipping1.FreeShipping = true;
sd.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection(new[] { domesticShipping1 });
sd.ShippingType = ShippingTypeCodeType.Flat;
return sd;
To call the method:
item.ShippingDetails = BuildShippingDetails();

eBay API AddItem call on India site returns 'Sales Tax / VAT was dropped from the listing' error

I am totally new to any sort of API application. Right now I am creating a listing application to list items on E-bay India site.
API version being used is 767,
sandbox url is https://api.sandbox.ebay.com/wsapi.
I have sandbox account for ebay(buyer/seller) and developer account.
I am getting error saying:
1) Sales Tax / VAT was dropped from the listing as per new sales tax / VAT policy. The items will be listed successfully, you may revise the listing to specify all inclusive price.
2) You have either not registered or are having problem with your payment method registration.
ItemType type = new ItemType();
type.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection();
type.PaymentMethods.Add(BuyerPaymentMethodCodeType.PaisaPayAccepted);
Also do I have to specify taxation for each state?
For VAT and shipping details here's my snippet:
private ShippingDetailsType getShippingDetails()
{
// Shipping details.
ShippingDetailsType sd = new ShippingDetailsType();
SalesTaxType salesTax = new SalesTaxType();
ReadSettings rs = new ReadSettings();
rs.GetSettings();
salesTax.SalesTaxPercent = 12f;
salesTax.SalesTaxState = "MH";
SalesTaxType s = new SalesTaxType();
salesTax.ShippingIncludedInTax = true;
salesTax.ShippingIncludedInTaxSpecified = true;
sd.ApplyShippingDiscount = true;
AmountType at = new AmountType();
at.Value = 2.8;
at.currencyID = CurrencyCodeType.INR;
sd.InsuranceFee = at;
sd.InsuranceOption = InsuranceOptionCodeType.NotOffered;
sd.PaymentInstructions = "These are my instructions.";
VATDetailsType vd = new VATDetailsType();
vd.BusinessSeller = false;
vd.BusinessSellerSpecified = false;
vd.RestrictedToBusiness = false;
vd.RestrictedToBusinessSpecified = false;
vd.VATID = "VATSNO1234567890";
vd.VATPercent = 12f;
vd.VATPercentSpecified = true;
vd.VATSite = "None";
sd.ShippingType = ShippingTypeCodeType.Flat;
//
ShippingServiceOptionsType st1 = new ShippingServiceOptionsType();
sd.SalesTax = salesTax;
st1.ShippingService = ShippingServiceCodeType.IN_Express.ToString();
at = new AmountType();
at.Value = 50;
at.currencyID = CurrencyCodeType.INR;
st1.ShippingServiceAdditionalCost = at;
at = new AmountType();
at.Value = 50;
at.currencyID = CurrencyCodeType.INR;
st1.ShippingServiceCost = at;
st1.ShippingServicePriority = 1;
at = new AmountType();
at.Value = 1.0;
at.currencyID = CurrencyCodeType.INR;
st1.ShippingInsuranceCost = at;
sd.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection(new ShippingServiceOptionsType[] { st1 });
return sd;
}
Thank you for you efforts.
So, from Ebay's .IN site. http://pages.ebay.in/help/sell/new-sales-tax-policy.html
You will need to revise your listing(s) to include the total (all inclusive) price.
Code wise:
// Before you assign the Item's price
allInclusiveItemPrice = itemPrice * VAT; // Sales tax also if needed
Then set the item.price = allInclusiveItemPrice //BuyItNowPrice or Auction price
I'm not sure how setting taxation rates for India would work in general.
Also
2) You have either not registered or are having problem with your payment method registration.
Could be a problem. I'm not sure what the error means in this context.

Categories

Resources