Price API

Autopay supports hour-based dynamic pricing to allow landlords to control their pricing schemas hour by hour based on the actual use. In addition, price API makes managing dynamic pricing even more accessible and more automated as the desired pricing schemas can be pushed to Autopay automatically.


Available resources

Access requirements


PUT - update pricing

This method allows you to send a new price schema for a specified product

Endpoint

PUT https://api.autopay.io/price/v1/product/{productId}

Request parameters

  • The request body must be in JSON format and HTTP headers must include Content-Type: application/json.
  • The headers must include a valid access token.

Parameter Type Mandatory Description
product_id number yes ID of the product. NOTE: this should not be included in the payload, but as a path variable
type string yes Pricing type. Possible values: DYNAMIC_PRICING
valid_from date-time no Time when this pricing becomes valid (ISO8601)
prices List of prices yes
type string yes Type of price. Possible values: DYNAMIC, REGULAR
period string no Period for price (ex. "30 MINUTES", "1 HOUR"). Only for DYNAMIC, REGULAR price types
amount decimal yes Price for a period.
hourly_amounts Map<number, decimal> no A map where the key is the hour (0-23) and the value is the price for thath hour. Only for DYNAMIC price type
restrictions List of restrictions no Optional. Only for DYNAMIC price type
type string yes Restriction type. Possible values: WEEKDAYS
restrict_to List of strings yes List of weekdays. ex ["MONDAY", "TUESDAY", "..."]

Example request

    
    {
        "type": "DYNAMIC_PRICING",
        "valid_from": "2021-02-28T11:52:16+0000",
        "prices": [
            {
                "type": "DYNAMIC",
                "restrictions": [
                    {
                        "type":"WEEKDAYS",
                        "restrict_to": [
                            "FRIDAY",
                            "SATURDAY",
                            "SUNDAY"
                        ]
                    }
                ],
                "amount": 1.45876,
                "period": "1 MINUTE",
                "hourly_amounts": {
                    "9": 2.1,
                    "10": 2.1,
                    "11": 2.6,
                    "12": 2.5
                }
            },
            {
                "type": "REGULAR",
                "amount": 350.0,
                "period": "24 HOURS"
            },
            {
                "type": "ACCUMULATIVE_24H_MAX",
                "amount": 350.0
            }
        ]
    }
    
    

Success response

HTTP Code: 204 OK


Example request

PUT https://api.autopay.io/price/v1/product/123456

Error messages

Parameter Type Description
error_id string Specific code of error. See below for possible values
message string Description of error
description string Optional value. Additional description of error.

Example error response

    
    {
        "error_id": "authentication_error",
        "message": "No access token present in header!"
    }
    
    

Possible error id-s

Error id Explanation
forbidden Unauthorized
internal_server_error Internal server error