up Version >= 1

Finalize Payment With Fuel Card

Request

T-WEB Server T-WEB Login URL API Endpoint
www https://www.tweb.com.au/v2/ https://publicapi.tweb.com.au/v1/FinalizePaymentWithFuelCard
www2 https://www2.tweb.com.au/v2/ https://publicapi2.tweb.com.au/v1/FinalizePaymentWithFuelCard
test https://test.tweb.ttfuel.com/v2/ https://test-publicapi.tweb.ttfuel.com/v1/FinalizePaymentWithFuelCard

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.)
AuthorizationReference string Yes The terminal's unique authorization reference (50 characters max.)
AuthorizationCode string Yes Payment gateway's authorization code
LocationID integer Yes The refuelling site's location Id
TargetID string No Optional client reference Id (100 characters max.) Must only contain characters a-z, A-Z, 0-9 and _
Transaction.Date string Yes A date in the format 'yyyy-mmdd hh:mm:ss'
Transaction.ID string No The FDC's transaction reference number
Transaction.ReceiptReference string Yes The terminal's receipt reference number (20 characters max.)
Transaction.PumpNumber integer Yes The pump number
Transaction.HoseNumber integer Yes The hose number
Transaction.FuelGrade integer Yes The fuel grade dispensed by the customer (An integer in the range 1..48)
Transaction.Quantity decimal Yes The quantity of fuel dispensed with 3 decimal places precision
Transaction.UnitCode string Yes Three character unit of measurement code (i.e. 'LTR' for litres, and 'USG' for US Gallons)
Transaction.UnitPrice decimal Yes The unit price of the fuel with 3 decimal places precision
Transaction.Amount decimal Yes The final amount with 3 decimal places precision (quantity * unit price - discounted amount)
Transaction.ApprovedAmount decimal No The approved amount with 3 decimal places precision
Transaction.Discounts.DiscountedAmount decimal No The discounted amount with 2 decimal places precision
Transaction.Discounts.DiscountType string No 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'
Transaction.Discounts.DiscountRate decimal No The discount rate with 1 decimal place precision
Transaction.CurrencyCode string Yes Three character ISO 4217 currency code (I.e. 'AUD' for Australian dollars)
Transaction.UserID string No The user Id (aka driver Id) (12 characters max. hexadecimal)
Transaction.Odometer integer No The vehicle's odometer reading (7 digits max.)
Transaction.EngineHours decimal No The vehicle's engine hours reading with 1 decimal place precision
Transaction.CustomerReference string No The customer reference number (15 characters max.)
Transaction.VehicleRegistrationNumber string No The vehicle registration number (10 characters max.)
Transaction.VehicleFleetNumber string No The vehicle fleet number (20 characters max.)

Notes

  1. Transaction record with the same Site, Date, CardNumber, Reference(ID), FuelGrade, and Quantity will only insert once into the system.

Request Examples

json

curl -X POST https://test-publicapi.tweb.ttfuel.com/v1/FinalizePaymentWithFuelCard
-H 'Content-Type: application/json' 
-d '{
	"AccessToken":"8B2E3355EC424FD01A01DBF043DA9C7016098502",
	"CardNumber":"7001230000700153",
	"Track2Data":";7001230000700153=29126018400007770?",
	"AuthorizationReference":"Rs4ewr7C8YRqYIByrXq5eHS",
	"AuthorizationCode":"348384808",
	"LocationID":"97538",
	"TargetID":"ziIU_PXm_GH110YmH",	
	"Transaction":{
		"Date":"2023-05-26 20:36:15",
		"ID":"123456",
		"ReceiptReference":"UVWXYZ",
		"PumpNumber":"1",
		"HoseNumber":"1",
		"FuelGrade":"3",
		"Quantity":"43.21",
		"UnitCode":"LTR",
		"UnitPrice":"1.875",
		"Amount":"81.02",
		"ApprovedAmount":"100",
		"Discounts":{
			"DiscountRate":"3.0",
			"DiscountType":"cents/Litre",
			"DiscountedAmount":"1.30"
		},
		"CurrencyCode":"AUD",
		"UserID":"1234",
		"Odometer":"87538",
		"EngineHours":"685",
		"CustomerReference":"WFnGiBWg6t",
		"VehicleRegistrationNumber":"ABC123",
		"VehicleFleetNumber":"F007"
	}
}'

