# Smaregi transaction history

# Fetching a list of transactions

Endpoint to fetch a list of Smaregi transactions for the currently logged in Shopify customer. Uses a Shopify app proxy, therefore the domain of the API endpoints is the Shopify store's domain.

/apps/smapify/smaregi_transactions

# Query params:

Key Type Definition
filter[type] integer[] Array of Smaregi transaction types. 1: Normal, 5: Deposit refund (cancellation), 6: Point addition, 7: Point subtraction, 10: Reservation. optional
filter[transaction_uuid] integer Smaregi transaction ID for a transaction that was made by the currently logged in customer. optional

# Response schema

The following fields for a list of transactions may be returned.

content type: text/html

Key Type Definition
couponDiscount string Discount due to coupons being consumed during transaction.
customerCode string Smaregi customer code.
newPoint integer Total points grated during the transaction.
point integer Quantity of points present before the transaction occurred.
pointDiscount integer Discount due to points being consumed during transaction.
spendPoint integer Total points consumed during the transaction.
storeCode string Store code.
storeId integer Smaregi store id.
storeName integer Smaregi store name.
subtotal integer Total subtotal after discount.
taxExclude integer International total tax of transaction.
taxInclude integer Domestic total tax of transaction.
taxRate string Tax rate for the transaction.
terminalTranDateTime string Date and time transaction occurred.
total integer Total cost of the transaction.
totalPoint integer Total quantity of points present after the transaction had occurred.
transactionHeadDivision integer Smaregi transaction type. 1: Normal, 5: Deposit refund (cancellation), 6: Point addition, 7: Point subtraction, 10: Reservation.
transactionUuid string Smaregi transaction receipt number.
details [Smaregi line items] Array of line items purchased during the transaction.
# Details/Line items

If a transaction contains line items, they will be included in an array on the details key in the response body. If a transaction contains no line items, the details key will be an empty array.

Currently, line items will only exist for valid products that existed in Smapify at or before the time the transaction occurred.

The following fields for a list of line items may be returned.

Key Type Definition
applyBargainDiscountPrice string Applicable discount amount.
applyBargainValue string Applicable sale value.
bargainDiscountProportional string Sale discount apportionment.
bargainDivision string Division sale is categorized in.
bargainId string ID of sale.
bargainName string Name of sale.
bargainValue string Value of sale.
calcDiscount string Discount target. 0: not applicable, 1: the line item. Default is 1.
categoryName string Name of the product department / category.
discountPointProportional string Point discount subtotal apportion.
discountPriceProportional string Discount subtotal apportion.
discriminationNo string Identification number.
groupCode string Product's group code.
pointNotApplicable integer Whether or not points can be applied. 0: points applicable. 1: points can not be applied.
price string Product unit price.
productCode string Product code (barcode).
productId integer Product Smaregi ID.
productName string Product Smaregi name.
quantity integer Amount of units purchased.
salesPrice string Sales unit price.
transactionDetailId integer Line item ID.
unitDiscountDivision string Discount category.
unitDiscountPrice string Single item discount amount.
unitDiscountRate string Single item discount percentage: XXX%.
unitDiscountSum string Total discount amount in relation to quantity. unitDiscountPrice * quantity.
unitDiscountedSum string Total unit price after discounts.
unitNonDiscountSum string Total unit price before discounts.

# Customer Not Logged In

If no customer is logged in to the Shopify store, no transaction data will be returned. Instead a response similar to the following will be returned:

{"error": "Unauthorized", "message": "Customer not logged in.", "status": 401}

# Example

# All transactions

This route will return a list of Smaregi transactions for the currently logged in customer. An empty array will be returned if no transactions exist for the currently logged in customer.

GET "https://johns-apparel.myshopify.com/apps/smapify/smaregi_transactions"
{
  "data": [
    {
      "couponDiscount": "string",
      "customerCode": "string",
      "newPoint": "integer",
      "point": "integer",
      "pointDiscount": "integer",
      "spendPoint": "integer",
      "storeCode": "string",
      "storeId": "integer",
      "storeName": "string",
      "subtotal": "integer",
      "taxExclude": "integer",
      "taxInclude": "integer",
      "taxRate": "string",
      "terminalTranDateTime": "string",
      "total": "integer",
      "totalPoint": "integer",
      "transactionHeadDivision": "integer",
      "transactionUuid": "string",
      "details": [
        {
          "applyBargainDiscountPrice": "string",
          "applyBargainValue": "string",
          "bargainDiscountProportional": "string",
          "bargainDivision": "string",
          "bargainId": "string",
          "bargainName": "string",
          "bargainValue": "string",
          "calcDiscount": "string",
          "categoryName": "string",
          "discountPointProportional": "string",
          "discountPriceProportional": "string",
          "discriminationNo": "string",
          "groupCode": "string",
          "pointNotApplicable": "integer",
          "price": "string",
          "productCode": "string",
          "productId": "integer",
          "productName": "string",
          "quantity": "integer",
          "salesPrice": "string",
          "transactionDetailId": "integer",
          "unitDiscountDivision": "string",
          "unitDiscountedSum": "string",
          "unitDiscountPrice": "string",
          "unitDiscountRate": "string",
          "unitDiscountSum": "string",
          "unitNonDiscountSum": "string"
        }
      ]
    }
  ]
}

