QuickBooks IPP Rest API 3.0 CustomerRef in Invoice - api

When I use the IPP Rest API 3.0 to create a invoice, a example like this:
<Invoice xmlns="http://schema.intuit.com/finance/v3">
<Line>
<Description>Installation labor</Description>
<Amount>420.00</Amount>
<DetailType>SalesItemLineDetail</DetailType>
<SalesItemLineDetail>
<ItemRef>33</ItemRef>
</SalesItemLineDetail>
</Line>
<CustomerRef>20</CustomerRef>
</Invoice>
In this example, 20 is the Id of this customer.
Now, for a third party program, it might not know the Id of this customer, might know the Name of the customer, so , I understand I can always query the customer to get the Id back first, then use that Id in this invoice creating format.
But my question is, can I just use the name without specify the Id of this customer to create this invoice?
Will the following works?
<Invoice xmlns="http://schema.intuit.com/finance/v3">
<Line>
<Description>Installation labor</Description>
<Amount>420.00</Amount>
<DetailType>SalesItemLineDetail</DetailType>
<SalesItemLineDetail>
<ItemRef>33</ItemRef>
</SalesItemLineDetail>
</Line>
<CustomerRef name="ACB Company"></CustomerRef>
</Invoice>
Further more, If it DOES work, does this logic apply to all the ReferenceType in the API?

No. In API payload, you can't refer objects by name ( this behavior was partially supported in old V2 API which is now deprecated ).
You can verify this behavior using Apiexplorer.
https://developer.intuit.com/apiexplorer?apiname=V3QBO
In this case, you should query the customer by name and then extract the ID to refer it in the invoice create payload.
Thanks

Related

Mybatis: How can I get the first element from the passed parameter?

Given that my parameterType is an ArrayList, is it possible to get the first element from that list and use it in the where clause ?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="db">
<select id="selectFlag" resultType="java.lang.Boolean" parameterType="java.util.ArrayList">
select TOP 1 'true' from customers where id = ???
</select>
</mapper>
If your query uses one id, why are you sending a list and then picking the first one for the query?
Change your parameterType to an int (or whatever type the id has), don't send a list. This is a simple approach that also conveys the information that you are only retrieving data based on a single id. Your condition then changes to something like:
where id = #{id}
If you must absolutely send an ArrayList (for whatever reason) then MyBatis supports OGNL expressions so something like this should work:
where id = #{list[0]}
Unfortunately MyBatis lacks on the documentation side, so you can find out about things like this only by looking at the source code.

eBay API call AddItem using item's UPC code

