NNarya Developers
API referenceHourly transaction totals

Report hourly transaction totals

POST
/device/v1/transaction-metrics

Reports one hour of the terminal's transaction totals. Send a report for each hour, usually once the hour has ended, in addition to the individual transactions.

A 202 means Narya has accepted the report; it is stored shortly afterwards.

A report for an hour already reported replaces the earlier one, whatever its id, rather than adding to it. After a 500 or 503, resend the same body with the same id.

Authorization

DeviceAuth
headerAuthorizationBearer <dvc_<prefix>_<secret>>

The terminal's device token, returned once by POST /device/v1/activations. Send it as Authorization: Bearer <token> on every request except activation.

Request Body

application/json
  1. body

One hour of the terminal's transaction totals. A report for an hour already reported replaces the earlier one, whatever its id, so a retry never double-counts.

id*string

A UUIDv7 your terminal generates.

Formatuuid
period_start*string

The start of the hour, in UTC and on the hour. It must not be in the future. period_end is exactly one hour later.

Formatdate-time
period_end*string

The end of the hour: exactly one hour after period_start.

Formatdate-time
tid?string

Terminal ID (ISO 8583 field 41), as sent to the host. Optional, but needed to reconcile the totals against the acquirer's settlement statement.

Lengthlength <= 16
mid?string

Merchant ID (field 42). See tid.

Lengthlength <= 32
total_count*integer

The number of transactions the terminal counted in the hour. Send the terminal's own count rather than adding up cells: a difference between the two reveals a counting problem. A report whose total disagrees with its cells is still accepted.

Formatint64
Range0 <= value
total_amount*integer

The total in MYR minor units. See CardMetricCell.amount.

Formatint64
cells*array<|>

One entry per combination of dimensions that had transactions; omit combinations with none. An empty array reports an hour with no transactions.

Itemsitems <= 512

Response Body

Accepted. The report is stored shortly afterwards.

application/json
  1. response

Returned with 202. The report is accepted and is stored shortly afterwards.

event_id*string

Narya's reference for this submission.

Formatuuid
id*string

The id you submitted, returned unchanged.

Formatuuid
received_at*string

When Narya accepted the report.

Formatdate-time
Example Request
curl -X POST 'https://device-narya-staging.pmadvisors.my/device/v1/transaction-metrics' \  -H 'Content-Type: application/json' \  -d '{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "period_start": "2019-08-24T14:15:22Z",  "period_end": "2019-08-24T14:15:22Z",  "total_count": 0,  "total_amount": 0,  "cells": [    {      "channel": "card",      "type": "sale",      "status": "approved",      "card_scheme": "visa",      "card_entry_mode": "chip",      "card_cvm": "pin",      "count": 1,      "amount": 0    }  ]}'
Example Response
{  "event_id": "a7a26ff2-e851-45b6-9634-d595f45458b7",  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "received_at": "2019-08-24T14:15:22Z"}