Customer club API

The customer club API allows third-party customer clubs to integrate with Autopay and add or remove customers from their loyalty programs. The API also allows integrators to verify the status of the join requests.


Available resources

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
customer_club string yes Code of the customer club in Autopay
email string no if a phone is present E-mail address of the customer
phone no if a e-mail address is present
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 Vehicle registration number (number plate) of the customer's vehicle
plate_issuer string yes Three character county code of the country where the license plate was issued (ISO 3166-1 Alpha-3 code is used)
plate_subdivision string no The vehicle's region (subdivision) applies only to certain countries where regions are reflected on vehicle license plates
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

    
    {
      "customer_club": "AUTOPAY",
      "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 a 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 resigned"
    }
    
    

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