- 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.
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
}