Skip to content

Instantly share code, notes, and snippets.

@stepun
Last active November 21, 2018 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stepun/c85795fc0f93c87e4acf to your computer and use it in GitHub Desktop.
Save stepun/c85795fc0f93c87e4acf to your computer and use it in GitHub Desktop.
API Transactions

API Transactions

List units by transaction

Resource URL

https://storencash.com/api/v1_transaction.json

Resource Information

  • Response formats JSON
  • Requires authentication? Yes

Parameters

Name Require Type Description
id yes int(10) identifier transaction (document number)

Example Request

GET /api/v1_transaction.json/1 HTTP/1.1
Host: storencash.com
token: e1ec049b388fbc7f2f9dca44dcbfde06
Cache-Control: no-cache

Example Result

{
    "status": "success",
    "data": {
        "collection": [
{
        "id": 126441,
        "store_id": 1,
        "product_id": 366,
        "msut_id": 24493,
        "container": "2bdee6f35daec36e739f65b42e3caf6e",
        "operation_id": 3,
        "currency_id": 1,
        "remains_id": 1782,
        "measureId": 101,
        "document_number": "24493",
        "document_date": "2016-12-28",
        "date": "2016-12-28",
        "time": "10:46:07",
        "price_p": 10,
        "price": 25.3,
        "count": 1,
        "cr_id": "1",
        "remains_barcode": "4000000003663",
        "cr_id2": "3",
        "name": "Тест учетной цены",
        "sku": "",
        "type": 1,
        "stnds": 0,
        "measure_full_name": "ШТУКА",
        "measure_name": "ШТ",
        "timestamp": 1482900367
      },
      {
        "id": 126442,
        "store_id": 1,
        "product_id": 366,
        "msut_id": 24493,
        "container": "c34cca9d9121b5c88511f8c5427e9e98",
        "operation_id": 3,
        "currency_id": 1,
        "remains_id": 1781,
        "measureId": 101,
        "document_number": "24493",
        "document_date": "2016-12-28",
        "date": "2016-12-28",
        "time": "10:46:07",
        "price_p": 10,
        "price": 25,
        "count": 1,
        "cr_id": "1",
        "remains_barcode": "4000000003663",
        "cr_id2": "3",
        "name": "Тест учетной цены",
        "sku": "",
        "type": 1,
        "stnds": 0,
        "measure_full_name": "ШТУКА",
        "measure_name": "ШТ",
        "timestamp": 1482900367
      }            

        ]
    }
}

List units by period

Resource URL

https://storencash.com/api/v1_transaction.json

Resource Information

  • Response formats JSON
  • Requires authentication? Yes

При получении инфорамии по возвратам в поле parent_transaction_id передается идентификатор транзакции по которой был произведен возврат

Parameters

Name Require Type Description
period no date period (Y-m-d - Y-m-d) Период запрашиваемых дат проведения документа.
document_number no varchar Номер запрашиваемого документа, должен совпадать с периодом. выдаст все номера документов за указанный период, если период не указан, то выдет по текущей дате
device_id no varchar(100) identifier device
timestamp no int(11) default = 0. Получить данные с данной даты (Time Stamp формат - количество миллисекунд с 1 января 1970 года. Необходим для получения обновленных данных).

Example Request

GET /api/v1_transaction.json?period=2015-05-19 - 2015-06-30&device_id=DH1005F1002345&timestamp=1474247810 HTTP/1.1
Host: storencash.com
token: f9dc77f5c19a7ef5df51c689c8047edd
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded

Example Result

