*GET* /merchant/purchase-history ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Provides merchant access to users' purchase history data via a REST API Optional Query Params --------------------- Additionally you can filter the purchase history data for a particular date range using the `from_date` and `to_date` query parameter. You must provide both paramters when filtering purchase history data. ``from_date`` : filters purchase history starting from this date. ISO formatted date (YYYY-mm-dd) ``to_date`` : filters purchase history starting until this date (inclusive). ISO formatted date (YYYY-mm-dd) Example URLs: * https://api.laterpay.net/merchant/purchase-history (EU Production) * https://api.sandbox.laterpaytest.net/merchant/purchase-history (EU :ref:`Sandbox `) * https://api.uselaterpay.com/merchant/purchase-history (US Production) * https://api.sandbox.uselaterpaytest.com/merchant/purchase-history (US :ref:`Sandbox `) Authorization ------------- To authorize your request use Basic Auth passing the ``Merchant Id`` as your username and ``API Key`` as your password. Parameters ---------- To get purchase history you must set a specific time period. ``from_date`` (required) Date from where you would like purchase history to start from. Format: ``"%Y-%m-%d"`` ``to_date`` (required) Date from where you would like purchase history to end. Format: ``"%Y-%m-%d"`` Response -------- **/merchant/purchase-history** returns a JSON object with the following keys: ``status`` ``'ok'`` if the request was handled correctly, or ``'error'`` if some problem occurred (such as an incorrect set of parameters). ``data`` A list of JSON objects containing user purchase history data. ``errors`` A list of JSON objects containing error info. Example responses: :: { "status": "ok", "data": [ { "payment_model": "Pay Now", "sales_model": "Single Purchase", "price": 200, "title": "Generated Article ID 1472819", "expiry_date": "", "item_url": "http://example.com/article-1472819", "purchase_date": "2020-01-15T16:17:19+00:00", "shared_user_id": "37f618af-1d63-406f-b0d8-db65e131a6e7", "payment_date": "2020-01-15T16:17:19.610089+00:00", "article_id": "1472819" }, { "payment_model": "Pay Now", "sales_model": "Single Purchase", "price": 200, "title": "Generated Article ID 4959846", "expiry_date": "", "item_url": "http://example.com/article-4959846", "purchase_date": "2020-01-15T16:25:28+00:00", "shared_user_id": "37f618af-1d63-406f-b0d8-db65e131a6e7", "payment_date": "2020-01-15T16:25:28.163459+00:00", "article_id": "4959846" } ] }