- Regular - the customer club can send in members of the customer club, and once the end user signs up for Autopay, the customer club permit is applied to the customer. The integrators are also able to verify the status of the requests.
- External (Webhook) - Autopay requests a predefined URL with the ID (either a license plate or a loyalty membership ID) and gets a response about whether the ID is a valid membership.
- Anonymous - the integrator can send in license plate numbers for customer club members, and the customer club permit will be applied to the customer without requiring Autopay registration.
Regular customer clubs
Available resources
- POST - Join a customer club
- GET - Get the registration status
- DELETE - Resign from a customer club
- Error handling
Access requirements
- A valid authentication token is required to access the API. How to authenticate your application
- Access to the Customer Club API is offered as a paid service. Please contact your Autopay representative for details.
POST - Join a customer club
This method allows you to add a customer to a customer club. The membership is linked to the customer's Autopay.io profile. If no profile exists, Autopay asks the customer to create one. Customer club membership is activated once the customer has agreed to join. If an existing profile exists in Autopay.io, Autopay will discard all the information in the request, except the wish to join the customer club; this is done for security reasons.
Endpoint
POST https://api.autopay.io/customer_club/v2/join
Request parameters
- The request body must be in JSON format and HTTP headers must include
Content-Type: application/json. - The HTTP headers must include a valid access token with scope:
customer_club.
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| string | no | E-mail address of the customer. Mandatory when phone is not set | |
| phone | no | Mandatory when email is not set | |
| dialing_code | string | yes | The country code of the customer's phone number, only numeric values, and the "+" symbol are accepted |
| number | string | yes | Telephone number of the customer, only numeric values are accepted |
| first_name | string | yes | First name of the customer |
| last_name | string | no | Last name of the customer |
| vehicles | array | no | |
| vehicle_reg | string | yes | License plate number of the customer's vehicle |
| plate_issuer | string | yes | The plate country code in Alpha 3 code |
| plate_subdivision | string | no | Region of the vehicle registration, if it exists |
| language_code | string | no | Two character language code (List_of_ISO_639-1_codes). This is used to determine which language is used for text messages and emails sent to the customer. The list of supported languages corresponds to Autopay.io |
Request example
{
"email":"test123@test.com",
"phone":{
"dialing_code":"47",
"number":"22849200"
},
"first_name":"Test",
"last_name":"Client",
"vehicles":[
{
"vehicle_reg":"123ABC",
"plate_issuer":"EST"
},
{
"vehicle_reg":"456CBE",
"plate_issuer":"FIN",
"plate_subdivision":"PS"
}
],
"language_code":"en"
}Success response
HTTP Code: 200 OK
| Parameter | Type | Description |
|---|---|---|
| success | boolean | Request was successful |
| registration_id | string | ID of the customer club registration in Autopay |
| message | string | Detailed success or error message |
Example success response
{
"success": true,
"registration_id": "A1B2C3D4",
"message": "Customer club join request processed"
}GET - Get the registration status
This method allows you to get the registration status of the end-user based on the registration ID you received in the join request response.
Endpoint
GET https://api.autopay.io/customer_club/v2/status/{registrationId} Request parameters
- The HTTP headers must include a valid access token with scope:
customer_club. - The request path must include the registration ID (e.g. A1B2C3D4).
Request example
GET https://api.autopay.io/customer_club/v2/status/A1B2C3D4
Success response
HTTP Code: 200 OK
| Parameter | Type | Description |
|---|---|---|
| success | boolean | Request was successful |
| status | string | Status of the customer club registration |
Example success response
{
"success": true,
"status": "PENDING"
}DELETE - Resign from a customer club
This method allows you to cancel the end-user's membership to a customer club.
Endpoint
DELETE https://api.autopay.io/customer_club/v2/leave/{registration_id} Request parameters
- The HTTP headers must include a valid access token with scope:
customer_club. - The path must include registration id of the customer (e.g. A1B2C3D4).
Request example
DELETE https://api.autopay.io/customer_club/v2/leave/A1B2C3D4
Success response
| Parameter | Type | Description |
|---|---|---|
| success | boolean | Request was successful |
| message | string | Detailed success or error message (see examples) |
Example success responses
Customer left the customer club
{
"success": true,
"message": "Customer club left"
}Customer has not verified joining the customer club
{
"success": true,
"message": "Request to join AUTOPAY customer club is canceled"
}Error handling
Error message paramaters
| Parameter | Type | Description |
|---|---|---|
| error_id | string | Specific code of error, see below for possible values |
| message | string | Description of error |
Example error response
{
"error_id": "missing_property",
"message": "Missing property: customer_club"
}Error codes and messages
| Error id | Explanation |
|---|---|
| authentication_error | There is a problem with authentication (e.g., "Authorization required") |
| argument_type_mismatch | A request argument is of incorrect type |
| forbidden | Unauthorized |
| get_status_customer_club_error | Get customer club status error |
| internal_server_error | Internal server error |
| invalid_join_request_error | Request was invalid |
| join_customer_club_error | There is an invalid parameter value in the request (e.g., "Invalid phone number!") |
| leave_customer_club_error | Error leaving customer club |
| message_not_readable | A problem with the request body |
| method_not_supported | Used REST method not supported |
| missing_property | There is a parameter missing in the request (e.g., "Missing property: customer_club") |
| operator_not_found_error | Operator not found |
External (Webhook) customer clubs
When using the External (Webhook) customer club, Autopay requests a predefined URL with the hashed license plate and gets a response about whether there is a valid membership. When creating an External (Webhook) customer club, the operator has to define the external URL where the request will go and the corresponding credentials.Authentication
For the request endpoint, Autopay supports four authentication methods:- Basic authentication
- API key
- Token
- Token provider.
Request
The external customer club works with license plate hashed with the SHA-256 algorithm.Request example
https://external-integration.something.com/44b5ef2d144653d3fb89c615777721582be3d5143fadd584fa35504c67ef2e9e
Response
The expected response is either success with member level (optional), or unsuccessful.Response examples
Successful response{
"is_member": true,
"member_level": "GOLD"
}{
"is_member": false
}Anonymous customer clubs
Available resources
- POST - Add vehicle to customer club
- DELETE - Delete vehicle from a customer club
- GET - Get vehicle id
- How to hash a vehicle license plate number with HMAC-SHA256 algorithm
- Error handling
Access requirements
- A valid authentication token is required to access the API. How to authenticate your application
- Access to the Customer Club API is offered as a paid service. Please contact your Autopay representative for details.
POST - Add vehicle to customer club
This method allows you to add a vehicle to a customer club. Vehicle license plate number must be hashed with HMAC-SHA256 algorithm in hex format using secret key provided on anonymous customer club creation.
Endpoint
POST https://api.autopay.io/customer_club/v2/add_vehicle
Request parameters
- The request body must be in JSON format and HTTP headers must include
Content-Type: application/json. - The HTTP headers must include a valid access token with scope:
customer_club.
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| hashed_license_plate_number | string | yes | License plate number hashed with HMAC-SHA256 in hex format. |
Request example
{
"hashed_license_plate_number":"8d15903f338c16111443163cda663bb031ebc5fe4ffea0e0da0f48f07f7eee7f"
}Success response
HTTP Code: 200 OK
| Parameter | Type | Description |
|---|---|---|
| success | boolean | Request was successful |
| id | string | internal ID of the added vehicle |
| message | string | Detailed success or error message |
Example success response
{
"success": true,
"id": "b679209d-bc8d-43a7-853b-c8eb92ff2e16",
"message": "Vehicle has been added to customer club"
}DELETE - Delete vehicle from a customer club
This method allows you to remove vehicle from a customer club.
Endpoint
DELETE https://api.autopay.io/customer_club/v2/remove_vehicle/{vehicle_id} Request parameters
- The HTTP headers must include a valid access token with scope:
customer_club. - The path must include registration id of the vehicle (e.g. b679209d-bc8d-43a7-853b-c8eb92ff2e16).
Request example
DELETE https://api.autopay.io/customer_club/v2/remove_vehicle/b679209d-bc8d-43a7-853b-c8eb92ff2e16
Success response
| Parameter | Type | Description |
|---|---|---|
| success | boolean | Request was successful |
Example success response
{
"success": true
}GET - Get vehicle id
This method allows you to get the vehicle id based on hashed license plate number you provided in the add vehicle process.
Endpoint
GET https://api.autopay.io/customer_club/v2/get_vehicle_id/{hashed_license_plate_number} Request parameters
- The HTTP headers must include a valid access token with scope:
customer_club. - The request path must include the vehicle hashed license plate number in hex format (e.g. 8d15903f338c16111443163cda663bb031ebc5fe4ffea0e0da0f48f07f7eee7f).
Request example
GET https://api.autopay.io/customer_club/v2/get_vehicle_id/8d15903f338c16111443163cda663bb031ebc5fe4ffea0e0da0f48f07f7eee7f
Success response
HTTP Code: 200 OK
| Parameter | Type | Description |
|---|---|---|
| id | string | Vehicle internal id |
Example success responses
One vehicle
{
"ids": ["b679209d-bc8d-43a7-853b-c8eb92ff2e16"]
}Multiple vehicles
{
"ids": ["b679209d-bc8d-43a7-853b-c8eb92ff2e16", "a13bcad3-068c-490b-97a8-f091e460f154"]
}How to hash a vehicle license plate number with HMAC-SHA256 algorithm
After creating an anonymous customer club, you get a popup with credentials on your screen, and there is a pepper value added in addition to clientId and clientSecret. Pepper is 32 characters long and consists only of alphanumeric characters. This pepper is the secret key used to produce a HMAC-SHA256 hashed vehicle license plate number. License plate is hashed without country code.
Example
- The
pepperprovided on anonymous customer club creation isbiflByamRgXSKbTyuLHp32oqniE7xjnWand you want to hash license plate TEST123. - Compute HMAC-SHA256 hash with TEST123 input and use the provided secret key.
- Encode the hash result to a hex string. Result should be:
8d15903f338c16111443163cda663bb031ebc5fe4ffea0e0da0f48f07f7eee7f
To validate your result, you can use one of online HMAC signature verifiers, such as this one.
Error handling
Error message paramaters
| Parameter | Type | Description |
|---|---|---|
| error_id | string | Specific code of error, see below for possible values |
| message | string | Description of error |
Example error response
{
"error_id": "customer_club_vehicle_not_found",
"message": "Customer club vehicle not found."
}Error codes and messages
| Error id | Explanation |
|---|---|
| authentication_error | There is a problem with authentication (e.g., "Authorization required") |
| argument_type_mismatch | A request argument is of incorrect type |
| forbidden | Unauthorized |
| internal_server_error | Internal server error |
| message_not_readable | A problem with the request body |
| method_not_supported | Used REST method not supported |
| missing_property | There is a parameter missing in the request (e.g., "Missing property: customer_club") |
| customer_club_not_found_by_id | Customer club not found |
| customer_club_vehicle_not_found_by_id | Customer club vehicle not found |