{
  "status": "success",
  "data":{
    "collection":[
      {
        "id": 5642,
        "store_id": 5,
        "product_id": 11,
        "container": "7be2825de2092da583d3711183cd739c",
        "operation_id": 3,
        "svop_pu": 2,
        "currency_id": 1,
        "sgo_oid": 1,
        "remains_id": 156,
        "measureId": 303,
        "document_number": "8",
        "document_date": "2017-07-10",
        "document_time": "17:12:35",
        "date": "2017-07-10",
        "time": "17:12:44",
        "balance": 84,
        "msut_id": 5078,
        "parent_transaction_id": 0,
        "price_p": 100,
        "price": 150,
        "count": 1,
        "cont_naim": null,
        "device_id": "354485061493370",
        "vat_number": "",
        "svop_pus": "2",
        "svop_pvp": "1",
        "svop_color": "#727cb6",
        "svop_name": "Продажа",
        "name": "Картофель",
        "type": "1",
        "stnds": 18,
        "measure_full_name": "КИЛОГРАММ",
        "measure_name": "КГ",
        "spz_name": "Тест перемещение",
        "login": "merchant2can@mail.ru",
        "username": "Ramil",
        "currency_code": "RUB",
        "knvg": "руб",
        "knmo": "RUB",
        "knvgo": "руб",
        "mdr":[
          {
            "id": 10900,
            "processing_date": "0",
            "pay_type": 1,
            "ext_data": "{\"credit\":{\"cl_id\":0,\"rmnd\":0,\"rd_date\":null},\"deposit\":150.0,\"type\":1,\"fiscal_data\":{\"code\":\"67\",\"date\":\"2017-07-10 17:09:19\",\"name\":\"АТОЛ 11Ф\",\"check_number\":157,\"doc_number\":406,\"serial_number\":\"00106708254442\"},\"p_doc_dt\":null,\"transition\":{\"date\":null}}",
            "device_id": "354485061493370",
            "currency_code": "RUB"
          }
        ],
        "timestamp": 1499688764
      }
    ],
    "total": 9,
    "count": 9
  },
  "base_id": 2248
}

Set transaction

Resource URL

https://storencash.com/api/v1_transaction.json

Resource Information

  • Response formats JSON
  • Requires authentication? Yes

Parameters

Name Require Type Description
remains_id yes int(10) identifier remains.
measureId yes int(10) identifier measure.
operation_id yes int(10) identifier operation.
storage_id yes int(10) identifier storage.
document_date no date (m.d.Y) Document date. Default = today
document_number no varchar(10) Document number. Default = transaction_id
price no double Price of the unit. Default = 0
count yes double Count units. May be 0.001 value
device_id no varchar(100) identifier device.

Example Request

POST /api/v1_transaction.json HTTP/1.1
Host: storencash.com
token: f9dc77f5c19a7ef5df51c689c8047edd
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded

remains_id=2&measureId=101&operation_id=3&storage_id=1&price=2500&count=2&device_id=123

Example Result

{
    "status": "success",
    "data": {
        "transaction_id": "67"
    }
}

Delete transaction

Resource URL

https://storencash.com/api/v1_transaction.json

Resource Information

  • Response formats JSON
  • Requires authentication? Yes

Parameters

Name Require Type Description
id yes int(10) identifier transaction (document number)

Example Request

DELETE /api/v1_transaction.json/1 HTTP/1.1
Host: storencash.com
token: e1ec049b388fbc7f2f9dca44dcbfde06
Cache-Control: no-cache

Example Result

{
    "status": "success",
        "data": {
           "AffectedRows": 1
        }
}

Set retrieve by transaction

Операция возврата по ID транзакции

Resource URL

https://storencash.com/api/v1_transaction.json/3?action=setRetrieve

Resource Information

  • Response formats JSON
  • Requires authentication? Yes

Parameters

Name Require Type Description
id yes int(10) identifier transaction (document number)

Example Request

PUT /api/v1_transaction.json/1 HTTP/1.1
Host: storencash.com
token: e1ec049b388fbc7f2f9dca44dcbfde06
Cache-Control: no-cache

Example Result

Возвращает идентификатор новой транзакции и сумму по транзакции

{
  "status": "success",
  "data": {
    "transaction_id": "4",
    "sumv": "5"
  }
}

Update ext data by transaction

Метод обновления данных по платежной транзакции

Resource URL

https://storencash.com/api/v1_transaction.json/3?action=updateExtData

Resource Information

  • Response formats JSON
  • Requires authentication? Yes

Parameters

Name Require Type Description
id yes int(10) identifier transaction

Example Request

PUT /api/v1_transaction.json/3?action=updateExtData HTTP/1.1
Host: storencash.com
token: f9dc77f5c19a7ef5df51c689c8047edd
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded

ext_data=%5B%7B%22transaction_id%22%3A355614%2C%22authorization_code%22%3A30%2C%22card_type%22%3A%22Visa%22%2C%22card_number%22%3A5387***2553%7D%5D

Example Result

{
    "status": "success",
    "data": {
        "transaction_id": "3"
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment