Payment API

Through Payment API, third-party payment providers can take on payment responsibilities for parking in Autopay. The payment provider finds the ongoing parking in Autopay based on a vehicle’s license plate. When the parking has ended, Autopay sends the cost to the payment provider, who then charges the customer.

By accessing or using the API, the integrator agrees to be bound by the terms and conditions of Payment API.

Available resources

Access requirements

  • A valid authentication token is required to access the API. How to authenticate your application
  • Please note that Autopay provides separate API credentials to manage payments for different operators.

Note: Integrators must provide Autopay with two callback URLs, one for Callback POST - Successful end of parking and the other for Callback POST - Cancel parking. We support URLs protected with the following authentication methods:
  • basic authentication,
  • token authentication (uses the Authorization header),
  • API key (uses the X-API-Key header).

POST - Connect parking

This method allows you to register an external payment and connect it to the parking.

Endpoint

POST https://api.autopay.io/payment/v1/connect_parking

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
parking_area_code string yes Code of the parking facility in payment provider's system. This code has to be configured under the zone configuration (Provider codes) in Autopay.
reference string yes Your unique identifier for the parking. Commonly a primary key is used.
vehicle_reg string yes Vehicle registration number (license plate)
plate_issuer string yes County code of the plate issuer (ISO 3166-1 alpha-3)
plate_subdivision string no Region (subdivision) of the vehicle

Example request

{
    "parking_area_code": "area1",
    "reference": "ref1",
    "vehicle_reg": "123ABC",
    "plate_issuer": "NOR",
    "plate_subdivision": null
}

Success response

HTTP Code: 200 OK

Parameter Type Description
parking_id string The unique ID of the parking in Autopay
reference string Your unique identifier for the parking. Commonly a primary key is used.
start_time date-time Start time of the parking (ISO8601)

Example request

POST https://api.autopay.io/payment/v1/connect_parking

Example success responce

{
    "parking_id": "1234567890",
    "reference": "ref1",
    "start_time": "2019-02-26T11:52:16+0000"
}

POST - Manual stop

This method allows the payment provider to request a manual stop for parking in Autopay if, for example, an exit event is missed in the Autopay system. After a manual stop is requested, a Successful end of parking message with the details of the parking will be sent to the corresponding callback URL. However, a follow-up session will be created in the Autopay system. If a corresponding exit event happens, the follow-up session is finished and charged to the customer using the regular means in Autopay.

Note: The manual stop method should only be used if there is a missed exit event or some other issue with the parking. It should not be used to allow customers to finish their parking using the external payment application.

Endpoint

POST https://api.autopay.io/payment/v1/manual_stop

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.
  • The headers must include a valid access token.
  • Please see the table below for post parameters.
Parameter Type Mandatory Description
parking_id string yes The unique ID of the parking in Autopay
reference string yes Your unique identifier for the parking. Commonly a primary key is used.
end_time datetime (ISO 8601) yes End time of the parking provided by the payment provider

Example request

{
    "parking_id": "1234567890",
    "reference": "ref1",
    "end_time": "2019-02-28T11:52:16+0000"
}

Success response

HTTP Code: 200 OK


Callback POST - Successful end of parking

When parking ends successfully, Autopay will send a POST request with the parking details to the provided success callback URL. Parking is considered successful if Autopay finishes the parking successfully or the payment provider makes a manual stop request.

Parking is successfully ended

Parameter Type Description
parking_id string The unique ID of the parking in Autopay
reference string Your unique identifier for the parking. Commonly a primary key is used.
end_time date-time End time of the parking provided by the payment provider (ISO8601).
cost:
currency string Currency of payment
vat_percent decimal VAT percent of payment
net_amount decimal Amount of payment without VAT
vat_amount decimal Amount of VAT
gross_amount decimal Amount of payment with VAT

Example request body

{
    "parking_id": "1234567890",
    "reference": "ref1",
    "end_time": "2019-02-28T11:52:16+0000",
    "cost": {
        "currency": "NOK",
        "vat_percent": 20.0,
        "net_amount": 100.0,
        "vat_amount": 20.0,
        "gross_amount": 120.0
    }
}

Callback POST - Cancel parking

If the parking goes into an error state in Autopay and shouldn't be charged to the customer, Autopay sends a cancellation message to the provided cancel callback URL.

Parking is canceled

Parameter Type Description
parking_id string The unique ID of the parking in Autopay
reference string Your unique identifier for the parking. Commonly a primary key is used.

Example request body

{
    "parking_id": "1234567890",
    "reference": "ref1"
}

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
missing_property A required property in request is missing
message_not_readable A problem with the request body
method_not_supported Used REST method not supported
argument_type_mismatch A request argument is of incorrect type
server_communication_error Error communication with server
operator_not_found_error Operator not found
missing_operator_token_error Missing operator in access token