Fundamentally submitting a payment for an impound vehicle consists of 4 steps:
Finding the correct vehicle
finding its fees/total to the user
Creating the receipt
Creating the payment
Finding the correct vehicle is done by calling the /impound/lookup endpoint with a payload containing either
Partial or full VIN
License plate number & License state
Date + vehicle details
You’ll also need to send along your region code, and the statuses you’re interested in. In this case the status you’re interested in is “STORED”. Here is an example looking for vehicle in the test region of IMP-TS, in the stored status, with a particular license and license state
Here is an example of looking up by VIN
Looking up by vehicle details is more complicated, since you need our list of makes, models and colors.
You can get these lists by calling /api-web/api/refdata/{regionCode}/colors
/api-web/api/refdata/{regionCode}/makes
and once you have the make, you can request all models for that make using
/api-web/api/refdata/{regionCode}/models/by-make/{makeCode}
Once the user has selected a value for these they should select a date, then you can send those to us, for example.
Note that the limit is very important here, as you could end up returning many vehicles you allow the user to select something very broad, like all toyotas towed in January.
Once you have the correct vehicle you can then retrieve its fees by its vehicleId.
VehicleId is the unique id for each time a vehicle gets towed. If it gets towed twice, it will get 2 vehicleIds. You then make a request to the /impound endpoint which will get you the complete vehicle details including the fees as of the time of the request.
https://staging-api.autoreturn.net/api-web/api/impound?id=1067632
for example will give a response containing most of the details of the vehicle. In particular you’ll want to look at
currentLocation
which represents the best way to get into contact with whoever has current possession of the vehiclemake.name , model.name , color.name , license , licenseState.code
unpaidFeeItems
which contains all of the fee items that are not paid yet. If you want the total then you can sumunpaidFeeItems
.totalPrice
which is the total price of the vehicle, including tax.eligibleForRelease
indicates if the vehicle is currently releasable. Holds may prevent release of the vehicle, in which case you probably don’t want to let people pay for it.
Once the user has indicated that they want to pay you must collect contact information from the user, this is used to ensure that the vehicle is released to the correct person later in the process.
You then call the /createReceipt endpoint with the vehicleId and contact details the list of fees you want to pay. If you want to just always pay all of the fees then you can leave that element null or empty.
From this request you will receive a receiptId. This receipt must then be paid. call the /applyPayment endpoint with that receiptId and the details of the payment.
Note that even if a vehicle has been paid for, it might not be releasable if for example it has holds that prevent release.