x-www-form-urlencoded

curl -X POST https://test-publicapi.tweb.ttfuel.com/v1/FinalizePaymentWithFuelCard
-H 'Content-Type: application/x-www-form-urlencoded'
 --data-urlencode 'AccessToken=8B2E3355EC424FD01A01DBF043DA9C7016098502'
 --data-urlencode 'CardNumber=7001230000700153'
 --data-urlencode 'Track2Data=;7001230000700153=29126018400007770?'
 --data-urlencode 'AuthorizationReference=Rs4ewr7C8YRqYIByrXq5eHS'
 --data-urlencode 'AuthorizationCode=348384808'
 --data-urlencode 'LocationID=97538'
 --data-urlencode 'TargetID=ziIU_PXm_GH110YmH'
 --data-urlencode 'Transaction[Date]=2023-05-26 20:36:15'
 --data-urlencode 'Transaction[ID]=123456'
 --data-urlencode 'Transaction[ReceiptReference]=UVWXYZ'
 --data-urlencode 'Transaction[PumpNumber]=1'
 --data-urlencode 'Transaction[HoseNumber]=1'
 --data-urlencode 'Transaction[FuelGrade]=3'
 --data-urlencode 'Transaction[Quantity]=43.21'
 --data-urlencode 'Transaction[UnitCode]=LTR'
 --data-urlencode 'Transaction[UnitPrice]=1.875'
 --data-urlencode 'Transaction[Amount]=81.02'
 --data-urlencode 'Transaction[ApprovedAmount]=100'
 --data-urlencode 'Transaction[Discounts][DiscountRate]=3.0'
 --data-urlencode 'Transaction[Discounts][DiscountType]=cents/Litre'
 --data-urlencode 'Transaction[Discounts][DiscountedAmount]=1.30'
 --data-urlencode 'Transaction[CurrencyCode]=AUD'
 --data-urlencode 'Transaction[UserID]=1234'
 --data-urlencode 'Transaction[Odometer]87538'
 --data-urlencode 'Transaction[EngineHours]=685'
 --data-urlencode 'Transaction[CustomerReference]=WFnGiBWg6t'
 --data-urlencode 'Transaction[VehicleRegistrationNumber]=ABC123'
 --data-urlencode 'Transaction[VehicleFleetNumber]=F007'

Response

The response from the authorisation endpoint has the following JSON format:

Example 1:

Method: FinalizePaymentWithFuelCard
{
    "Error": {
        "Code": 0,
        "Status": "OK"
    },
    "Data": {
        "Meta": {
            "Title": "Finalize Payment With Fuel Card",
            "TotalRecords": 1,
            "Endpoint": "/v1/FinalizePaymentWithFuelCard",
            "TargetID": "ziIU_PXm_GH110YmH",
            "Hash": "E63DB7985B74C2AAB28A05E1CAF510307A2976C0"
        },
        "Items": [
            {
                "CardNumber": "7001230000700153",
                "Track2Data": ";7001230000700153=29126018400007770?",
                "AuthorizationReference": "Rs4ewr7C8YRqYIByrXq5eHS",
                "AuthorizationCode": "348384808",
                "LocationID": 97538,
                "Transaction": {
                    "Date": "2023-05-26 21:11:14",
                    "ID": "123456",
                    "ReceiptReference": "UVWXYZ",
                    "PumpNumber": 1,
                    "HoseNumber": 1,
                    "FuelGrade": 3,
                    "Quantity": 43.21,
                    "UnitCode": "LTR",
                    "UnitPrice": 1.875,
                    "Amount": 81.02,
                    "ApprovedAmount": 100,
                    "Discounts": {
                        "DiscountedAmount": 1.3,
                        "DiscountType": "cents/Litre",
                        "DiscountRate": 3
                    },
                    "CurrencyCode": "AUD",
                    "UserID": "1234",
                    "Odometer": 87538,
                    "EngineHours": 685,
                    "CustomerReference": "WFnGiBWg6t",
                    "VehicleRegistrationNumber": "ABC123",
                    "VehicleFleetNumber": "F007"
                }
            }
        ]
    }
}

