Data Object
For this implementation, an object containing required properties as defined below is passed to the modal.
On triggering the modal, a booking is placed using data from the object and the user is prompted for their credit card details in order to complete the transaction.
If any of the required data is not present, an error is output detaling the data that is not present.
If transaction fails for some reason, the user is given a further two attempts to make payment before the transaction is failed permanently.
On successful transaction, the user is shown the success dialog.
Required Data
All transactions made using the data object must have the following:
Key | Description |
---|---|
booking_auth | The hashed and salted authorisation string for the transaction |
booking_id | Set this to 0 to create a new booking, or an existing booking ID if you preloaded a booking |
channels | Set this to the ID of the channel you wish to use for the transaction |
payee_name | The name of the person making payment as it appears on their credit/debit card |
payee_email | The email of the person making payment |
payee_country | The ISO 3166-1 alpha-2 value of the country of the person making payment |
currencies | The ISO 4217 value for the currency the travel item is being sold in (must match the currency of the channel in use) |
total | The total being billed in the currency of the channel in use as a cent value (e.g. $10.00 = 1000) |
New Bookings
Unless you have preloaded a booking, you will also have to supply the following booking specific fields, which will be used to create a new booking prior to the transaction:
Key | Description |
---|---|
country | The ISO 3166-1 alpha-2 value of the country the booking takes place in |
firstname | The firstname of the lead traveller |
surname | The surname of the lead traveller |
The email address of the lead traveller | |
date | The end date of travel in YYYY-MM-DD format |
Address Data
If your account is NOT enabled for Cardholder Present (all accounts are disabled for Cardholder Present by default) then you will need to supply the fields shown in the address data table.
Key | Description |
---|---|
payee_address | The adress of the person making payment |
payee_city | The city of the person making payment |
payee_postcode | The postcode/zip of the person making payment |
Optional Data
Key | Description |
---|---|
reference | Your own reference |
description | A description of the product being sold |
pax | The amount of people the product is for |
allocations | See Allocations objects for more details |
charge_channel | See Allocations objects for more details |
Data Object Example
<button id="trigger-modal" class='btn btn-primary'>Trigger Payment Modal</button>
<script>
window.tmtPaymentModalReady = function () {
const data = {
// Booking Data
booking_id: '0',
channels: '2',
country: 'GB',
date: '2020-05-12',
currencies: 'GBP',
total: '9999',
reference: 'test reference', // optional
description: 'Some holiday', // optional
pax: '3', // optional,
// Authentication
booking_auth: hashed_salted_auth_string,
// Lead Traveller
firstname: 'John',
surname: 'Smith',
email: 'john.smith@example.org',
// Payment details
payee_name: 'Jane Smith',
payee_email: 'jane.smith@example.org',
payee_address: '123 test addres',
payee_city: 'Test city',
payee_country: 'GB',
payee_postcode: '1234',
}
const button = document.getElementById('trigger-modal')
button.addEventListener('click', function () {
var tmtPaymentModal = new window.tmtPaymentModalSdk({
path: 'test-site',
data: data
})
})
}
</script>