Pulling Transactions from my own store without oAuth

512 views
Skip to first unread message

Darrell Hobbs

unread,
Mar 12, 2017, 3:09:02 PM3/12/17
to Etsy API
Can anyone explain to me how this is possible?

Etsy support has told me three times if it's my own store I don't need full access or oAuth,

Clearly in the documentation it is private, and requires oAuth.

getShop_Receipt2

Method NamegetShop_Receipt2
SynopsisRetrieves a Shop_Receipt2 by id.
HTTP MethodGET
URI/receipts/:receipt_id
Parameters
NameRequiredDefaultType
receipt_idY array(int)
Requires OAuthY
Permission Scopetransactions_r

I have read where several people have tried accessing their own store and after following a long thread, they all end with no success.

Obviously I'm getting a 403 not enough permissions or something similar.

Thaks in advance,

Darrell

Darrell Hobbs

unread,
Mar 31, 2017, 10:39:14 AM3/31/17
to Etsy API
Thanks to all of you who have gone OUT OF YOUR way to help me!

I'm finally close.

I'll remember that when you might need some of my expertise!

theclothin...@gmail.com

unread,
Apr 11, 2017, 11:37:04 AM4/11/17
to Etsy API
Hi Darrell:

Would you mind sharing your solutions here?  We'd also be interested in doing something similar.

Thanks!

Darrell Hobbs

unread,
Jul 12, 2017, 4:50:29 PM7/12/17
to Etsy API
Sure.  I was being sarcastic about ALL the people that came to my aid!  NO ONE!

It seems despite Etsy telling you that oAuth is not needed for your own store, they are wrong.

If you see something you want to get at in the API documentation and it says oAUTH Y, then you'll need it.

Since it's my own shop, I just generated a key that gives me FULL access to everything.

Here is how I did it.  Register your app as Sellers App for your own store.  Sign up for a developers account if you haven't.

In a few hours you'll get an email with some important information.  Mainly, your KEYSTRING (API_KEY) and shared SECRET.

I've uploaded test_o.php which I used to generate my oAuth key with all the privileges I needed.

I think it prints it to your browser but what you want to save is 
$oauth_token = $access_token['oauth_token'];
$oauth_token_secret = $access_token['oauth_token_secret'];

I keep that original email and these in a word document.

It works best if you load test_o.php to you web server, close everything down, open chrome and login to your etsy store.  The open a new tab and execute test_o.php.

Now, I won't lie, it wasn't all that easy.  I had to get a 1and1 virtual cloud server ($10/month) so I could be a root user.  That allowed me to install oAuth or anything else I needed.

I'm not a Unix expert but 1and1 support is good.  I imaged the server with CentOS (Linux) and had to yum install xxx a few things but as you dig on google for oAuth you'll find them.

The next file I upload will let you use your saved oAuth credential to retrieve open receipts which kept giving me a 403 Authorization required which is what led me down this path!

Ok.  That's it, getting tired for an old man.  Not guaranteeing perfectly but it's close.

