{"_id":"55fdb38856d6990d00a6cacc","category":{"_id":"55fdb08c4bebdf17004130d4","project":"556cd8aec14029190092d292","version":"556cd8aec14029190092d295","__v":11,"pages":["55fdb124b652110d00758b70","55fdb2a956d6990d00a6caca","55fdb38856d6990d00a6cacc","55ff6c519e7ccf0d000a1d7f","5613db97acd4343500088079","5616d7b9cf2a1e0d00247971","56196204fa2a6d0d002a1352","5622f2c906481c0d00e5315c","569526b8caa32519009c411e","569fbbcbbeb79a17009f8f89","56aac68aac665d0d00af76b0"],"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-09-19T18:59:24.105Z","from_sync":false,"order":4,"slug":"how-to","title":"How To..."},"__v":15,"user":"556cbb50c14029190092d20f","version":{"_id":"556cd8aec14029190092d295","__v":14,"project":"556cd8aec14029190092d292","createdAt":"2015-06-01T22:11:58.756Z","releaseDate":"2015-06-01T22:11:58.756Z","categories":["556cd8afc14029190092d296","55ca5a55241e790d004f47ea","55dc9fdb4f535537007da1b2","55dc9fdfc755b63700dc843c","55fdb08c4bebdf17004130d4","560ef4c2a36c610d00e7013e","5613db296a092921004c30c2","56156581dc8aea0d002475e8","56169d1ee98f5517005627a8","5622fde7de7dc01700c6dd5f","56cf75f3336aa60b0086a495","5818f3c02093901b00bcf91a","582f7ff88ea0800f0035639a","583f30c110448a2500dd990f"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"project":"556cd8aec14029190092d292","parentDoc":null,"updates":["5695d2a70c650a23002506aa","56cb4c2332011d25006818af"],"next":{"pages":[],"description":""},"createdAt":"2015-09-19T19:12:08.340Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":true,"order":2,"body":"If you're looking to integrate Reverb Orders with your existing eCommerce, inventory, or financial system, you can pull down orders from the Reverb API and make equivalent entries for bookkeeping in your application.\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"Looking for ready-made integrations with Shopify, Bigcommerce, Magento, and more? \\n\\n[Check out our existing eCommerce integrations solutions and apps.](https://reverb.com/page/e-commerce-integrations)\",\n  \"title\": \"Using a popular e-commerce platform? We've got you covered.\"\n}\n[/block]\nThere are two ways to sync orders from Reverb to your application:\n\n* Pulling orders based on dates\n* Using webhooks\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Fetching orders periodically\"\n}\n[/block]\nWith this approach, your app pulls orders from Reverb on a timer. You can set up a cron job to do this nightly, or run a manual script to do so.\n\nFirst, we'll fetch the orders for a given date range. Note that the dates are in [ISO8601 format](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -XGET -H \\\"Authorization: Bearer [oauth_token]\\\" -H \\\"Content-Type: application/hal+json\\\" https://api.reverb.com/api/my/orders/selling/all?created_start_date=2015-01-01T12:00-00:00&created_end_date=2015-01-02T12:00-00:00\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\nThe response will contain a list of order objects, which you can parse to update orders in your system\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"total\\\": 14,\\n  \\\"_links\\\": {\\n    \\\"next\\\": {\\n      \\\"href\\\": \\\"/api/my/orders/selling/all?page=2&per_page=1\\\"\\n    }\\n  },\\n  \\\"orders\\\": [\\n    {\\n      \\\"amount_product\\\": {\\n        \\\"amount\\\": \\\"0.01\\\",\\n        \\\"currency\\\": \\\"USD\\\",\\n        \\\"symbol\\\": \\\"$\\\"\\n      },\\n      \\\"amount_product_subtotal\\\": {\\n        \\\"amount\\\": \\\"0.01\\\",\\n        \\\"currency\\\": \\\"USD\\\",\\n        \\\"symbol\\\": \\\"$\\\"\\n      },\\n      \\\"shipping\\\": {\\n        \\\"amount\\\": \\\"0.00\\\",\\n        \\\"currency\\\": \\\"USD\\\",\\n        \\\"symbol\\\": \\\"$\\\"\\n      },\\n      \\\"amount_tax\\\": {\\n        \\\"amount\\\": \\\"0.00\\\",\\n        \\\"currency\\\": \\\"USD\\\",\\n        \\\"symbol\\\": \\\"$\\\"\\n      },\\n      \\\"total\\\": {\\n        \\\"amount\\\": \\\"0.01\\\",\\n        \\\"currency\\\": \\\"USD\\\",\\n        \\\"symbol\\\": \\\"$\\\"\\n      },\\n      \\\"buyer_name\\\": \\\"Some Buyer\\\",\\n      \\\"created_at\\\": \\\"2015-02-03T04:38:03-06:00\\\",\\n      \\\"order_number\\\": \\\"434114\\\",\\n      \\\"needs_feedback_for_buyer\\\": false,\\n      \\\"needs_feedback_for_seller\\\": false,\\n      \\\"order_type\\\": \\\"instant\\\",\\n      \\\"paid_at\\\": \\\"2015-02-03T04:38:04-06:00\\\",\\n      \\\"quantity\\\": 1,\\n      \\\"shipping_address\\\": {\\n        \\\"name\\\": \\\"Some Buyer\\\",\\n        \\\"street_address\\\": \\\"1234 Main St\\\",\\n        \\\"extended_address\\\": \\\"\\\",\\n        \\\"locality\\\": \\\"Chicagoj\\\",\\n        \\\"region\\\": \\\"IL\\\",\\n        \\\"postal_code\\\": \\\"60076\\\",\\n        \\\"country_code\\\": \\\"US\\\",\\n        \\\"phone\\\": \\\"1231231234\\\"\\n      },\\n      \\\"local_pickup\\\": false,\\n      \\\"shop_name\\\": \\\"Some Seller\\\",\\n      \\\"status\\\": \\\"refunded\\\",\\n      \\\"title\\\": \\\"DOD Stereo Chorus Extreme X GFX64\\\",\\n      \\\"updated_at\\\": \\\"2015-03-06T11:59:27-06:00\\\",\\n      \\\"payment_method\\\": \\\"direct_checkout\\\",\\n      \\\"_links\\\": {\\n        \\\"photo\\\": {\\n          \\\"href\\\": \\\"https://reverb-res.cloudinary.com/image/upload/a_exif,c_thumb,f_auto,fl_progressive,g_south,h_192,w_192/v1386717988/h1zpe0sii9my0xm55htd.jpg\\\"\\n        },\\n        \\\"feedback_for_buyer\\\": {\\n          \\\"href\\\": \\\"/api/orders/434114/feedback/buyer\\\"\\n        },\\n        \\\"feedback_for_seller\\\": {\\n          \\\"href\\\": \\\"/api/orders/434114/feedback/seller\\\"\\n        },\\n        \\\"listing\\\": {\\n          \\\"href\\\": \\\"/api/listings/47096\\\"\\n        },\\n        \\\"start_conversation\\\": {\\n          \\\"href\\\": \\\"/api/my/conversations?listing_id=47096&recipient_id=302456\\\"\\n        },\\n        \\\"self\\\": {\\n          \\\"href\\\": \\\"/api/my/orders/selling/434114\\\"\\n        },\\n        \\\"mark_picked_up\\\": {\\n          \\\"href\\\": \\\"/api/my/orders/selling/434114/mark_picked_up\\\"\\n        },\\n        \\\"ship\\\": {\\n          \\\"href\\\": \\\"/api/my/orders/selling/434114/ship\\\"\\n        },\\n        \\\"contact_buyer\\\": {\\n          \\\"web\\\": {\\n            \\\"href\\\": \\\"https://reverb.com/my/messages/new?item=47096-dod-stereo-chorus-extreme-x-gfx64&to=302456-yan-p-5\\\"\\n          }\\n        }\\n      },\\n      \\\"photos\\\": [\\n        {\\n          \\\"_links\\\": {\\n            \\\"large_crop\\\": {\\n              \\\"href\\\": \\\"https://reverb-res.cloudinary.com/image/upload/a_exif,c_thumb,f_auto,fl_progressive,g_south,h_640,q_85,w_640/v1386717988/h1zpe0sii9my0xm55htd.jpg\\\"\\n            },\\n            \\\"small_crop\\\": {\\n              \\\"href\\\": \\\"https://reverb-res.cloudinary.com/image/upload/a_exif,c_thumb,f_auto,fl_progressive,g_south,h_296,q_85,w_296/v1386717988/h1zpe0sii9my0xm55htd.jpg\\\"\\n            },\\n            \\\"full\\\": {\\n              \\\"href\\\": \\\"https://reverb-res.cloudinary.com/image/upload/a_exif,c_limit,f_auto,fl_progressive,h_1136,q_75,w_640/v1386717988/h1zpe0sii9my0xm55htd.jpg\\\"\\n            },\\n            \\\"thumbnail\\\": {\\n              \\\"href\\\": \\\"https://reverb-res.cloudinary.com/image/upload/a_exif,c_thumb,f_auto,fl_progressive,g_south,h_192,w_192/v1386717988/h1zpe0sii9my0xm55htd.jpg\\\"\\n            }\\n          }\\n        }\\n      ],\\n      \\\"sku\\\": \\\"rev-47096\\\",\\n      \\\"selling_fee\\\": {\\n        \\\"amount\\\": \\\"0.00\\\",\\n        \\\"currency\\\": \\\"USD\\\",\\n        \\\"symbol\\\": \\\"$\\\"\\n      },\\n      \\\"direct_checkout_payout\\\": {\\n        \\\"amount\\\": \\\"-0.24\\\",\\n        \\\"currency\\\": \\\"USD\\\",\\n        \\\"symbol\\\": \\\"$\\\"\\n      }\\n    }\\n  ]\\n}\",\n      \"language\": \"json\",\n      \"name\": \"order_response.json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Syncing orders via webhooks\"\n}\n[/block]\nWith this approach, your app registers a webhook endpoint, and Reverb will POST to your endpoint when an order is created. You can also subscribe to the \"listings/update\" event for when listings are updated (inventory changes).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -XPOST https://api.reverb.com/api/webhooks/registrations --data '{\\\"url\\\": \\\"http://yoursite.com/yourendpoint\\\", \\\"topic\\\": \\\"orders/create\\\"}' -H \\\"Authorization: Bearer [oauth_token]\\\" -H \\\"Content-Type: application/hal+json\\\" -H \\\"Accept: application/hal+json\\\"\",\n      \"language\": \"curl\",\n      \"name\": \"Webhook Registration\"\n    }\n  ]\n}\n[/block]\nYou will need to produce an http endpoint that responds to POST on the URL you registered above. This endpoint will receive as params a hash representing an Order, which is identical to the ones in the response shown in the section above.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"List of Order Statuses\"\n}\n[/block]\nThese are the possible values for the `status` field\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"unpaid\",\n    \"h-0\": \"Status\",\n    \"h-1\": \"Meaning\",\n    \"1-0\": \"payment_pending\",\n    \"4-0\": \"partially_paid\",\n    \"5-0\": \"paid\",\n    \"6-0\": \"shipped\",\n    \"7-0\": \"picked_up\",\n    \"8-0\": \"received\",\n    \"9-0\": \"refunded\",\n    \"1-1\": \"Payment has been submitted but is waiting to clear through the payment processor.\",\n    \"0-1\": \"Buyer has not submitted payment (usually for Auctions or Offer-based orders, there is a short delay until buyer pays)\",\n    \"4-1\": \"Buyer has partially paid, using layaway\",\n    \"5-1\": \"Order is fully paid\",\n    \"6-1\": \"Order has been marked shipped by the seller\",\n    \"7-1\": \"Order has been marked picked up by the seller (local pickup orders only)\",\n    \"8-1\": \"Order has been marked received by the buyer (if the seller has not otherwise marked it shipped)\",\n    \"9-1\": \"Order was refunded by the seller. This is a temporary state that leads to `cancelled` immediately afterwards.\",\n    \"2-0\": \"pending_review\",\n    \"2-1\": \"Order is being reviewed for fraud risk.\",\n    \"3-0\": \"blocked\",\n    \"3-1\": \"Order has been blocked due to potential fraud.\",\n    \"10-0\": \"cancelled\",\n    \"10-1\": \"Order has been cancelled by seller or buyer request, or because it was fully refunded.\"\n  },\n  \"cols\": 2,\n  \"rows\": 11\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"List of Shipping Methods\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"shipping_method\",\n    \"h-1\": \"Meaning\",\n    \"0-0\": \"shipped\",\n    \"0-1\": \"Normal ground shipping. The item should be marked shipped with a tracking number within 72 hours.\",\n    \"1-0\": \"local\",\n    \"1-1\": \"This order will be picked up by the buyer at the seller's location\",\n    \"2-0\": \"expedited_shipping\",\n    \"2-1\": \"2-day expedited shipping. The item should be marked shipped within 24 hours and sent via a 2-day shipping method (method varies depending on carrier).\"\n  },\n  \"cols\": 2,\n  \"rows\": 3\n}\n[/block]","excerpt":"","slug":"syncing-orders","type":"basic","title":"Retrieve/sync orders"}

Retrieve/sync orders


If you're looking to integrate Reverb Orders with your existing eCommerce, inventory, or financial system, you can pull down orders from the Reverb API and make equivalent entries for bookkeeping in your application. [block:callout] { "type": "info", "body": "Looking for ready-made integrations with Shopify, Bigcommerce, Magento, and more? \n\n[Check out our existing eCommerce integrations solutions and apps.](https://reverb.com/page/e-commerce-integrations)", "title": "Using a popular e-commerce platform? We've got you covered." } [/block] There are two ways to sync orders from Reverb to your application: * Pulling orders based on dates * Using webhooks [block:api-header] { "type": "basic", "title": "Fetching orders periodically" } [/block] With this approach, your app pulls orders from Reverb on a timer. You can set up a cron job to do this nightly, or run a manual script to do so. First, we'll fetch the orders for a given date range. Note that the dates are in [ISO8601 format](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations). [block:code] { "codes": [ { "code": "curl -XGET -H \"Authorization: Bearer [oauth_token]\" -H \"Content-Type: application/hal+json\" https://api.reverb.com/api/my/orders/selling/all?created_start_date=2015-01-01T12:00-00:00&created_end_date=2015-01-02T12:00-00:00", "language": "curl" } ] } [/block] The response will contain a list of order objects, which you can parse to update orders in your system [block:code] { "codes": [ { "code": "{\n \"total\": 14,\n \"_links\": {\n \"next\": {\n \"href\": \"/api/my/orders/selling/all?page=2&per_page=1\"\n }\n },\n \"orders\": [\n {\n \"amount_product\": {\n \"amount\": \"0.01\",\n \"currency\": \"USD\",\n \"symbol\": \"$\"\n },\n \"amount_product_subtotal\": {\n \"amount\": \"0.01\",\n \"currency\": \"USD\",\n \"symbol\": \"$\"\n },\n \"shipping\": {\n \"amount\": \"0.00\",\n \"currency\": \"USD\",\n \"symbol\": \"$\"\n },\n \"amount_tax\": {\n \"amount\": \"0.00\",\n \"currency\": \"USD\",\n \"symbol\": \"$\"\n },\n \"total\": {\n \"amount\": \"0.01\",\n \"currency\": \"USD\",\n \"symbol\": \"$\"\n },\n \"buyer_name\": \"Some Buyer\",\n \"created_at\": \"2015-02-03T04:38:03-06:00\",\n \"order_number\": \"434114\",\n \"needs_feedback_for_buyer\": false,\n \"needs_feedback_for_seller\": false,\n \"order_type\": \"instant\",\n \"paid_at\": \"2015-02-03T04:38:04-06:00\",\n \"quantity\": 1,\n \"shipping_address\": {\n \"name\": \"Some Buyer\",\n \"street_address\": \"1234 Main St\",\n \"extended_address\": \"\",\n \"locality\": \"Chicagoj\",\n \"region\": \"IL\",\n \"postal_code\": \"60076\",\n \"country_code\": \"US\",\n \"phone\": \"1231231234\"\n },\n \"local_pickup\": false,\n \"shop_name\": \"Some Seller\",\n \"status\": \"refunded\",\n \"title\": \"DOD Stereo Chorus Extreme X GFX64\",\n \"updated_at\": \"2015-03-06T11:59:27-06:00\",\n \"payment_method\": \"direct_checkout\",\n \"_links\": {\n \"photo\": {\n \"href\": \"https://reverb-res.cloudinary.com/image/upload/a_exif,c_thumb,f_auto,fl_progressive,g_south,h_192,w_192/v1386717988/h1zpe0sii9my0xm55htd.jpg\"\n },\n \"feedback_for_buyer\": {\n \"href\": \"/api/orders/434114/feedback/buyer\"\n },\n \"feedback_for_seller\": {\n \"href\": \"/api/orders/434114/feedback/seller\"\n },\n \"listing\": {\n \"href\": \"/api/listings/47096\"\n },\n \"start_conversation\": {\n \"href\": \"/api/my/conversations?listing_id=47096&recipient_id=302456\"\n },\n \"self\": {\n \"href\": \"/api/my/orders/selling/434114\"\n },\n \"mark_picked_up\": {\n \"href\": \"/api/my/orders/selling/434114/mark_picked_up\"\n },\n \"ship\": {\n \"href\": \"/api/my/orders/selling/434114/ship\"\n },\n \"contact_buyer\": {\n \"web\": {\n \"href\": \"https://reverb.com/my/messages/new?item=47096-dod-stereo-chorus-extreme-x-gfx64&to=302456-yan-p-5\"\n }\n }\n },\n \"photos\": [\n {\n \"_links\": {\n \"large_crop\": {\n \"href\": \"https://reverb-res.cloudinary.com/image/upload/a_exif,c_thumb,f_auto,fl_progressive,g_south,h_640,q_85,w_640/v1386717988/h1zpe0sii9my0xm55htd.jpg\"\n },\n \"small_crop\": {\n \"href\": \"https://reverb-res.cloudinary.com/image/upload/a_exif,c_thumb,f_auto,fl_progressive,g_south,h_296,q_85,w_296/v1386717988/h1zpe0sii9my0xm55htd.jpg\"\n },\n \"full\": {\n \"href\": \"https://reverb-res.cloudinary.com/image/upload/a_exif,c_limit,f_auto,fl_progressive,h_1136,q_75,w_640/v1386717988/h1zpe0sii9my0xm55htd.jpg\"\n },\n \"thumbnail\": {\n \"href\": \"https://reverb-res.cloudinary.com/image/upload/a_exif,c_thumb,f_auto,fl_progressive,g_south,h_192,w_192/v1386717988/h1zpe0sii9my0xm55htd.jpg\"\n }\n }\n }\n ],\n \"sku\": \"rev-47096\",\n \"selling_fee\": {\n \"amount\": \"0.00\",\n \"currency\": \"USD\",\n \"symbol\": \"$\"\n },\n \"direct_checkout_payout\": {\n \"amount\": \"-0.24\",\n \"currency\": \"USD\",\n \"symbol\": \"$\"\n }\n }\n ]\n}", "language": "json", "name": "order_response.json" } ] } [/block] [block:api-header] { "type": "basic", "title": "Syncing orders via webhooks" } [/block] With this approach, your app registers a webhook endpoint, and Reverb will POST to your endpoint when an order is created. You can also subscribe to the "listings/update" event for when listings are updated (inventory changes). [block:code] { "codes": [ { "code": "curl -XPOST https://api.reverb.com/api/webhooks/registrations --data '{\"url\": \"http://yoursite.com/yourendpoint\", \"topic\": \"orders/create\"}' -H \"Authorization: Bearer [oauth_token]\" -H \"Content-Type: application/hal+json\" -H \"Accept: application/hal+json\"", "language": "curl", "name": "Webhook Registration" } ] } [/block] You will need to produce an http endpoint that responds to POST on the URL you registered above. This endpoint will receive as params a hash representing an Order, which is identical to the ones in the response shown in the section above. [block:api-header] { "type": "basic", "title": "List of Order Statuses" } [/block] These are the possible values for the `status` field [block:parameters] { "data": { "0-0": "unpaid", "h-0": "Status", "h-1": "Meaning", "1-0": "payment_pending", "4-0": "partially_paid", "5-0": "paid", "6-0": "shipped", "7-0": "picked_up", "8-0": "received", "9-0": "refunded", "1-1": "Payment has been submitted but is waiting to clear through the payment processor.", "0-1": "Buyer has not submitted payment (usually for Auctions or Offer-based orders, there is a short delay until buyer pays)", "4-1": "Buyer has partially paid, using layaway", "5-1": "Order is fully paid", "6-1": "Order has been marked shipped by the seller", "7-1": "Order has been marked picked up by the seller (local pickup orders only)", "8-1": "Order has been marked received by the buyer (if the seller has not otherwise marked it shipped)", "9-1": "Order was refunded by the seller. This is a temporary state that leads to `cancelled` immediately afterwards.", "2-0": "pending_review", "2-1": "Order is being reviewed for fraud risk.", "3-0": "blocked", "3-1": "Order has been blocked due to potential fraud.", "10-0": "cancelled", "10-1": "Order has been cancelled by seller or buyer request, or because it was fully refunded." }, "cols": 2, "rows": 11 } [/block] [block:api-header] { "title": "List of Shipping Methods" } [/block] [block:parameters] { "data": { "h-0": "shipping_method", "h-1": "Meaning", "0-0": "shipped", "0-1": "Normal ground shipping. The item should be marked shipped with a tracking number within 72 hours.", "1-0": "local", "1-1": "This order will be picked up by the buyer at the seller's location", "2-0": "expedited_shipping", "2-1": "2-day expedited shipping. The item should be marked shipped within 24 hours and sent via a 2-day shipping method (method varies depending on carrier)." }, "cols": 2, "rows": 3 } [/block]