FileMaker tips, techniques, and news.

By Brendan McBride  Posted on  September 13th, 2017  in  FileMaker, Free Downloads

FileMaker Amazon Marketplace Integration

FileMaker Amazon

Amazon is the largest e-commerce site in the world, making brick and mortar stores scramble to catch up online as Amazon continues to grow marketshare. While Amazon only holds a mere 5 percent share of total retail sales, excluding food, across the country according to data from the U.S. Census Bureau, in 2016 Amazon posted revenue of 136 billion dollars compared to 107 billion in 2015, 27% year over year growth. Getting your business set up with Amazon is a great way to promote your products and boost your sales. It is never to late to jump on the sales freight train that is Amazon. We will demonstrate how you can streamline your operation by directly integrating your FileMaker solution with Amazon using Amazon Marketplace Web Service.

Creating a Developer Account

There are a few prerequisites that you will need to meet first before you can continue. You can get all the information you need and more in the Amazon MWS Documentation. If you do not have a seller account, you will need to create one by registering at Amazon Services.

If you have what you need to register as a developer, then you will need to log in and go to your User Permissions page. Click on the Register as a Developer button and follow the instructions. When you finish the process, you will then see your Seller ID (Merchant ID), Marketplace ID, AWS Access Key ID, and Secret Key. These are important for our integration and should be kept safe and secret.

FileMaker Amazon register developer

Amazon MWS Signatures

Once you have your API information, you will need to authenticate your solution with the Amazon MWS API. Amazon requires you to add a signature to all of your requests to authenticate your requests. Please reference the documentation on signing requests. The main goal of the signature is to make sure the signature string matches what the API expects. The signature string is an encrypted combination of all parameters passed in the request in alphabetical order. The authentication process can be quite tricky, so I highly recommend taking a look under the hood of the example file we have provided.

Set Variable [ $sigString ; Value: "GET" & Char (10) & $host & Char (10) & $api & Char (10) & $params ]
Set Variable [ $authCode ; Value: CryptAuthCode ( $sigString ; "SHA256" ; $secretKey ) ]
Set Variable [ $signature ; Value: Base64EncodeRFC ( 4648 ; $authCode ) ]

Making Requests and Parsing the Response

To send a request to the API, you will need to use the Insert from URL script step with FileMaker cURL options.

Set Variable [ $parameters ; Value: "AWSAccessKeyId=XXXX&Action=ListOrders&CreatedAfter=XXXX&MarketplaceId.Id.1=XXXX&SellerId=XXXX&SellerOrderId=XXXXX&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=XXXXX&Version=2013-09-01" ]
Set Variable [ $cURL ; Vaule: "-X POST --data " & $parameters ]
Insert from URL [ Select ; With Dialog: Off ; $result ; $url ; $cURL ; Do not automatically encode URL ]

Once a successful request has been made, an XML-encoded response will be returned. FileMaker does not have a native function for reading XML, so a plugin or a good custom function is needed in order to easily make and read any XML that is sent or received from the API. I suggest using the BaseElements Plugin as it is a free and powerful plugin that can handle all of our XML needs. You will be able to use the function BE_XPath( ) to pull any information out of the response that you wish.