I want to add products using AddItem API call in eBay with UPC code. I have searched about it, but did not get any specific answer. I want to ask what will be the UPC code for item that will be added in to the eBay list.
Please help me.
Thanks & Regards
This is an old question, and surely you have moved on. But surprisingly no other related examples here on stackoverflow or at developer.ebay.com were to be found when I ran into a similar need with the eBay API AddFixedPriceItem (almost exactly identical to AddItem but aimed at non-auction listings). Here is the XML request structure that worked for me in POSTing to this API for UPC or ISBN coded products illustrated using the Verify version of the API:
<?xml version="1.0" encoding="utf-8"?>
<VerifyAddFixedPriceItemRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>YOUR TOKEN STRING HERE</eBayAuthToken>
</RequesterCredentials>
<Item>
<AutoPay>false</AutoPay>
<Country>US</Country>
<Currency>USD</Currency>
<ListingType>FixedPriceItem</ListingType>
<ListingDuration>Days_30</ListingDuration>
<PaymentMethods>PayPal</PaymentMethods>
<PaymentMethods>VisaMC</PaymentMethods>
<PayPalEmailAddress>SELLER PAYPAL EMAIL ADDR HERE</PayPalEmailAddress>
<ProductListingDetails>
<UPC>BARCODE HERE</UPC>
<EAN>Does not apply</EAN>
<ListIfNoProduct>true</ListIfNoProduct>
<UseStockPhotoURLAsGallery>true</UseStockPhotoURLAsGallery>
</ProductListingDetails>
<ShippingDetails>
<ShippingServiceOptions>
<ShippingService>USPSFirstClass</ShippingService>
<ShippingServiceCost currencyID="USD">3.00</ShippingServiceCost>
<ShippingServiceAdditionalCost>1.00</ShippingServiceAdditionalCost>
<ShippingServicePriority>1</ShippingServicePriority>
<ShippingService>USPSPriority</ShippingService>
<ShippingServiceCost currencyID="USD">5.00</ShippingServiceCost>
<ShippingServiceAdditionalCost>2.00</ShippingServiceAdditionalCost>
<ShippingServicePriority>2</ShippingServicePriority>
</ShippingServiceOptions>
<ShippingType>Flat</ShippingType>
</ShippingDetails>
<ShipToLocations>US</ShipToLocations>
<Quantity>1</Quantity>
<Site>US</Site>
<StartPrice currencyID="USD">1.99</StartPrice>
<Title>YOUR GREAT ITEM TITLE</Title>
<Location>CITY,STATE HERE</Location>
<PictureDetails>
<GalleryType>Gallery</GalleryType>
</PictureDetails>
<DispatchTimeMax>3</DispatchTimeMax>
<ReturnPolicy>
<RefundOption>MoneyBack</RefundOption>
<Refund>Money Back</Refund>
<ReturnsWithinOption>Days_30</ReturnsWithinOption>
<ReturnsWithin>30 Days</ReturnsWithin>
<ReturnsAcceptedOption>ReturnsAccepted</ReturnsAcceptedOption>
<ReturnsAccepted>Returns Accepted</ReturnsAccepted>
<ShippingCostPaidByOption>Buyer</ShippingCostPaidByOption>
<ShippingCostPaidBy>Buyer</ShippingCostPaidBy>
</ReturnPolicy>
<ConditionID>EBAY CONDITION CODE</ConditionID>
<ConditionDisplayName>EBAY CONDITION DISPLAY TEXT</ConditionDisplayName>
</Item>
<ErrorLanguage>en_US</ErrorLanguage>
<WarningLevel>Low</WarningLevel>
</VerifyAddFixedPriceItemRequest>
This is the VerifyAddFixedPriceItem call, which again is very very similar to the VerifyAddItem API. You can use the Verify version of either to check out that the request will be OK once debugged (just don't trust the fees either of them report even in production). The AddFixedPriceItem API adds the item to eBay using the UPC code only, via the eBay product catalog content. You can replace <UPC> and </UPC> with <ISBN> and </ISBN> for books as well. You could use this as an XML template for the VerifyAddItem and AddItem APIs as well.
Text in CAPS needs to be customized, the shipping prices are just random for illustration. I ran this using eBay Trading API version 1001 (as of this posting date you can ignore the warnings about no seller profile being in place). Also you can find the eBay condition codes and name text here: eBay Condition ID Values and Names
Hope this helps you or someone else that comes along with a similar need.

eBay API call RelistFixedPriceItem doesn't accept a ListingType of "FixedPriceItem"

I am trying to use the eBay API call RelistFixedPriceItem relist an item as fixed price which has been listed as an auction before.
The "interesting part" of my XML request looks like this:
<RelistFixedPriceItemRequest>
<Item>
<ListingType>
FixedPriceItem
</ListingType>
</Item>
</RelistFixedPriceItemRequest>
But still, eBay responds that I can't use the ListingType I used ("FixedPriceItem") but should use "FixedPriceItem" (the same) instead:
<RelistFixedPriceItemResponse xmlns="urn:ebay:apis:eBLBaseComponents">
<Timestamp>2013-06-21T14:14:52.951Z</Timestamp>
<Ack>Failure</Ack>
<Errors>
<ShortMessage>Unsupported ListingType.</ShortMessage>
<LongMessage>Valid Listing type for fixedprice apis are FixedPriceItem and StoresFixedPrice.</LongMessage>
<ErrorCode>21916286</ErrorCode>
<SeverityCode>Error</SeverityCode>
<ErrorClassification>RequestError</ErrorClassification>
</Errors>
<Version>827</Version>
<Build>E827_UNI_API5_16161102_R1</Build>
</RelistFixedPriceItemResponse>
Has anyone run into this issue - or found a workaround?
Nothing in their API documentation states that this shouldn't be possible. It certainly is on ebay.com where you can change the listing type when you relist an item.
Well, If you look at their API documentation's Sample XML, you would notice that they do not use
<ListingType>
FixedPriceItem
</ListingType>
That suggests to me that, when you use the RelistFixedPriceItem call you do not have to specify the Listing Type to be FixedPriceItem
I do agree that it is a confusing error.

Is it possible to send an invoice number with an authorize.net refund request?

Is it possible to send the invoiceNumber field in an AIM XML refund request with Authorize.Net? I try some variations on how to do it based on the documentation, and I get errors like:
The element 'transactionRequest' in namespace
'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element
'invoiceNumber' in namespace
'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements
expected: 'authCode, refTransId, splitTenderId, order, lineItems, tax,
duty, shipping, taxExempt, poNumber, customer, billTo, shipTo,
customerIP, cardholderAuthentication, retail, transactionSettings,
userFields' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'
The reason I ask is because I'd like to have my refunds tie back to their original transaction for reporting reasons. That way, I can search on an invoice number and find where the purchase record came in, along with each refund record, all of which would share the same invoice number. As is now, the Authorize.Net system shows me no way to match a given customer's original purchase with their refund.
Sorry for responding to an old post, but the above answer is not correct.
To have the invoice number associate with the transaction and appear in your Auth.net transaction logs, include the following bit of XML:
<order><invoiceNumber>123456</invoiceNumber></order>
See the schema https://api.authorize.net/xml/v1/schema/AnetApiSchema.xsd within <xs:complexType name="transactionRequestType"> to view the necessary order (because order does matter).
In the above example, it would go here:
<?xml version="1.0"?>
<createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>yourloginid</name>
<transactionKey>yourtransactionkey</transactionKey>
</merchantAuthentication>
<refId>15444549</refId>
<transactionRequest>
<transactionType>refundTransaction</transactionType>
<amount>5</amount>
<payment>
<creditCard>
<cardNumber>XXXX1111</cardNumber>
<expirationDate>122016</expirationDate>
</creditCard>
</payment>
<authCode>2165668159</authCode>
<order>
<invoiceNumber>123456</invoiceNumber>
</order>
</transactionRequest>
</createTransactionRequest>

Shopify: Is it possible to find a product by sku number?

The data that I'm getting only contains the SKU numbers. I am trying to figure out how I can link these SKU numbers to the product variants in Shopify without the actual product id number.
Example data:
<Inventory ItemNumber="100B3001-B-01">
<ItemStatus Status="Avail" Quantity="0" />
</Inventory>
<Inventory ItemNumber="100B3001-B-02">
<ItemStatus Status="Avail" Quantity="0" />
</Inventory>
<Inventory ItemNumber="100B3001-B-03">
<ItemStatus Status="Avail" Quantity="-1" />
<ItemStatus Status="Alloc" Quantity="1" />
</Inventory>
<Inventory ItemNumber="100B3001-B-04">
<ItemStatus Status="Avail" Quantity="-1" />
<ItemStatus Status="Alloc" Quantity="1" />
</Inventory>
Here's a delightful, condescending discussion from Shopify employees in 2011 asking why you can't just store the Shopify ID everywhere. The "stock-keeping unit" is a universal systems integration point and, in every system I've seen, each SKU uniquely maps to a product because words have meaning, but apparently not at Shopify.
Three years later, you seem to have two options.
One is to create a Fulfillment Service and provide a URL where Shopify will call you asking for stock levels on a SKU; this is probably the simplest solution, provided you have a Web server sitting somewhere where you can expose such a callback.
The second is to periodically page through all of the Products and store a mapping of the Shopify ID to a SKU somewhere, consulting your map when you need to do an update. Because most of our integrations are cron jobs and I'd like to keep them that way, I periodically ask for the products that have changed since the last run, and then update my mapping.
As David Lazar points out in his comment, the ability to find a product based on its SKU is not currently supported in the Shopify API.
EDIT: This is an unreliable option that I once used as a last resort. I wouldn't recommend using this but I will leave it here in case as someone may find it helpful.
You can use this API endpoint:
/admin/products/search.json?query=sku:abc123
I have only used it in the browser though, and I can't find any documentation for it. And it may stop working at any time.
You can use
*.myshopify.com/search?view=json&q=sku:SKUID
Graph query on Shopify works for me: