Request
T-WEB Server | T-WEB Login URL | API Endpoint |
www | https://www.tweb.com.au/v2/ |
https://publicapi.tweb.com.au/v1/AuthorizeWithFuelCard |
www2 | https://www2.tweb.com.au/v2/ |
https://publicapi2.tweb.com.au/v1/AuthorizeWithFuelCard |
test | https://test.tweb.ttfuel.com/v2/ |
https://test-publicapi.tweb.ttfuel.com/v1/AuthorizeWithFuelCard |
Parameters
The endpoint only accepts HTTP POST requests. The following POST parameters must be included with the request:
Field | Type | Required Field | Description |
CardNumber | string | Yes | The Track 2 Primary Account Number (PAN). Positioned between the Start Sentinel and the Field Separator/or the End Sentinel (when there is no Field Separator). (19 digits max.) |
Track2Data | string | Yes | The entire track 2 data including the start sentinel and the end sentinel (37 characters max.) |
SecurityCode | string | Yes | Four digit security code |
AuthorizationReference | string | Yes | The terminal's unique authorization reference (50 characters max.) |
FuelGrade | integer | Yes7 | The fuel grade selected by the customer at the terminal (An integer in the range 1..48) |
PreAuthorizationAmount | decimal | Yes7 | The pre-authorization amount with 2 decimal places precision |
LocationID | integer | Yes | The refuelling site's location Id |
TerminalID | string | Yes | The terminal Id (8 characters max.)(Terminal serial number) |
ApplicationID | string | Yes | The terminal's application Id that is issued by TT Fuel (36 characters) |
TargetID | string | No | Optional client reference Id (100 characters max.) Must only contain characters a-z, A-Z, 0-9 and _ |
Notes:
- A T-WEB fuel grade is passed in this call, the OPT has provision to map a fuel grade to a native product name.
- A security code is required for all API fuel card authorizations.
- Location Ids are managed in the T-WEB backend and issued to a technician in the process of commissioning the OPT.
- Any of the tabled prompt options can be used with AuthorizeWithFuelCard but the Vehicle Registration and Fleet Number prompts may require alphanumeric entry which will not be possible at an OPT. In this case should an interlock be applied in the UI to prevent the vehicle registration number and fleet number prompts from being enabled? (Or should this interlock be implicit in the response to a particular authorization device type?)
- Data entered at an optional prompt is not validated by the backend (I.e. odometer, user id, etc., see table of prompt options below)
- If the authorization (i.e. a call to AuthorizeWithFuelCard) contains a FuelGrade field the backend will factor in grade restrictions in its response. If the authorization doesn't contain a FuelGrade field the backend's response will contain an AllowableProducts field if there are product restrictions on the card.
- Required for WEX card authorizations but not for white card authorizations.
Request Examples
json
curl -X POST https://test-publicapi.tweb.ttfuel.com/v1/AuthorizeWithFuelCard -H 'Content-Type: application/json' -d '{ "AccessToken":"B8C2D117DEAC75FD8C5ADF65DB45D0A2E7B3AEF1", "CardNumber":"7001230000700153", "Track2Data":";7001230000700153=29126018400007770?", "SecurityCode":"1234", "AuthorizationReference":"Rs4ewr7C8YRqYIByrXq5eHS", "FuelGrade":"3", "PreAuthorizationAmount":"22.00", "LocationID":"97538", "TerminalID":"24987516", "ApplicationID":"2ce0dbac-17e1-4f41-8ba4-ffe71052310a", "TargetID":"ziIU_PXm_GH110YmH" }'
x-www-form-urlencoded
curl -X POST https://test-publicapi.tweb.ttfuel.com/v1/AuthorizeWithFuelCard -H 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'AccessToken=B8C2D117DEAC75FD8C5ADF65DB45D0A2E7B3AEF1' --data-urlencode 'CardNumber=7001230000700153' --data-urlencode 'Track2Data=;7001230000700153=29126018400007770?' --data-urlencode 'SecurityCode=1234' --data-urlencode 'AuthorizationReference=Rs4ewr7C8YRqYIByrXq5eHS' --data-urlencode 'FuelGrade=3' --data-urlencode 'PreAuthorizationAmount=22.00' --data-urlencode 'LocationID=97538' --data-urlencode 'TerminalID=24987516' --data-urlencode 'ApplicationID=2ce0dbac-17e1-4f41-8ba4-ffe71052310a' --data-urlencode 'TargetID=ziIU_PXm_GH110YmH'
Response
The response from the authorisation endpoint has the following JSON format:
Example 1:
Method: AuthorizeWithFuelCard { "Error": { "Code": 0, "Status": "OK" }, "Data": { "Meta": { "Title": "Authorize With Fuel Card", "TotalRecords": 1, "Endpoint": "/v1/AuthorizeWithFuelCard", "TargetID": "ziIU_PXm_GH110YmH", "Hash": "DC015DB1B5693A447C64F9D9EDD3FCE26E52D78A" }, "Items": [ { "CardNumber": "7001230000700153", "Track2Data": ";7001230000700153=29126018400007770?", "SecurityCode": "1234", "AuthorizationReference": "Rs4ewr7C8YRqYIByrXq5eHS", "FuelGrade": 3, "PreAuthorizationAmount": 22, "LocationID": 97538, "TerminalID": "24987516", "ApplicationID": "2ce0dbac-17e1-4f41-8ba4-ffe71052310a", "IPAddress": "127.0.0.1", "AuthorizationCode": "1747286550", "PurchaseLimit": { "ApprovedAmount": 100, "CurrencyCode": "AUD" }, "Prompts": [ 1 ], "Discounts": { "ApplyDiscount": true, "DiscountType": "cents/Litre", "DiscountRate": 4, "ApplyTieredDiscount": false, "TieredVolume": 0, "TieredType": "", "TieredRate": 0 } } ] } }
Example 2:
Method: AuthorizeWithFuelCard { "Error": { "Code": 0, "Status": "OK" }, "Data": { "Meta": { "Title": "Authorize With Fuel Card", "TotalRecords": 1, "Endpoint": "/v1/AuthorizeWithFuelCard", "TargetID": "ziIU_PXm_GH110YmH", "Hash": "DC015DB1B5693A447C64F9D9EDD3FCE26E52D78A" }, "Items": [ { "CardNumber": "7001230000700153", "Track2Data": ";7001230000700153=29126018400007770?", "SecurityCode": "1234", "AuthorizationReference": "Rs4ewr7C8YRqYIByrXq5eHS", "PreAuthorizationAmount": 22, "LocationID": 97538, "TerminalID": "24987516", "ApplicationID": "2ce0dbac-17e1-4f41-8ba4-ffe71052310a", "IPAddress": "127.0.0.1", "AuthorizationCode": "2067889397", "PurchaseLimit": { "ApprovedAmount": 100, "CurrencyCode": "AUD" }, "Prompts": [ 1 ], "AllowableProducts": [ 3, 9 ] } ] } }
Example 3:
Method: AuthorizeWithFuelCard { "Error": { "Code": 4919, "Status": "Declined Authorization" }, "Data": { "Meta": { "Title": "Authorize With Fuel Card", "Endpoint": "/v1/AuthorizeWithFuelCard", "TargetID": "ziIU_PXm_GH110YmH", "Hash": "DC015DB1B5693A447C64F9D9EDD3FCE26E52D78A" }, "Items": [ { "DeclinedAuthorization": { "ServiceCode": "TT", "DeclinedCode": 34, "DeclinedReason": "The Access ID is prohibited from using all the grades supplied in the authorization request." } } ] } }
Response Format
Field | Type | Description |
Error | ||
Code | integer | 0 if the call to AuthorizeWithFuelCard was successful otherwise an error code in the range 4900-4999 representing a specific error |
Status | string | Description of error |
Meta | ||
Title | string | Endpoint Title |
TargetID | string | Optional client reference Id (100 characters max.) Must only contain characters a-z, A-Z, 0-9 and _ |
Items | ||
CardNumber | string | The Track 2 Primary Account Number (PAN). Positioned between the Start Sentinel and the Field Separator/or the End Sentinel (when there is no Field Separator). (19 digits max.) |
Track2Data | string | The entire track 2 data including the start sentinel and the end sentinel (37 characters max.) |
SecurityCode | string | Four digit security code |
AuthorizationReference | string | The terminal's unique authorization reference (50 characters max.) |
FuelGrade | integer | The fuel grade selected by the customer at the terminal (If supplied in the authorization) |
PreAuthorizationAmount | decimal | The pre-authorization amount with 2 decimal places precision |
LocationID | integer | The refuelling site's location Id |
TerminalID | string | The terminal Id |
ApplicationID | string | The terminal's application Id that is issued by TT Fuel (36 characters) |
IPAddress | string | The IP address of the terminal |
AuthorizationCode | string | Payment gateway authorization code |
PurchaseLimit.ApprovedAmount | decimal | The purchase is limited to an approved amount (only included in the response when a purchase limit is applicable) |
PurchaseLimit.CurrencyCode | string | Three character ISO currency code (I.e. 'AUD') |
Prompts | array of integer | Prompt for customer input (see below table of enumerated prompt options) The response may include any combination of the tabled prompt options. |
Discounts.ApplyDiscount | boolean | Apply a discount to the final amount |
Discounts.DiscountType | string | The type of discount, expressed as the fractional unit of the main currency per volume unit, e.g. 'cents/Litre', cents/gallon' or as a percentage of the final amount, e.g. 'percent' |
Discounts.DiscountRate | decimal | The discount rate with 1 decimal place precision |
Discounts.ApplyTieredDiscount | boolean | Apply a discount that comes into effect when the volume of the fuel dispensed is above the tiered volume. The discount applies to all the fuel dispensed |
Discounts.TieredVolume | integer | The threshold volume that triggers the tiered discount rate |
Discounts.TieredType | string | The type of discount, e.g. 'cents/Litre', 'cents/gallon' or 'percent' |
Discounts.TieredRate | decimal | The tiered discount rate with 1 decimal place precision |
AllowableProducts | array of integer | An array of allowed fuel grades. The range of possible integer values in the array is 1..48. This field is only returned in the response if product restrictions have been applied to the card and the fuel grade (FuelGrade) wasn't supplied in the authorization request |
DeclinedAuthorization.ServiceCode | string | A string that indicates the service that was called in the authorization request (3 characters max., see appendix for a list of service codes) |
DeclinedAuthorization.DeclinedCode | integer | A response code that indicates the reason an authorization was declined (see appendix for a list of response codes) |
DeclinedAuthorization.DeclinedReason | string | A verbose reason the authorization was declined |
Prompts:
Prompt Code | Prompt | Data Type |
1 | User Id (aka driver Id) | string (12 characters max.) |
2 | Odometer | integer (7 digits max.) |
3 | Engine hours | decimal (1 decimal place precision) |
4 | Customer reference number | string (15 characters max.) |
5 | Vehicle registration number | string (10 characters max.) |
6 | Vehicle fleet number | string (15 characters max.) |
The Error JSON property is included in all responses from the TWeb Public API. The possible responses during authorisation are:
Error Code | Error Name | Notes |
0 | OK | |
1 | Server Error | Unhandled error occurs during processing |
4000 | Rate Limit Exceeded | This is the second request within a 1 second period. |
4900 | Card number can't be blank | |
4902 | Invalid card number | |
4903 | Invalid Application Id | |
4909 | Security code can't be blank | |
4910 | Authorization Reference can't be blank | |
4911 | Location Id can't be blank | |
4912 | No refuelling site found for this location Id | |
4913 | Fuel card doesn't have a security code | |
4916 | Track 2 data can't be blank | |
4918 | Gateway request timeout | |
4919 | Declined Authorization | A declined authorization contains a 'DeclinedAuthorization' record in the response |
4920 | Terminal Id can't be blank | |
4921 | Pre-authorization amount can't be blank | |
4923 | Fuel Grade can't be blank | |
4931 | Invalid Fuel Grade | Fuel Grade can't be larger than 48 |
Declined Authorization Codes:
Response Code | Description |
16 | Disabled Access ID |
17 | Invalid Access ID |
19 | Expired Access ID |
20 | Immature Access ID |
21 | Inactive Access ID Account |
22 | Attempting to refuel outside the time restrictions of the Access ID |
23 | Inactive User ID |
24 | Invalid User ID |
25 | Invalid User ID PIN |
26 | Inactive User ID Account |
29 | Daily Quantity Limit Exceeded |
30 | Daily Purchase Limit Exceeded |
31 | Account Purchase Limit Exceeded |
32 | No available credit on a Prepaid card |
33 | Daily Transaction Limit Exceeded |
34 | The Grade is Restricted |
35 | Fraud Detected |
36 | ID in Use |
36 | Prepaid card in pre-auth. state (Card in use) |
38 | WEX Authorization Declined |
39 | WEX Insufficient Funds |
40 | Invalid Driver Licence |
41 | Invalid Dangerous Goods Driver Licence |
42 | Invalid SLP Driver Passport |
43 | Invalid Dangerous Goods Vehicle Licence |
44 | Invalid SLP Pass-2-Load Inspection Certificate |
45 | Attempting to refuel outside the time restrictions of the User ID |
46 | The Product Category is Restricted |