<?xml version="1.0" encoding="UTF-8"?>
<ListOrdersResponse xmlns="https://mws.amazonservices.com/Orders/2013-09-01">
   <ListOrdersResult>
      <Orders>
         <Order>
            <LatestShipDate>2017-08-19T04:48:48Z</LatestShipDate>
            <OrderType>StandardOrder</OrderType>
            <PurchaseDate>2017-09-01T17:06:50Z</PurchaseDate>
            <AmazonOrderId>XXX-XXXXXXX-XXXXXXX</AmazonOrderId>
            <BuyerEmail>XXXXXX@dbservices.com</BuyerEmail>
            <IsReplacementOrder>false</IsReplacementOrder>
            <LastUpdateDate>2017-09-01T05:10:11Z</LastUpdateDate>
            <NumberOfItemsShipped>1</NumberOfItemsShipped>
            <ShipServiceLevel>SecondDay</ShipServiceLevel>
            <OrderStatus>Shipped</OrderStatus>
            <SalesChannel>Amazon.com</SalesChannel>
            <IsBusinessOrder>false</IsBusinessOrder>
            <NumberOfItemsUnshipped>0</NumberOfItemsUnshipped>
            <PaymentMethodDetails>
               <PaymentMethodDetail>Standard</PaymentMethodDetail>
            </PaymentMethodDetails>
            <BuyerName>DB Services</BuyerName>
            <OrderTotal>
               <CurrencyCode>USD</CurrencyCode>
               <Amount>1.00</Amount>
            </OrderTotal>
            <IsPremiumOrder>false</IsPremiumOrder>
            <EarliestShipDate>2017-09-01T04:48:48Z</EarliestShipDate>
            <MarketplaceId>MARKET</MarketplaceId>
            <FulfillmentChannel>AFN</FulfillmentChannel>
            <PaymentMethod>Other</PaymentMethod>
            <ShippingAddress>
               <StateOrRegion>IN</StateOrRegion>
               <City>Indianapolis</City>
               <CountryCode>US</CountryCode>
               <PostalCode>46250</PostalCode>
               <Name>DB Services</Name>
               <AddressLine1>8604 Allisonville Rd</AddressLine1>
            </ShippingAddress>
            <IsPrime>false</IsPrime>
            <ShipmentServiceLevelCategory>SecondDay</ShipmentServiceLevelCategory>
            <SellerOrderId>XXX-XXXXXXX-XXXXXXX</SellerOrderId>
         </Order>
      </Orders>
      <CreatedBefore>2017-08-22T12:42:43Z</CreatedBefore>
   </ListOrdersResult>
   <ResponseMetadata>
      <RequestId>XXXXXXXX-XXXXX-XXXX-XXXX-XXXXXXXXXX</RequestId>
   </ResponseMetadata>
</ListOrdersResponse>

For example, you can get the Amazon Order Id by using the following:

Set Variable [ $n ; Value: 1 ]
Set Variable [ BE_XPath ( $result ; "/ns:ListOrdersResponse/ns:ListOrdersResult/ns:Orders/ns:Order[" & $n & "]/ns:AmazonOrderId" ; "ns=https://mws.amazonservices.com/Orders/2013-09-01") ]

The $n variable is used to get the nth order in the list. In the example provided there is only one order; however, if your result contains multiple orders you will need to change $n to the nth number.

Amazon Feeds: Acknowledging and Shipping an Order

The above example is based on the Order API. That will give you the basic information on your orders. Once you are ready to acknowledge or ship an order, you will need to use the Feeds API. The Feeds API will not automatically process your request and give you the results of your request, so communicating with this API requires two steps:

  • Make request to the Feed API and grab the Feed Submission ID.
  • Continuously query the Feed API with the Feed Submission ID for the results of your original request.

This means that once you have submitted your original request, Amazon will either acknowledge that it received a valid request and give you a request id to watch, or it will respond with an immediate error.

<?xml version="1.0" encoding="UTF-8"?>
<SubmitFeedResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
   <SubmitFeedResult>
      <FeedSubmissionInfo>
         <FeedSubmissionId>50002017409</FeedSubmissionId>
         <FeedType>_POST_ORDER_ACKNOWLEDGEMENT_DATA_</FeedType>
         <SubmittedDate>2017-08-31T11:56:14+00:00</SubmittedDate>
         <FeedProcessingStatus>_SUBMITTED_</FeedProcessingStatus>
      </FeedSubmissionInfo>
   </SubmitFeedResult>
   <ResponseMetadata>
      <RequestId>15e66ef4-6306-4a1b-9712-20d9ee6d9b16</RequestId>
   </ResponseMetadata>
</SubmitFeedResponse>