# Filtering by transaction type

A filtered list of transactions can be fetched by specifying a list of Smaregi transaction_head_division types (opens new window) in the query params. A list of transactions that are associated with the currently logged in customer and match the given types will be returned. An empty list will be returned if there are no transactions that meet the given criteria.

GET "https://johns-apparel.myshopify.com/apps/smapify/smaregi_transactions?filter[type]=[:smaregi_transaction_head_division]"
{
  "data": [
    {
      "couponDiscount": "string",
      "customerCode": "string",
      "newPoint": "integer",
      "point": "integer",
      "pointDiscount": "integer",
      "spendPoint": "integer",
      "storeCode": "string",
      "storeId": "integer",
      "storeName": "string",
      "subtotal": "integer",
      "taxExclude": "integer",
      "taxInclude": "integer",
      "taxRate": "string",
      "terminalTranDateTime": "string",
      "total": "integer",
      "totalPoint": "integer",
      "transactionHeadDivision": "integer",
      "transactionUuid": "string",
      "details": [
        {
          "applyBargainDiscountPrice": "string",
          "applyBargainValue": "string",
          "bargainDiscountProportional": "string",
          "bargainDivision": "string",
          "bargainId": "string",
          "bargainName": "string",
          "bargainValue": "string",
          "calcDiscount": "string",
          "categoryName": "string",
          "discountPointProportional": "string",
          "discountPriceProportional": "string",
          "discriminationNo": "string",
          "groupCode": "string",
          "pointNotApplicable": "integer",
          "price": "string",
          "productCode": "string",
          "productId": "integer",
          "productName": "string",
          "quantity": "integer",
          "salesPrice": "string",
          "transactionDetailId": "integer",
          "unitDiscountDivision": "string",
          "unitDiscountedSum": "string",
          "unitDiscountPrice": "string",
          "unitDiscountRate": "string",
          "unitDiscountSum": "string",
          "unitNonDiscountSum": "string"
        }
      ]
    }
  ]
}

# Filtering by transaction UUID

A single Smaregi transaction can be fetched by specifying the transaction's Smaregi transaction UUID in the query params. If a transaction has the specified transaction UUID and is associated with the currently logged in customer, a single item list containing the transaction will be returned. Otherwise, an empty list will be returned.

GET "https://johns-apparel.myshopify.com/apps/smapify/smaregi_transactions?filter[transaction_uuid]==:smaregi_transaction_id"
{
  "data": [
    {
      "couponDiscount": "string",
      "customerCode": "string",
      "newPoint": "integer",
      "point": "integer",
      "pointDiscount": "integer",
      "spendPoint": "integer",
      "storeCode": "string",
      "storeId": "integer",
      "storeName": "string",
      "subtotal": "integer",
      "taxExclude": "integer",
      "taxInclude": "integer",
      "taxRate": "string",
      "terminalTranDateTime": "string",
      "total": "integer",
      "totalPoint": "integer",
      "transactionHeadDivision": "integer",
      "transactionUuid": "string",
      "details": [
        {
          "applyBargainDiscountPrice": "string",
          "applyBargainValue": "string",
          "bargainDiscountProportional": "string",
          "bargainDivision": "string",
          "bargainId": "string",
          "bargainName": "string",
          "bargainValue": "string",
          "calcDiscount": "string",
          "categoryName": "string",
          "discountPointProportional": "string",
          "discountPriceProportional": "string",
          "discriminationNo": "string",
          "groupCode": "string",
          "pointNotApplicable": "integer",
          "price": "string",
          "productCode": "string",
          "productId": "integer",
          "productName": "string",
          "quantity": "integer",
          "salesPrice": "string",
          "transactionDetailId": "integer",
          "unitDiscountDivision": "string",
          "unitDiscountedSum": "string",
          "unitDiscountPrice": "string",
          "unitDiscountRate": "string",
          "unitDiscountSum": "string",
          "unitNonDiscountSum": "string"
        }
      ]
    }
  ]
}