Example 2:

Method: FinalizePaymentWithFuelCard
{
    "Error": {
        "Code": 4925,
        "Status": "Invalid Authorization Code"
    },
    "Data": {
        "Meta": {
            "Title": "Finalize Payment With Fuel Card",
            "Endpoint": "/v1/FinalizePaymentWithFuelCard",
            "TargetID": "ziIU_PXm_GH110YmH",
            "Hash": "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709"
        },
        "Items": []
    }
}

Response Format

Field Type Description
Error
Code integer 0 if the call to FinalizePaymentWithFuelCard 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.)
AuthorizationReference string The terminal's unique authorization reference (50 characters max.)
AuthorizationCode string The payment gateway's authorization code
LocationID integer The refuelling site's location Id
Transaction.Date string A date in the format 'yyyy-mmdd hh:mm:ss'
Transaction.ID string The FDC's transaction reference number
Transaction.ReceiptReference string The terminal's receipt reference number (20 characters max.)
Transaction.PumpNumber integer The pump number
Transaction.HoseNumber integer The hose number
Transaction.FuelGrade integer The fuel grade dispensed by the customer (An integer in the range 1..48)
Transaction.Quantity decimal The quantity of fuel dispensed with 3 decimal places precision
Transaction.UnitCode string Three character unit of measurement code (i.e. 'LTR' for litres, and 'USG' for US Gallons)
Transaction.UnitPrice decimal The unit price of the fuel with 3 decimal places precision
Transaction.Amount decimal The final amount with 3 decimal places precision (quantity * unit price - discounted amount)
Transaction.ApprovedAmount decimal The approved amount with 3 decimal places precision
Transaction.Discounts.DiscountedAmount decimal The discounted amount with 2 decimal places precision
Transaction.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'
Transaction.Discounts.DiscountRate decimal The discount rate with 1 decimal place precision
Transaction.CurrencyCode string Three character ISO 4217 currency code (I.e. 'AUD' for Australian dollars)
Transaction.UserID string The user Id (aka driver Id) (12 characters max. hexadecimal)
Transaction.Odometer integer The vehicle's odometer reading (7 digits max.)
Transaction.EngineHours decimal The vehicle's engine hours reading with 1 decimal place precision
Transaction.CustomerReference string The customer reference number (15 characters max.)
Transaction.VehicleRegistrationNumber string The vehicle registration number (10 characters max.)
Transaction.VehicleFleetNumber string The vehicle fleet number (20 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  
4910 Authorization Reference can't be blank  
4911 Location Id can't be blank  
4912 No refuelling site found for this location Id  
4916 Track 2 data can't be blank  
4918 Gateway request timeout  
4922 Invalid Pump or Hose Number Neither the pump number or hose number can be zero
4923 Fuel Grade can't be blank  
4924 Invalid Transaction Discount Type The allowed discount types are "percent", "cents/Litre", and "cents/gallon"
4925 Invalid Authorization Code The authorization code must be numeric
4926 Receipt Reference can't be blank  
4928 Invalid Currency Code The currency code must be a valid ISO 4217 code
4930 Invalid User Id Format The User ID must be hexadecimal only
4931 Invalid Fuel Grade Fuel Grade can't be larger than 48