If you sent a valid request, you will then have to wait and continuously query the Feeds API with your Feed Submission ID. Amazon will then respond with try again, error, or success response.

<?xml version="1.0" encoding="UTF-8"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
    <Header>
        <DocumentVersion>1.02</DocumentVersion>
        <MerchantIdentifier>XXXXXXXXX</MerchantIdentifier>
    </Header>
    <MessageType>ProcessingReport</MessageType>
    <Message>
        <MessageID>1</MessageID>
        <ProcessingReport>
            <DocumentTransactionID>XXXXXXXXX</DocumentTransactionID>
            <StatusCode>Complete</StatusCode>
            <ProcessingSummary>
                <MessagesProcessed>1</MessagesProcessed>
                <MessagesSuccessful>1</MessagesSuccessful>
                <MessagesWithError>0</MessagesWithError>
                <MessagesWithWarning>0</MessagesWithWarning>
            </ProcessingSummary>
        </ProcessingReport>
    </Message>
</AmazonEnvelope>

Conclusion

Following the steps above you can integrate your FileMaker solution with Amazon and streamline your workflow. Feel free to contact us if you need further assistance or to discuss getting your Amazon account integrated with FileMaker.

Did you know we are an authorized reseller for FileMaker Licensing?
Contact us to discuss upgrading your FileMaker software.

Download
Download the FileMaker Amazon Marketplace Integration File
Please complete the form below to download your FREE FileMaker file.
FileMaker Experience *
Terms of Use *
OPT-IN: I agree that I am downloading a completely free FileMaker application file with no strings attached. This file is unlocked, and I may use it for my business or organization as I see fit. Because I am downloading a free file, I agree that I should receive occasional marketing. I understand that I can OPT-OUT of these emails at anytime.
Brendan McBride thumbnail
Brendan McBride

Brendan is a certified FileMaker and web developer and is a very friendly, hard-working, and technically-astute engineer ready to solve any problem you throw at him. Brendan went to Purdue, receiving a Bachelors in Computer Science and minored in Economics.

FileMaker 18 Certified Developer
FileMaker 17 Certified Developer
FileMaker 16 Certified Developer
FileMaker 15 Certified Developer
FileMaker 14 Certified Developer
FileMaker 13 Certified Developer
FileMaker 12 Certified Developer
FileMaker 11 Certified Developer
"We were actually able to add more features than we thought would be possible within our budget. We always experienced a ‘can do’ attitude and DB Services was incredibly patient and easy to work with."
Courtney Hartman
Art Director
"The new FileMaker custom website interface is very user-friendly and easy to follow for our clients. In addition, it is much faster than the old Instant Web Publishing (IWP) interface. Thank you and all the others who have helped us out at DB Services. I am very grateful for the excellent service you provide us. Its nice to know we can call you for help if we have an issue."
Wayne Capek
President
"We needed a solution that would simplify the administration of our responsibilities under our contract with the State of Indiana. We have seen a dramatic increase across the state in the number of potential foster and adoptive parents that have begun the preparation and training process. This increase has resulted in a significant opportunity for children available for adoption. That’s a big win for everyone! And it’s all because we can refer potential parents to the proper state contacts efficiently and quickly."
Chris Morrison
Executive Director
"Thank you for all of your expertise and valuable help. I am so grateful to have found DB Services."
Linda Findlay
Owner
"Thank you for our new database system. We transitioned from a carbon copy paper based system to a digital database. The software has saved us time and money. We used to archive all our jobs in cabinets, now we can look up a job in seconds from anywhere. The software allows us to easily email estimates to our customers in pdf format. In a year there was a return on investment just from eliminating the purchasing of our carbon forms."
Todd Cartmel
Owner
"The new system allows us to create and track jobs for customers along with inventory, something we had been doing with separate word and spreadsheet files. Because it’s now so intuitive, new staff members are able to begin using the database immediately without our usual training session and ‘cheat sheets’ for getting around within the file."
Tom Andrews
President