This is my ouput of test_04.php (open receipts)

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
reciept_id: 1207825616 order_id: 516272478 name: Stacy M Stackrow first_line: 5R Perry Lane second_line: city :Dudley state :MA zip :01571
Array
(
    [count] => 2
    [results] => Array
        (
            [0] => Array
                (
                    [receipt_id] => 1207825616
                    [receipt_type] => 0
                    [order_id] => 516272478
                    [seller_user_id] => 107412191
                    [creation_tsz] => 1498847867
                    [last_modified_tsz] => 1498847887
                    [country_id] => 209
                    [payment_method] => cc
                    [payment_email] => 
                    [message_from_seller] => Thanks for visiting Butlertees! 

Don't forget to leave a positive review for a 10% off Coupon Code,

Before you leave a negative review please call.  We'll try our best to make it right!
                    [message_from_buyer] => medium gray please!
                    [was_paid] => 1
                    [total_tax_cost] => 0.00
                    [total_vat_cost] => 0.00
                    [total_price] => 24.00
                    [total_shipping_cost] => 4.16
                    [currency_code] => USD
                    [message_from_payment] => 
                    [was_shipped] => 
                    [discount_amt] => 0.00
                    [subtotal] => 24.00
                    [grandtotal] => 28.16
                    [adjusted_grandtotal] => 28.16
                    [shipping_tracking_code] => 
                    [shipping_tracking_url] => 
                    [shipping_carrier] => 
                    [shipping_note] => 
                    [shipping_notification_date] => 
                    [shipments] => Array
                        (
                        )

                    [has_local_delivery] => 
                    [shipping_details] => Array
                        (
                            [can_mark_as_shipped] => 1
                            [was_shipped] => 
                            [is_future_shipment] => 1
                            [not_shipped_state_display] => Not Shipped
                            [has_upgrade] => 1
                            [upgrade_name] => USPS First Class Package Services
                            [shipping_method] => USPS First Class Package Services
                        )

                    [transparent_price_message] => 
                    [show_channel_badge] => 
                    [channel_badge_suffix_string] => 
                )

            [1] => Array
                (
                    [receipt_id] => 1207681092
                    [receipt_type] => 0
                    [order_id] => 516126220
                    [seller_user_id] => 107412191
                    [creation_tsz] => 1498791906
                    [last_modified_tsz] => 1498791922
                    [country_id] => 209
                    [payment_method] => cc
                    [payment_email] => 
                    [message_from_seller] => Thanks for visiting Butlertees! 

Don't forget to leave a positive review for a 10% off Coupon Code,

Before you leave a negative review please call.  We'll try our best to make it right!
                    [message_from_buyer] => 
                    [was_paid] => 1
                    [total_tax_cost] => 0.00
                    [total_vat_cost] => 0.00
                    [total_price] => 24.00
                    [total_shipping_cost] => 0.00
                    [currency_code] => USD
                    [message_from_payment] => 
                    [was_shipped] => 
                    [discount_amt] => 0.00
                    [subtotal] => 24.00
                    [grandtotal] => 24.00
                    [adjusted_grandtotal] => 24.00
                    [shipping_tracking_code] => 
                    [shipping_tracking_url] => 
                    [shipping_carrier] => 
                    [shipping_note] => 
                    [shipping_notification_date] => 
                    [shipments] => Array
                        (
                        )

                    [has_local_delivery] => 
                    [shipping_details] => Array
                        (
                            [can_mark_as_shipped] => 1
                            [was_shipped] => 
                            [is_future_shipment] => 1
                            [not_shipped_state_display] => Not Shipped
                            [has_upgrade] => 1
                            [upgrade_name] => Free Shipping
                            [shipping_method] => Free Shipping
                        )

                    [transparent_price_message] => 
                    [show_channel_badge] => 
                    [channel_badge_suffix_string] => 
                )

        )

    [params] => Array
        (
            [shop_id] => 14577931
            [status] => open
            [limit] => 25
            [offset] => 0
            [page] => 
        )

    [type] => Receipt
    [pagination] => Array
        (
            [effective_limit] => 25
            [effective_offset] => 0
            [next_offset] => 
            [effective_page] => 1
            [next_page] => 
        )

)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I hope you find more help on this board than I did.  It was dead to me as Kevin O'Leary would say.

Took me 4 months to do something which just a little help would have taken 3 days.

Good Luck!


test_o.php
test_o4.php

Matthew Bennett

unread,
Dec 3, 2018, 4:22:57 PM12/3/18
to Etsy API
Darrell, thank you SO MUCH for this post!  It got me onto the right track for getting my oauth key.  Side note, this is disgustingly overly complicated for users who only want to get data from their own shop.

I had to change the code in a couple of places to get it all to work, for anyone following after me, here are the steps I had to take:

1) Get your developer API

2) In the past you could find your shop ID number easily, however all the methods I tried resulted in errors, wherever ever you see "Shop ID" enter your shop name this worked for me.

3) Get a web-server set up.  For me I used a cheap Raspberry Pi, installed Apache2, the php modules, and the oAuth module.  All of these were obtained using apt-get, the instructions for installing the oath module with percl failed every time for me.

4) Run the generate.php script (this is the modified test_o.php that Darrell created, the only changes I made were to fix changes in the way etsy requires the calls to be made and PHP requires constants to be defined), make sure to replace the variables in the top area of the file with your shop's information! I executed this by making sure to install php-cli with apt-get and then running "php -f generate.php" from the command line (terminal on linux).  This step took me a crazy amount of time because php and oAuth didn't want to play nicely at first, all I can say is keep at it and be patient, google will be your best friend diagnosing error messages that WILL plague you.

5) Once generate.php successfully runs, take the oauth token and oauth secret it displays and place them into the second file "test.php".  If this is done correctly it will show you up to 25 orders that are currently open.
generate.php
test.php
Reply all
Reply to author
Forward
0 new messages