NAV
php python shell javascript

Introduction

The Trust My Travel Payment Modal allows you to process 3DS secure transactions in multiple currencies with no API use required. It is PCI Level 1 compliant with all sensitive credit card data tokenised by a PCI approved third party vendor.

You have the option of completing the transaction process in the app using a purchase transaction, or retaining control of the transfer of funds by using the app to authorize the customer's card and following this up with a capture request to our API.

Quickstart

To test the modal implementation in a sandbox environment, you will you need to include the following script on your checkout page. This script must always be loaded from tmtprotects.com

<script src="https://payment.tmtprotects.com/tmt-payment-modal.3.6.1.js"></script>

Authentication String

If you don't want to use the TmtAuthstring class you can write your own authentication string generation method based on the example below

// Get current time in GMT.
$time_now = new DateTime('now', new DateTimeZone('GMT'));

// Create timestamp in 'YmdHis' format. E.g. 20190812055213 
$timestamp = $time_now->format('YmdHis');

// Concatenate the values for channels, currencies, total and your timestamp in that order.
$booking_vars = [
    'channels'   => 2,
    'currencies' => 'USD',
    'total'      => 9999,
    'timestamp'  => $timestamp,
];

$string = implode('&', $booking_vars);

// SHA256 the string.
$auth_string = hash( 'sha256', $string );

// Fetch your channel secret and concatenate to string.
$secret = 'MYCHANNELSECRET123';
$salted_auth_string = hash( 'sha256', $auth_string . $secret );

// Concatenate with timestamp.
$final_auth_string = $salted_auth_string . $timestamp;
// Coming soon
// Coming soon
// Get current time in GMT.
const date = new Date();
const utcDate = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());

// Create timestamp in 'YYYYMMDDHHmmss' format. E.g. 20190812055213 
const timestamp = format(utcDate, 'YYYYMMDDHHmmss')

// Concatenate the values for channels, currencies, total and your timestamp in that order.
const bookingVars = {
    channels: 2,
    currencies: 'USD',
    total: 9999,
    timestamp: timestamp
}

let string = []
for (const key in bookingVars) {
    string.push(bookingVars[key])
}
string = string.join('&')

// SHA256 the string.
const encode = crypto.createHash('sha256').update(string).digest('hex')

// Fetch your channel secret and concatenate to string.
const { CHANNEL_SECRET } = 'MYCHANNELSECRET123'

const authString = crypto.createHash('sha256').update(
    Buffer.concat([
        new Buffer(encode),
        new Buffer(CHANNEL_SECRET)
    ])
).digest('hex')

// Concatenate with timestamp.
const appAuthString = authString + timestamp;

Make sure to replace MYCHANNELSECRET123 with the channel secret of the channel you are transacting in.

In order for the Payment Modal to authenticate itself, it passes an authorisation string to the API.

To generate this, you will need:

These values are used to create a hashed and salted authentication string.

TMT provide a helper class for PHP users via the TmtAuthstring\Create class on the TMT Github Page.

In order to validate the string you generate, you can input your Channel Secret, Channel ID, Currency and Total values into the Auth Test page and ensure that the value you have generated is a correct match.

To further extend integrity of data by including additional fields in the auth string, please refer to the Extended Authorisation String section

Once you are confident that you are successfully generating valid authentication strings, you will need to decide on whether you wish to initialise the modal by passing in an object of required data, or if you would like the modal to injest required data from a HTML form.

Object Configuration

<script src="https://payment.tmtprotects.com/tmt-payment-modal.3.6.1.js"></script>
<script>
window.tmtPaymentModalReady = function () {

  const button = document.getElementById("trigger-modal")

  button.addEventListener("click", function () {

    const tmtPaymentModal = new window.tmtPaymentModalSdk({
      path: "SITE_PATH",
      environment: "test",
      data: {
        // Authentication
        booking_auth: "AUTHENTICATION_STRING",
        // Booking Data
        booking_id: "0",
        channels: "10100",
        country: "FR",
        date: "2030-05-12",
        currencies: "GBP",
        total: "5000",
        // 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 address",
        payee_city: "Test city",
        payee_postcode: "0000",
        payee_country: "GB",
        // Optional
        reference: "FOO123",
        description: "Holiday for two in Paris",
        "pax": 2
      }
    })
  })
}
</script>  

Make sure to replace SITE_PATH with your site path, and AUTHENTICATION_STRING with the authentication string generated as instructed in the previous section.

Once you have generated a valid authentication string, it can be used along with the required values below to configure the modal for use.

In addition, the environment option must be set to test

Demo

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
country^ The ISO 3166-1 alpha-2 value of the country the booking takes place in
date^ The end date of travel in YYYY-MM-DD format
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)
firstname^ The firstname of the lead traveller
surname^ The surname of the lead traveller
email^ The email address of the lead traveller
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_address The address of the person making payment
payee_city The city of the person making payment
payee_postcode The postcode/zip of the person making payment
payee_country The ISO 3166-1 alpha-2 value of the country of the person making payment
reference^^ Your own reference
description^^ A description of the product being sold
pax^^ The amount of people the product is for
allocations^^ Allocations to other channels
charge_channel^^ The channel to apply charges to if an allocation is used

Allocations

Example: £10.00 of a total of $220.00 is being allocated to a channel with the ID: 23. TMT's charges for the transaction will be deducted from this channel and not the master channel

{
    booking_id: '0',
    channels: 2,
    currencies: 'USD',
    total: '22000',
    ...
    allocations: [{
        channels: 23,
        currencies: 'GBP',
        operator: 'flat',
        total: 1000
    }],
    charge_channel: 23
}

Example 5% of a total of $220.00 is being allocated to a channel with the ID: 23. TMT's charges for the transaction will be deducted from this channel and not the master channel

{
    booking_id: '0',
    channels: 2,
    currencies: 'USD',
    total: '22000',
    ...
    allocations: [{
        channels: 23,
        currencies: 'GBP',
        operator: 'percent',
        total: 5
    }],
    charge_channel: 23
}

Example: £10.00 of a total of $220.00 is being allocated to a channel with the ID: 23. TMT's charges for the transaction will be deducted from the master channel with id = 2. There is no need to indicate this via the request as TMT payments are deducted from the master channel by default.

{
    booking_id: '0',
    channels: 2,
    currencies: 'USD',
    total: '22000',
    ...
    allocations: [{
        channels: 23,
        currencies: 'GBP',
        operator: 'flat',
        total: 1000
    }]
}

The Data Object implementation also allows for allocating funds to alternative channels. These allocations can be flat amounts or percentages of the transaction total. You can also nominate which channel incurs our charges.

Allocation Object Fields

Key Type Description
channels integer The ID of the allocation channel
currencies string The currency of the allocation channel
total integer The total in cents or as a percentage to be allocated
operator string Either "flat" or "percent"

Additional Request Fields

Key Type Description
charge_channel integer The ID of the channel to deduct TMT's charges from. If not included, this will default to the main transaction channel

Notes

Form Configuration

<form id="tmt-payment-form">

  <!-- Authentication -->
  <input type="hidden" class="tmt_booking_auth" value="AUTHENTICATION_STRING">

  <!-- Booking Data -->
  <input type="hidden" class="tmt_booking_id" value="0">
  <input type="hidden" class="tmt_channels" value="10100">

  <label for="country"label>Country Travelling Too</label>
  <input name="country" class="tmt_country" value="FR">

  <label for="date"label>Date of Completion</label>
  <input name="date" class="tmt_date" value="2030-05-12">

  <label for="currencies"label>Booking Currency</label>
  <input name="currencies" class="tmt_currencies" value="GBP">

  <label for="total"label>Booking Total</label>
  <input name="total" class="tmt_total" value="5000">

  <!-- Lead Traveller -->
  <label for="firstname"label>Lead Traveller Name</label>
  <input name="firstname" class="tmt_firstname" value="John">

  <label for="surname"label>Lead Traveller Surame</label>
  <input name="surname" class="tmt_surname" value="Smith">

  <label for="email"label>Lead Traveller Email</label>
  <input name="email" class="tmt_email" value="john.smith@example.org">

  <!-- Payment Details -->
  <label for="payee_name"label>Cardholder Name</label>
  <input name="payee_name" class="tmt_payee_name" value="Jane Smith">

  <label for="email">Cardholder Email</label>
  <input type="email" name="email_address" class="tmt_payee_email" value="jane.smith@example.org">

  <label for="address">Cardholder Address</label>
  <input name="address" type="text" class="tmt_payee_address" value="123 test address">

  <label for="city">Cardholder City</label>
  <input name="city" type="text" class="tmt_payee_city" value="Test city">

  <label for="zip">Cardholder Postcode</label>
  <input name="zip" type="text" class="tmt_payee_postcode" value="0000">

  <label for="country">Cardholder Country</label>
  <select name="country" class="tmt_payee_country">
      <option value="US">United States of America</option>
      <option value="GB" selected>United Kingdom</option>
      <option value="AU">Australia</option>
  </select>

  <!-- Payment Details -->
  <input type="hidden" name="reference" class="tmt_reference" value="FOO123">
  <input type="hidden" name="description" class="tmt_description" value="Holiday for two in Paris">
  <input type="hidden" name="pax" class="tmt_pax" value="2">

  <input type="submit" value="Pay" name="pay">
</form>

<script src="https://payment.tmtprotects.com/tmt-payment-modal.3.6.1.js"></script>
<script>
    window.tmtPaymentModalReady = function () {

        var tmtPaymentModal = new window.tmtPaymentModalSdk({
            path: "SITE_PATH",
            formId: "tmt-payment-form",
            environment: "test"
        })
    }
</script>

Make sure to replace SITE_PATH with your site path, and AUTHENTICATION_STRING with the authentication string generated as instructed in the previous section.

Once you have generated a valid authentication string, it can be used along with the required values below to configure the modal for use.

In addition, the environment option must be set to test

Demo

Class Description
tmt_booking_auth The hashed and salted authorisation string for the transaction
tmt_booking_id Set this to 0 to create a new booking, or an existing booking ID if you preloaded a booking
tmt_channels Set this to the ID of the channel you wish to use for the transaction
tmt_country The ISO 3166-1 alpha-2 value of the country the booking takes place in
tmt_date The end date of travel in YYYY-MM-DD format
tmt_currencies The ISO 4217 value for the currency the travel item is being sold in (must match the currency of the channel in use)
tmt_total The total being billed in the currency of the channel in use as a cent value (e.g. $10.00 = 1000)
tmt_firstname The firstname of the lead traveller
tmt_surname The surname of the lead traveller
tmt_email The email address of the lead traveller
tmt_payee_name The name of the person making payment as it appears on their credit/debit card
tmt_payee_email The email of the person making payment
tmt_payee_address The address of the person making payment
tmt_payee_city The city of the person making payment
tmt_payee_postcode The postcode/zip of the person making payment
tmt_payee_country The ISO 3166-1 alpha-2 value of the country of the person making payment
tmt_reference Your own reference
tmt_description A description of the product being sold
tmt_pax The amount of people the product is for

^Booking data is not required if booking_id is set to the ID of an existing booking

Callbacks

Now that you have your modal configured and ready for use, you need to listen on the relevant callback for details on the transaction process.

In order to allow you to capture relevant API data as the modal process occurs, we provide the following callbacks:

token_error

tmtPaymentModal.on("token_error", function(data) {
  // Token has expired, reload page to generate new authstring.
})
When? Intended Use
Modal fails to authenticate Trigger code to generate a new authentication string as old one has expired

booking_logged

tmtPaymentModal.on("booking_logged", function(data) {
  // Booking has been created. Log ID as failover.
  const bookingId = data.id;
})
When Intended use
Booking successfully created when modal is triggered Log booking ID as a failover. If the transaction_logged callback isn't triggered, the booking can be looked up to establish if it has a status of paid

booking_exists

tmtPaymentModal.on("booking_exists", function (data) {
  // Preloaded booking has been validated.
})
When Intended use
Modal triggered with valid booking ID passed in Debugging

booking_error

tmtPaymentModal.on("booking_error", function (data) {
  // Booking data is invalid
  const error = data.message
})
When Intended use
Modal attempts to create a booking but fails Obtaining further detail on why booking data is incorrect

transaction_result_available

tmtPaymentModal.on("transaction_result_available", function (data) {
  // 3DS transaction. Customer has completed 3DS auth.
  const id = data.id
  tmtPaymentModal.closeModal();
  // redirect and poll API for outcome of 3DS.
})
When Intended use
Async transaction is complete but result is not yet known Redirecting customer to a result page, while polling the TMT API for the outcome of the transaction

transaction_logged

tmtPaymentModal.on("transaction_logged", function (data) {
  // Transaction complete and successful.
  const id = data.id
  const hash = data.hash
  tmtPaymentModal.closeModal();
  // redirect to success page and validate hash
})
When Intended use
Transaction successful Logging the ID of the transaction. Obtaining the transaction hash. Completing the transaction process

transaction_failed

tmtPaymentModal.on("transaction_failed", function (data) {
  // Transaction rejected by the bank.
  const id = data.id
  const hash = data.hash
  tmtPaymentModal.closeModal();
  // redirect and validate hash
})
When Intended use
Transaction unsuccessful Logging the ID of the transaction. Obtaining the transaction hash. Completing the transaction process or giving the customer the option to try again

transaction_timeout

tmtPaymentModal.on("transaction_timeout", function (data) {
  // Transaction result unknown due to timeout
  const bookingId = data.booking_id
  // Lookup booking and check status
})
When Intended use
Payment gateway or API timed out Log booking ID. Lookup booking to establish if has a status of paid

transaction_error

tmtPaymentModal.on("transaction_error", function (data) {
  // Transaction data is invalid
  const error = data.message
})
When Intended use
Something went wrong in the transaction process Obtaining further detail on why transaction data is incorrect

close_window_attempted

tmtPaymentModal.on("close_window_attempted", function (data) {
  alert('Please do not do that')
})
When Intended use
User clicks to close modal Warning user against closing modal if transaction is in progress
tmtPaymentModal.on("modal_closed", function (data) {
  // Modal has been closed. Flag transaction as incomplete.
})
When Intended use
User closed modal Cancel booking

Transaction Validation

If you don't want to use the TmtAuthstring class you can write your own verification method based on the example below:

$values = [
    'id'        => $id,
    'status'    => $status,
    'total'     => $total
];

$varString    = implode('&', $values);
$authString   = hash('sha256', $varString);
$validHash    = hash('sha256', $authString . $channel_secret);

if (hash_equals($hash, $validHash)) {
    // Valid hash.
};

// Coming soon
// Coming soon
const values = {
    id, status, total
}

let string = []
for (const key in values) {
    string.push(values[key])
}
string = string.join('&')

// SHA256 the string.
const encode = crypto.createHash('sha256').update(string).digest('hex')

// Fetch your channel secret and concatenate to string.
const { CHANNEL_SECRET } = 'MYCHANNELSECRET123'

const validHash = crypto.createHash('sha256').update(
    Buffer.concat([
        new Buffer(encode),
        new Buffer(CHANNEL_SECRET)
    ])
).digest('hex')

if (hash.equals(validHash))) {
    // Valid hash.
};

Once the transaction process is complete, the transaction_logged or transaction_failed callbacks would have been called with the transaction response passed to them. Should you wish to validate a response, you will need to obtain the values for id, status and total as well as the channel secret for the channel you are using.

From there, you can use the TmtAuthstring\Validate class on the TMT Github Page following the example shown.

Extended Use

Existing Booking Payments

Bookings can be created in advance of prompting the user for payment. This allows you to create a booking and charge a user a deposit or balance amount rather than the full amount of the booking.

To achieve this, you will need to:

You would then use the ID of the booking as the value of the input with class tmt_booking_id if you are using the form configuration or pass it in via the booking_id field if you are using the object configuration.

Extended Authorisation String

If you don't want to use the TmtAuthstring class you can write your own authentication string generation method based on the example below

// Get current time in GMT.
$time_now = new DateTime('now', new DateTimeZone('GMT'));

// Create timestamp in 'YmdHis' format. E.g. 20190812055213 
$timestamp = $time_now->format('YmdHis');

// Concatenate your values in alphabetical key order.
$booking_vars = [
    'allocations'     => json_encode([
        [
            'channels'    => 23,
            'currencies'  => 'GBP',
            'operator'    => 'flat',
            'total'       => 1000,
        ],
    ]),
    'channels'        => 2,
    'charge_channel'  => 23,
    'country'         => 'GB',
    'currencies'      => 'USD',
    'date'            => '2025-01-01',
    'email'           => 'john.smith@example.org',
    'firstname'       => 'John',
    'reference'       => 'SOMEREFERENCE',
    'surname'         => 'Smith',
    'total'           => 9999,
];

$string = implode('&', $booking_vars);

// SHA256 the string.
$auth_string = hash( 'sha256', $string );

// Fetch your channel secret and concatenate to string.
$secret = 'MYCHANNELSECRET123';
$salted_auth_string = hash( 'sha256', $auth_string . $secret );

// Concatenate with timestamp.
$final_auth_string = $salted_auth_string . $timestamp;
// Coming soon
// Coming soon
// Get current time in GMT.
const date = new Date();
const utcDate = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());

// Create timestamp in 'YYYYMMDDHHmmss' format. E.g. 20190812055213 
const timestamp = format(utcDate, 'YYYYMMDDHHmmss')

// Concatenate the values for channels, currencies, total and your timestamp in that order.
const bookingVars = {
    allocations: [
      {
        channels: 23,
        currencies: 'GBP',
        operator: 'flat',
        total: 1000,
      }
    ]
    channels: 2,
    country: 'GB',
    charge_channel: 23,
    currencies: 'USD',
    date: '2025-01-01',
    email: 'john.smith@example.org',
    firstname: 'John',
    reference: 'SOMEREFERENCE',
    surname: 'Smith',
    total: 9999,
    timestamp: timestamp
}

let string = []
for (const key in bookingVars) {
    string.push(bookingVars[key])
}
string = string.join('&')

// SHA256 the string.
const encode = crypto.createHash('sha256').update(string).digest('hex')

// Fetch your channel secret and concatenate to string.
const { CHANNEL_SECRET } = 'MYCHANNELSECRET123'

const authString = crypto.createHash('sha256').update(
    Buffer.concat([
        new Buffer(encode),
        new Buffer(CHANNEL_SECRET)
    ])
).digest('hex')

// Concatenate with timestamp.
const appAuthString = authString + timestamp;

Make sure to replace MYCHANNELSECRET123 with the channel secret of the channel you are transacting in.

If there are other items included in the transaction that you wish to insure against tampering, these values can also be included in the authstring.

The following fields can be included in any implementation:

You can also include the following in the object configuration if you are using allocations

IMPORTANT

Alternative Payment Methods

Credit card payments are available in all the currencies Trust My Travel support and made using the data required by the modal on initialisation. The alternative payment methods that we offer are restricted by currency and further considerations are needed regarding the data supplied when triggering the modal.

Payment Currency

Alternative payment methods are only available in the payment currencies defined below. If any of these methods are made available to the customer and they select one, the payment currency will automatically switch to the currency linked to the payment method.

APM Payment Currency
Giropay EUR
iDEAL EUR
DLocal BRL
Rapipago ARS
Sofort EUR

The same applies if the paymentCurrency option is defined.

For example, if the modal is launched with USD as payment currency and the user has the option to select Giropay, then the payment currency will switch to EUR.

Authorize Transaction Type is Ignored

Alternative payment methods only allow for purchase transactions. It is not possible to pre-authorize an alternative payment method transaction. As such, if the modal is triggered with the transactionType option set to "authorize" and the user selects an alternative payment, the transactionType option will be ignored.

Testing

If you are using Google Chrome, you can right click and select 'Translate to English' (or the language of your browser).

Giropay

Giropay transactions require the inclusion of a description of what the transaction is for. If a booking description has been passed to the modal using either the value of a form input with class tmt_description or the value of the field description passed in via an object then this will be used with the transaction request.

If no information is supplied via these fields, then the description passed to Giropay defaults to: * "COMPANY - sale"

Where COMPANY is the value of the channel receipt label if one exists, and if not, the name of the site.

Success

In the third party payment window, login with:

Fail

In the third party payment window click on the Abort button.

iDEAL

Success

Run a transaction for any value other than EUR 2 and click the Confirm Transaction button.

Fail

Run a transaction for EUR 2 and click the Confirm Transaction button.

Dlocal Installments

Success:

Use 4242 4242 4242 4242 as credit card number, a valid expiry date and 100 as PIN. Pick any number of installments and enter an ID number.

Fail:

Use 4242 4242 4242 4242 as credit card number, a valid expiry date and 101 as PIN. Pick any number of installments and enter an ID number.

Rapipago

Rapipago transactions are only permitted where the payer is in Argentina. This is indicated by passing the ISO country code for Argentina, AR, to the modal using either the value of a form input with class tmt_payee_country or the value of the field payee_country passed in via an object.

Success

There is no third party sandbox payment window available for this so success is triggered behind the scenes. For a success, run a transaction for any value greater than or equal to ARS 50.

Fail

There is no third party sandbox payment window available for this so success is triggered behind the scenes. For a fail, run a transaction for any value less than ARS 50.

Sofort

Success

In the third party payment window, login with:

Select any account on the next page and then click Next. * Enter 12345 in the TAN field and click Next.

Fail

Unavailable.

Going Live

Options

path

<script>
    window.tmtPaymentModalReady = function () {
        var tmtPaymentModal = new window.tmtPaymentModalSdk({
            path: 'test-site',
            ...
        })
    }
</script>

formId

<form id="myPaymentForm" action="complete.php" method="post">
    // Form inputs etc...
</form>

<script>
    window.tmtPaymentModalReady = function () {
        var tmtPaymentModal = new window.tmtPaymentModalSdk({
            path: 'myPaymentForm',
            ...
        })
    }
</script>

data

<button id="trigger-modal" class='btn btn-primary'>Pay Now</button>

<script>
    window.tmtPaymentModalReady = function () {

        const data = {
            booking_id: '0',
            channels: '2',
            country: 'GB',
            // Authentication
            booking_auth: authentication_string,
            // Lead Traveller
            firstname: 'John',
            surname: 'Smith',
            email: 'john.smith@example.org',
            date: '2020-05-15',
            // Payment details
            payee_name: 'Jane Smith',
            payee_email: 'jane.smith@example.org',
            payee_address: '123 test address',
            payee_city: 'Test city',
            payee_country: 'GB',
            payee_postcode: '0000',
            currencies: 'GBP',
            total: '9999'
        }

        const button = document.getElementById('trigger-modal')

        button.addEventListener('click', function () {
            var tmtPaymentModal = new window.tmtPaymentModalSdk({
                path: 'test-site',
                data: data
            })
        })
    }
</script>

environment

<script>
    window.tmtPaymentModalReady = function () {
        var tmtPaymentModal = new window.tmtPaymentModalSdk({
            path: 'test-site',
            formId: 'my-payment-form',
            environment: 'test'
        })
    }
</script>

origin

Example, foo.com is an iframe that is serving up the modal within a file on bar.com:

<body>
    <!--content served up by bar.com-->

    <iframe src=foo.com>
        <button id="trigger-modal">Pay</button>

        <script>
            window.tmtPaymentModalReady = function () {

                const button = document.getElementById("trigger-modal");

                button.addEventListener("click", function () {
                    const tmtPaymentModal = new window.tmtPaymentModalSdk({
                        path: "some-site",
                        origin: "foo.com,bar.com",
                        data: {
                            ...
                        }
                    });
                });
            }
        </script>
    </iframe>
</body>

If you are serving up the payment modal from within an iframe, all ancestors in the chain must be defined in a comma separated list with the parent listed first, followed by the origin that will render it and so on up the chain.

debug

<script>
    window.tmtPaymentModalReady = function () {
        var tmtPaymentModal = new window.tmtPaymentModalSdk({
            path:'test-site',
            formId: 'my-payment-form',
            debug: true
        })
    }
</script>

Set debug = true to enable validation and error logs in console.

disableCloseWindowPrompt

<script>
    window.tmtPaymentModalReady = function () {
      var tmtPaymentModal = new window.tmtPaymentModalSdk({
        path:'test-site',
        formId: 'my-payment-form',
        disableCloseWindowPrompt: true
      })
    }
</script>

If you have your own means of handling user attempts to close the browser or refresh during transaction you may wish to disable the in-built onbeforeounload close window prompt.

disableLang

<script>
    window.tmtPaymentModalReady = function () {
      var tmtPaymentModal = new window.tmtPaymentModalSdk({
        path:'test-site',
        formId: 'my-payment-form',
        disableLang: true
      })
    }
</script>

If the translations you require for your customer base are not available, you can disable the translation picker.

lang

<script>
    window.tmtPaymentModalReady = function () {
      var tmtPaymentModal = new window.tmtPaymentModalSdk({
        path:'test-site',
        formId: 'my-payment-form',
        lang: 'ptBR'
      })
    }
</script>

The modal is rendered in English by default. Should you know that the user prefers an alternate language, the modal can be set to load in that language should a translation be available. Once loaded, the user is still free to switch languages should they wish. The language which the modal is in at the point of transaction determines what language the user's payment receipt shall be in.

paymentCurrency

<script>
    window.tmtPaymentModalReady = function () {
        var tmtPaymentModal = new window.tmtPaymentModalSdk({
          path:'test-site',
          formId: 'my-payment-form',
          paymentCurrency:'EUR'
        })
    }
</script>

The default behaviour of the payment modal is to offer payment in the base currency of your channel, and allow the customer to change the payment currency as required. Should you know that the customer making payment is based in a country that does not use your channel's base currency, you can improve the user experience by defining their currency to default the payment modal to.

For example, if the base currency of your channel is USD and your customer is based in Germany, you would define the paymentCurrency as EUR as shown.

Should you wish to display your prices in currencies other than your base currency, you will need to utilise your channel's forex feed

paymentMethods

Using all available payment methods

<script>
    window.tmtPaymentModalReady = function () {
      var tmtPaymentModal = new window.tmtPaymentModalSdk({
        path:'test-site',
        formId: 'my-payment-form',
        paymentMethods: [
          'credit-card',
          'dlocal',
          'giropay',
          'ideal',
          'sofort',
          'rapipago'
        ]
      })
    }
</script>

By default, the payment modal offers payment via credit card. However, we also offer the following payment methods that can be used in addition to, or instead of, credit card payments:

To indicate the methods you want to use, pass them in as an array. Payment methods will appear in the order you define them, with the exception of "credit-card", which will always be the default interface if included. If no paymentMethods are defined, the modal will only serve up the credit card interface.

installments

Example: No Installments

<script>
    window.tmtPaymentModalReady = function () {
        var tmtPaymentModal = new window.tmtPaymentModalSdk({
            path:'test-site',
            formId: 'my-payment-form',
            paymentMethods: ['dlocal']
            installments: [1]
        })
    }
</script>

Example: Set Installment Plan to 3 Installments

<script>
    window.tmtPaymentModalReady = function () {
        var tmtPaymentModal = new window.tmtPaymentModalSdk({
            path:'test-site',
            formId: 'my-payment-form',
            paymentMethods: ['dlocal']
            installments: [3]
        })
    }
</script>

Example: All Installment Options (default)

<script>
    window.tmtPaymentModalReady = function () {
        var tmtPaymentModal = new window.tmtPaymentModalSdk({
            path:'test-site',
            formId: 'my-payment-form',
            paymentMethods: ['dlocal']
            installments: [1, 3, 6, 9, 12]
        })
    }
</script>

If you are offering installments as an alternative payment option, you can control which of the available installment options are offered by passing the required value or values in an array. This can be used to present the user with a pre-defined installment value, or to hide the installments interface altogether (this can be useful if you know that your customer has a Brasilian bank card but want to run a normal credit card payment).

transactionType

<script>
    window.tmtPaymentModalReady = function () {
      var tmtPaymentModal = new window.tmtPaymentModalSdk({
        path:'test-site',
        formId: 'my-payment-form',
        transactionType: 'authorize'
      })
    }
</script>

We now allow for pre-authorizing a card via the modal leaving you to make a Capture request via an API call in order to capture the payment.

NB: If you intend to use this option, please note the following:

verify

<script>
    window.tmtPaymentModalReady = function () {
      var tmtPaymentModal = new window.tmtPaymentModalSdk({
        path: 'test-site',
        data: dataObject,
        verify: [
          "allocations",
          "country",
          "charge_channel",
          "date",
          "email",
          "firstname",
          "reference",
          "surname",
        ]
      })
    }
</script>

If you wish to extended the authstring to include other booking and transaction values, you will need to include the verify option in order to pass in an array of the fields that you have included in the authstring.

The following fields can be used in the verify array in any implementation:

You can also include the following in the Object Configiuration

Important

Test Credit Cards

Credit Card Number CVV Flow Outcome
4485 0403 7153 6584 100 Frictionless Flow Success
4485 0403 7153 6584 101 Frictionless Flow Fail
4573 8231 6871 0907 100 Challenge Flow Success
4573 8231 6871 0907 101 Challenge Flow Fail
4484 0700 0003 5519^ 257 3DS1 fallback Success
4484 0700 0003 5519^ 258 3DS1 fallback Fail
5352151570003404^^ 100 No 3DS2 Success
5352151570003404^^ 101 No 3DS2 Fail

Translations

{
  "form": {
      "title": "Payment Details",
      "invoice": "Invoice",
      "cc_no": "Credit Card Number",
      "cvv": "CVV",
      "expiry": "Expiry Date",
      "pay": "Pay",
      "success": "Payment successful",
      "retry": "Retry",
      "terms": "This site uses Trust My Travel t/a Trust Protects to facilitate and protect your payment as merchant of record. By clicking Pay, you agree to Trust My Travel’s terms",
      "waitingForTransactionResult": "Waiting for transaction result...",
      "closeWarning": "Don't close this window until you have completed the transaction",
      "securityCheck": "Loading security check",
      "failed": "Payment failed",
      "close": "Close",
      "redirecting": "Redirecting to payment processor..."
  },
  "paymentStatus": {
      "submitting": "Submitting Payment...",
      "contactingBank": "Contacting Bank...",
      "apologies": "Apologies, this is taking longer than usual...",
      "stillWaiting": "Still waiting for a response..."
  },
  "errors": {
      "connecting": "Payment Service Provider unavailable",
      "timeout": "Your payment attempt has timed out, but may have been successful. Please contact the site admin and quote booking ID {{id}}"
  },
  "paymentMethods": {
      "credit-card": "Credit Card",
      "dlocal": "Installments",
      "giropay": "Giropay",
      "ideal": "iDEAL",
      "rapipago": "Rapipago",
      "sofort": "Sofort"
  },
  "dlocal": {
      "noInstallments": "No installments",
      "monthlyInstallments": "monthly installments",
      "single": "Single installment",
      "singleFees": "Single installment fees",
      "singleTotal": "Single installment total",
      "TotalCost": "Total cost of plan"
  },
  "validation": {
      "creditCard": "Credit card number entered is not valid",
      "cvv": "CVV number entered is not valid",
      "expiry": "Please enter a valid expiry date",
      "futureExpiry": "Please enter a valid future dated expiry date",
      "document": "Documento Nacional de Identidad (DNI) or Clave Única de Identificación Tributaria (CUIT) is required"
  }
}

The Trust Protects Payment Modal currently supports the following translations:

Language lang option
Chinese (Traditional) zhZH
English (default) enGB
French frFR
German deDE
Italian itIT
Japanese jaJA
Kazakh kkKK
Korean koKO
Latvian lvLV
Portuguese ptBR
Romanian roRO
Russian ruRU
Spanish esES
Ukranian ukUK
Uzbek (Tajik) uzUZ

Should you wish to contribute a translation, please supply translations for the fields shown to membersupport@trustmytravel.com.

Translations for mail receipts should also be included. Mail strings indicated below. Variables preceeded with a colon (e.g :trust_id) should be left as is.

Field Value
subject Trust My ID: :trust_id
subject_refund Trust My ID: :trust_id Refund
subject_chargeback Trust My ID: :trust_id Chargeback
subject_digest Trust Protects Me Summary: :date
greeting Dear :Name
intro This email confirms your transaction with :member is protected.
refund_intro A refund has been issued on your payment with :member for the following item.
chargeback_intro We have received a chargeback on your payment with :member.
digest_intro This email is a summary of all items that were protected in the past year or are currently protected.
digest_intro2 For further details on an item, you can click the "Request Receipt" link in order to request that the payment receipt is re-sent to you
linked_transaction Trust My Transaction ID:
linked_booking Trust My Booking ID:
booked_header Item Booked with:
item_header Item(s) Ordered:
amount_header Amount Paid:
amount_refund_header Amount of Refund:
amount_chargeback_header Amount of Chargeback:
protection_type_header Protection Provided By:
protected_until_header Protected Until:
receipt_header Request Receipt
purchase_receipt Purchase Receipt
capture_receipt Purchase Receipt
retained_purchase_receipt Purchase Receipt
refund_receipt Refund Receipt
manual_refund_receipt Refund Receipt
chargeback_receipt Chargeback Receipt
protection_intro Trust Protects validates and approves the Protection Type used by the Travel Provider to cover their insolvency, meaning you, the consumer, can feel confident that you are protected against the insolvency of :member and will receive a full refund (and repatriation where applicable) in the event of :member\'s insolvency.
important_header Important:
p1 Your payment is only protected if the details above are correct and it is important that you check them for any inaccuracies.
p1a Any inaccuracies not declared within 7 days of receipt of this email will invalidate any protection.
p2 Please quote the above Trust My ID in any correspondence with us and email :contactmail
p3 For details of the financial protection, or to make a claim, please visit https://www.trustprotects.me

Troubleshooting

If you are having difficultly integrating the Payment Modal, please read through the troubleshooting guides below.

Form Implementation

Nothing Happens

Example of a form implementation input that has been flagged as it has not been completed

<input 
  name="payee_name" 
  class="tmt_payee_name" 
  style="background: yellow;"
/>

You are confident you have completed the integration, you visit your test payment page, click to pay, and nothing happens!

Please check the following:

Note that if either or both of these inputs are visible, then a style attribute would be attached to them in the event of no value being supplied as shown in the code example to the right.

If you have set either or both of these inputs to hidden, then its not immediately obvious if no values are present. If this is the case, it is recommended that you enable debug mode. You should then see output to this effect.

Empty form field

Form Submits

You are confident you have completed the integration, you visit your test payment page, click to pay, and the payment form submits without triggering the modal

Please check the following

Init Errors

Example of the path and form ID being correctly passed in for the form implementation

var tmtPaymentModal = new window.tmtPaymentModalSdk({
    path: "tmt-test",
    formId: "tmt-payment-form"
})

If you do not init the modal with the mandatory options for the implementation you require, then the modal will be triggered as per the screenshot below informing you which mandatory fields are missing.

Init Fail

This error would be resolved by passing a formId and path to the modal init call as per the example on the right

Required Field Errors

To successfully trigger the Payment Modal, required data must be present and correctly referenced depending on the implementation you are using:

If you do not include all the required fields, the modal will trigger with a error output to indicate the missing fields similar to the below. If you have debug mode enabled, the missing fields will also be output to console.

Init Fail

Invalid Token

To identify yourself to the modal, you need to pass it a valid authstring. Failure to do this will result in output as per the screenshot below.

Invalid Token

Should you receive this error, please check the following:

Expired Token

To prevent reuse of tokens, they are only valid for 15 minutes. In order to prevent reuse of expired tokens, a timestamp is added to the authstring and then appended to it so that a duplicate authstring can be built API side for comparison. If you fail to append the timestamp, or if it is older than 15 minutes, you will receive output as per the screenshot below:

Invalid Token

Should you receive this error, please check the followung:

Allocation Errors

Example One: Channel 23 receives allocation and incurs charges

{
  booking_id: '0',
  channels: 2,
  currencies: 'USD',
  total: '10000',
  ...
  /* USD 2 is allocated to Channel 23 */
  allocations: [{
      channels: 23,
      currencies: 'USD',
      total: 200,
      operator: 'flat'
  }],
  /* Channel 23 is nominated as charge_channel */
  charge_channel: 23
}

/* 
 * Charges levied against Channel 23 would be USD 4 (3.5% of USD 100 = USD 3.50 + USD 0.50 per transaction fee)
 * USD 2 is not sufficient to cover charges of USD 4, error is returned.
 */

Example Two: Channel 23 is master channel and incurs charges

{
  booking_id: '0',
  channels: 23,
  currencies: 'USD',
  total: '10000',
  ...
  /* USD 98 is allocated to Channel 2 */
  allocations: [{
      channels: 2,
      currencies: 'USD',
      total: 9800,
      operator: 'flat'
  }]
  /* No charge_channel defined, so defaults to main channel, which is 23 */
}

/*
 * Charges levied against Channel 23 would be USD 4 (3.5% of USD 100 = USD 3.50 + USD 0.50 per transaction fee)
 * USD 2 remaining after allocating USD 98 to channel 2 is not sufficient to cover charges of USD 4, error is returned
 */

If you are using the data object implementation and including allocations, you may receive output as per the screenshot below after having successfully triggered the modal and entered credit card details:

Invalid Allocations

Should you receive this error, please ensure that the channel that is incurring charges has sufficient funds to meet those charges.

For example, consider a channel with ID = 23, which has a per transaction fee of USD 0.50 and has a credit card percentage of 3.5% applied. The two examples shown on the right would result in too little being available to meet those charges.

Payment Failure

If payments are failing unexpectedly, for example when testing with credit cards that should be passing, please listen on the transaction_error callback as this should give you feedback on where you are going wrong. The example below shows a transaction attempt that has failed as allocations were included on an authorize transactions.

Example of transaction_error

Invalid Data Token

If you successfully run a transaction from end to end, but the transaction fails with "content": "Invalid data/token.", then you have triggered the modal in an environment that does not match that of the channel you are running the transaction in. Cards are tokenised in the environment specified in modal instantiation. API requests made via the tokeniser to the payment gateway are made in the environment of the channel (live or test). If a channel has an account_mode of "live" and the modal is instantiated with environment "test", the card will be tokenised in the test token environment where-as the request will be routed via the live environment. No token will exist in the live environment so the response of "Invalid data/token" will be returned, and the transaction will fail.

TokenEx Failed to Load

TokenEx are our third party provider for tokenising cards. When the modal is triggered, we initialise their scripts. If we can't initialise their scripts, we can't process payments and this error is displayed.

Example of transaction_error

If you are serving the modal up within an iframe, this error has likely been caused by an incorrect, or no value for origin. This can be verified by checking console logs for errors like the below:

Example of transaction_error logs

API Reference

Authentication

Make sure to replace {{username}} with your site username, and {{password}} with your password.

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://tmtprotects.com/wp/wp-json/jwt-auth/v1/token',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "username": "{{username}}",
    "password": "{{password}}"
  }',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("tmtprotects.com")
payload = json.dumps({
  "username": "{{username}}",
  "password": "{{password}}"
})
headers = {
  'Content-Type': 'application/json'
}
conn.request("POST", "/wp/wp-json/jwt-auth/v1/token", payload, headers)
res = conn.getresponse()
data = res.read()
curl --location --request POST 'https://tmtprotects.com/wp/wp-json/jwt-auth/v1/token' \
--header 'Content-Type: application/json' \
--data-raw '{
    "username": "{{username}}",
    "password": "{{password}}"
}'
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "username": "{{username}}",
  "password": "{{password}}"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://tmtprotects.com/wp/wp-json/jwt-auth/v1/token", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "id": 69,
    "name": "Elvis Sauer",
    "username": "elvissauer",
    "user_email": "elvissauer@example.org",
    "user_nicename": "Elvis Sauer",
    "user_display_name": "Elvis Sauer",
    "usertype": "member_admin",
    "type": "member_admin",
    "default_site": {
        "id": 3,
        "name": "TMT Test Site",
        "url": "https://tmtprotects.com/tmt-test",
        "path": "/tmt-test/",
        "permissions": [],
        "channel_count": 6,
        "usertype": "member_admin"
    },
    "site_count": 2,
    "sites": [
        {
            "id": 3,
            "name": "TMT Test Site"
        },
        {
            "id": 9,
            "name": "Protection Only Site"
        }
    ],
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOi8vbG9jYWxob3N0L3dwL3dwLWpzb24vand0LWF1dGgvdjEvdG9rZW4iLCJpYXQiOjE2NjY3ODg5OTYsImV4cCI6MTY2Njc4OTg5NiwibmJmIjoxNjY2Nzg4OTk2LCJqdGkiOiJJYUtlaUl6T3hzcEtQeXZhIiwic3ViIjo2OSwicHJ2IjoiODdlMGFmMWVmOWZkMTU4MTJmZGVjOTcxNTNhMTRlMGIwNDc1NDZhYSJ9.8b-YjJBIp2-KnO6yXMgvbwnuh7iedQFZ3n9XuFGMNVk",
    "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOi8vbG9jYWxob3N0L3dwL3dwLWpzb24vand0LWF1dGgvdjEvdG9rZW4iLCJpYXQiOjE2NjY3ODY5NjMsImV4cCI6MTY2Njc4Nzg2MywibmJmIjoxNjY2Nzg2OTYzLCJqdGkiOiJEbDJYUlhLYnVXaXN1SGhXIiwic3ViIjo2OSwicHJ2IjoiODdlMGFmMWVmOWZkMTU4MTJmZGVjOTcxNTNhMTRlMGIwNDc1NDZhYSJ9.bupv-M89xUCxEJVAP8wYjos1HDa6dgZXuPTfliypkV0"
}

All API requests require an authentication header in the form of:

Authorization: Bearer %TOKEN%

where %TOKEN% is replaced with a token retrieved from an authentication request.

HTTP Request

POST https://tmtprotects.com/wp/wp-json/jwt-auth/v1/token

Refresh Tokens

Make sure to replace {{path}} with your site path and {{refreshToken}} with a valid API refresh token.

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/jwt-auth/v1/token/refresh',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer {{refreshToken}}'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("tmtprotects.com")
payload = ''
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer {{refreshToken}}'
}
conn.request("POST", "/wp/wp-json/jwt-auth/v1/token/refresh", payload, headers)
res = conn.getresponse()
data = res.read()
curl --location --request POST 'https://tmtprotects.com/{{path}}/wp-json/jwt-auth/v1/token/refresh' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{refreshToken}}' \
--data-raw ''
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer {{refreshToken}}");

var raw = "";

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://tmtprotects.com/{{path}}/wp-json/jwt-auth/v1/token/refresh", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "id": 69,
    "name": "Elvis Sauer",
    "username": "elvissauer",
    "user_email": "elvissauer@example.org",
    "user_nicename": "Elvis Sauer",
    "user_display_name": "Elvis Sauer",
    "usertype": "member_admin",
    "type": "member_admin",
    "default_site": {
        "id": 3,
        "name": "TMT Test Site",
        "url": "https://tmtprotects.com/tmt-test",
        "path": "/tmt-test/",
        "permissions": [],
        "channel_count": 6,
        "usertype": "member_admin"
    },
    "site_count": 2,
    "sites": [
        {
            "id": 3,
            "name": "TMT Test Site"
        },
        {
            "id": 9,
            "name": "Protection Only Site"
        }
    ],
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOi8vbG9jYWxob3N0L3RtdC10ZXN0L3dwLWpzb24vand0LWF1dGgvdjEvdG9rZW4vcmVmcmVzaCIsImlhdCI6MTY2Njc4ODk5NiwiZXhwIjoxNjY2Nzg5ODk2LCJuYmYiOjE2NjY3ODg5OTYsImp0aSI6IlJSNHVjdlRqV0hpUlpJOXAiLCJzdWIiOjY5LCJwcnYiOiI4N2UwYWYxZWY5ZmQxNTgxMmZkZWM5NzE1M2ExNGUwYjA0NzU0NmFhIn0.CtLdyp1bzTMLPm1OC2C6yeA5DlrGelLIJXSY2bvgyGY",
    "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOi8vbG9jYWxob3N0L3dwL3dwLWpzb24vand0LWF1dGgvdjEvdG9rZW4iLCJpYXQiOjE2NjY3ODY5NjMsImV4cCI6MTY2Njc4Nzg2MywibmJmIjoxNjY2Nzg2OTYzLCJqdGkiOiJEbDJYUlhLYnVXaXN1SGhXIiwic3ViIjo2OSwicHJ2IjoiODdlMGFmMWVmOWZkMTU4MTJmZGVjOTcxNTNhMTRlMGIwNDc1NDZhYSJ9.bupv-M89xUCxEJVAP8wYjos1HDa6dgZXuPTfliypkV0"
}

All authentication payloads include a refresh_token in the response. This token can be retained indefinitely and used to obtain a valid JWT token via the refresh token endpoint. The token returned in the refresh token response can be used to sign subsequent API requests.

HTTP Request

POST https://tmtprotects.com/wp/wp-json/jwt-auth/v1/token/refresh

Replace Refresh Token

Make sure to replace {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/jwt-auth/v1/token/refresh',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'DELETE',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer {{token}}'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("tmtprotects.com")
payload = ''
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer {{token}}'
}
conn.request("DELETE", "/wp/wp-json/jwt-auth/v1/token/refresh", payload, headers)
res = conn.getresponse()
data = res.read()
curl --location --request DELETE 'https://tmtprotects.com/{{path}}/wp-json/jwt-auth/v1/token/refresh' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{token}}' \
--data-raw ''
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer {{token}}");

var raw = "";

var requestOptions = {
  method: 'DELETE',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://tmtprotects.com/{{path}}/wp-json/jwt-auth/v1/token/refresh", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "deleted": true
}

You may wish to rotate your refresh token on a regular basis. To do so, make a DELETE /token/refresh request signed with a valid user token. You will receive a new refresh token the next time you complete an auth request.

HTTP Request

DELETE https://tmtprotects.com/wp/wp-json/jwt-auth/v1/token/refresh

Channels

Get All Channels

Make sure to replace {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/channels',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer {{token}}'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("tmtprotects.com")
payload = ''
headers = {
    'Authorization': 'Bearer {{token}}'
}
conn.request("GET", "/{{path}}/wp-json/tmt/v2/channels", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --location --request GET 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/channels' \
--header 'Authorization: Bearer {{token}}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{token}}");

var requestOptions = {
    method: 'GET',
    headers: myHeaders,
    redirect: 'follow'
};

fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/channels", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

[
    {
        "id": 3403,
        "uuid": "87bccae4-0993-4749-acb7-3af7fcacf1f3",
        "name": "Kautzer-Nienow1666786311",
        "slug": "kautzer-nienow1666786311",
        "account_type": "protected-processing",
        "account_mode": "live",
        "protection_type": "trust-my-travel",
        "currencies": "GBP",
        "quote_code": "Quote1",
        "forex_feed": {
            "base": "GBP",
            "symbol": {
                "grapheme": "£",
                "template": "$1",
                "rtl": false
            },
            "rates": {
                "EUR": {
                    "symbol": "EUR",
                    "quote_id": 66126030,
                    "rate": 1.2132,
                    "provider": "cambridge",
                    "expires": "2023-10-11 14:00:00",
                    "modified": "2022-10-11 14:49:14"
                },
                "USD": {
                    "symbol": "USD",
                    "quote_id": 66126136,
                    "rate": 1.2155,
                    "provider": "cambridge",
                    "expires": "2023-10-11 14:00:00",
                    "modified": "2022-10-11 14:49:37"
                }
            }
        },
        "language": "enGB",
        "primary_mail": "elvissauer@example.org",
        "mail_bcc_transactional_mails": false,
        "receipt_label": "TMT Test Site",
        "beneficiary_id": "",
        "settlement_currency": "GBP",
        "external_id": "",
        "payout_minimum": 10000,
        "channel_status": "full-processing",
        "suppliers": [],
        "statement_period": "month",
        "cardholder_present": false,
        "mail_failures": false,
        "server_to_server": false,
        "tokenex_id": "",
        "tokenex_api_key": "",
        "chargeback_mail": null,
        "descriptor": null,
        "channel_secret": ""
    }
    ...
]

HTTP Request

GET https://tmtprotects.com/{{path}}/wp-json/tmt/v2/channels

Query Parameters

Parameter Default Description
include all Limit result set to comma separated list of IDs.
page 1 Page of the collection to view.
per_page 10 Maximum number of items to be returned per page.
order asc Enum: asc, desc
orderby id Sort collection by defined attribute.
account_mode all Enum: live, test, draft, closed, affiliate, protection-only
account_type all Enum: protected-processing, trust
currencies all Return all items where field contains requested value
external_id all Search for exact matches with requested value
name all Search for wildcard matches with requested value
statement_period all Enum: biweek, week, month

Get A Channel

Make sure to replace {{channel_id}} with a valid channel ID, {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/channels/{{channel_id}}',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer {{token}}'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("tmtprotects.com")
payload = ''
headers = {
    'Authorization': 'Bearer {{token}}'
}
conn.request("GET", "/{{path}}/wp-json/tmt/v2/channels/{{channel_id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --location --request GET 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/channels/{{channel_id}}' \
--header 'Authorization: Bearer {{token}}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{token}}");

var requestOptions = {
    method: 'GET',
    headers: myHeaders,
    redirect: 'follow'
};

fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/channels/{{channel_id}}", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "id": 3403,
    "uuid": "87bccae4-0993-4749-acb7-3af7fcacf1f3",
    "name": "Kautzer-Nienow1666786311",
    "slug": "kautzer-nienow1666786311",
    "account_type": "protected-processing",
    "account_mode": "live",
    "protection_type": "trust-my-travel",
    "currencies": "GBP",
    "quote_code": "Quote1",
    "forex_feed": {
        "base": "GBP",
        "symbol": {
            "grapheme": "£",
            "template": "$1",
            "rtl": false
        },
        "rates": {
            "EUR": {
                "symbol": "EUR",
                "quote_id": 66126030,
                "rate": 1.2132,
                "provider": "cambridge",
                "expires": "2023-10-11 14:00:00",
                "modified": "2022-10-11 14:49:14"
            },
            "USD": {
                "symbol": "USD",
                "quote_id": 66126136,
                "rate": 1.2155,
                "provider": "cambridge",
                "expires": "2023-10-11 14:00:00",
                "modified": "2022-10-11 14:49:37"
            }
        }
    },
    "language": "enGB",
    "primary_mail": "elvissauer@example.org",
    "mail_bcc_transactional_mails": false,
    "receipt_label": "TMT Test Site",
    "beneficiary_id": "",
    "settlement_currency": "GBP",
    "external_id": "",
    "payout_minimum": 10000,
    "channel_status": "full-processing",
    "suppliers": [],
    "statement_period": "month",
    "cardholder_present": false,
    "mail_failures": false,
    "server_to_server": false,
    "tokenex_id": "",
    "tokenex_api_key": "",
    "chargeback_mail": null,
    "descriptor": null,
    "channel_secret": ""
}

HTTP Request

GET https://tmtprotects.com/{{path}}/wp-json/tmt/v2/channels/{{channel_id}}

Schema

Parameter Type Description
id^ integer Unique identifier for the channel.
uuid^ string Unique identifier for the channel.
name string Title for the channel.
slug^ string The slug for the channel.
account_type^ string The account type for the channel.
Enum: protected-processing, trust
Default: trust
account_mode string The mode that the channel is in.
Enum: test, draft, live, closed, affiliate, protection-only
Default: test
protection_type^ string The protection type for the channel.
Enum: trust-my-travel, tmu-management
Default: trust-my-travel
currencies string The ISO 4217 value of the base currency of the channel.
Enum: valid currencies
quote_code^ string DEPRECATED
statement_period^ string The statement period for the channel.
Enum: biweek, week, month
Default: month
cardholder_present^ boolean Whether Cardholder Present is permitted on channel transactions.
Default: false
forex_feed^ object The forex feed for the channel.
language string Default mail receipt language.
Enum: deDE, enGB, esES, frFR, itIT, jaJA, kkKK, koKO, lvLV, ptBR, roRO, ruRU, ukUK, uzUZ, zhZH
Default: enGB
primary_mail string Comma separated list of email addresses to use if BCC'ing email.
mail_bcc_transactional_mails boolean Whether to BCC mail receipts to primary mail.
Default: false
mail_failures boolean Whether to send mail to primary mail on transaction failures.
Default: false
receipt_label string Company name to use in mail receipts. Defaults to site name.
server_to_server^ boolean Indicates whether channel will process transactions directly with PSP.
tokenex_id string TokenEx ID for the channel. Only applicable if server_to_server = true
tokenex_api_key string TokenEx API key for the channel. Only applicable if server_to_server = true
beneficiary_id^ string The beneficiary identifier for the channel.
settlement_currency^ string The ISO 4217 value of the settlement currency of the channel.
Enum: AED, AUD, CAD, CHF, DKK, EUR, GBP, HKD, JPY, NOK, NZD, SEK, SGD, USD, ZAR
external_id string The external identifier for the channel.
chargeback_mail string Comma separated list of email addresses to send Chargeback notification email to.
payout_minimum^ integer The minumum value whereby payouts will be made. (Based on settlement currency)
descriptor^ string Payment Descriptor that appears on customer's bank statements.
channel_secret^ string Channel secret. Used to sign payment modal requests.
channel_status^ string The status of the channel.
Enum: admin, affiliate, agent, closed, full-processing, full-processing-ic-plus, full-processing-blended-default, locked, new, supplier, test, tms-end-user, tmt-protection, tmu-protection
Default: test

^Readonly

Create A Channel

Make sure to replace {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/channels',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => {
        "name": "GBP Channel",
        "account_mode": "draft",
        "currencies": "GBP",
        "language": "enGB",
        "primary_mail": "john.smith@example.org,jane.smith@example.org",
        "mail_bcc_transactional_mails": true,
        "mail_failures": true,
        "receipt_label": "Smith Inc",
        "external_id": "SMITH1234",
        "chargeback_mail": "chargebacks@example.org",
    },
    CURLOPT_HTTPHEADER => array(
        'Content-Type: application/json',
        'Authorization: Bearer {{token}}'
    ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import http.client
import json
conn = http.client.HTTPSConnection("tmtprotects.com")
payload = json.dumps({
    "name": "GBP Channel",
    "account_mode": "draft",
    "currencies": "GBP",
    "language": "enGB",
    "primary_mail": "john.smith@example.org,jane.smith@example.org",
    "mail_bcc_transactional_mails": true,
    "mail_failures": true,
    "receipt_label": "Smith Inc",
    "external_id": "SMITH1234",
    "chargeback_mail": "chargebacks@example.org",
})
headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer {{token}}}}'
}
conn.request("POST", "/{{path}}/wp-json/tmt/v2/channels", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
 curl --location --request POST 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/channels' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{token}}' \
--data-raw '{
    "name": "GBP Channel",
    "account_mode": "draft",
    "currencies": "GBP",
    "language": "enGB",
    "primary_mail": "john.smith@example.org,jane.smith@example.org",
    "mail_bcc_transactional_mails": true,
    "mail_failures": true,
    "receipt_label": "Smith Inc",
    "external_id": "SMITH1234",
    "chargeback_mail": "chargebacks@example.org",
}
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer {{token}}");


var raw = JSON.stringify({
    "name": "GBP Channel",
    "account_mode": "draft",
    "currencies": "GBP",
    "language": "enGB",
    "primary_mail": "john.smith@example.org,jane.smith@example.org",
    "mail_bcc_transactional_mails": true,
    "mail_failures": true,
    "receipt_label": "Smith Inc",
    "external_id": "SMITH1234",
    "chargeback_mail": "chargebacks@example.org",
});


var requestOptions = {
    'method: 'POST',
    headers: myHeaders,
    body: raw,
    redirect: 'follow'
};


fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/channels", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "id": 3403,
    "uuid": "87bccae4-0993-4749-acb7-3af7fcacf1f3",
    "name": "GBP Channel",
    "slug": "kautzer-nienow1666786311",
    "account_type": "protected-processing",
    "account_mode": "draft",
    "protection_type": "trust-my-travel",
    "currencies": "GBP",
    "quote_code": "Quote1",
    "forex_feed": {
        "base": "GBP",
        "symbol": {
            "grapheme": "£",
            "template": "$1",
            "rtl": false
        },
        "rates": {
            "EUR": {
                "symbol": "EUR",
                "quote_id": 66126030,
                "rate": 1.2132,
                "provider": "cambridge",
                "expires": "2023-10-11 14:00:00",
                "modified": "2022-10-11 14:49:14"
            },
            "USD": {
                "symbol": "USD",
                "quote_id": 66126136,
                "rate": 1.2155,
                "provider": "cambridge",
                "expires": "2023-10-11 14:00:00",
                "modified": "2022-10-11 14:49:37"
            }
        }
    },
    "language": "enGB",
    "primary_mail": "john.smith@example.org,jane.smith@example.org",
    "mail_bcc_transactional_mails": true,
    "receipt_label": "Smith Inc",
    "beneficiary_id": "",
    "settlement_currency": "GBP",
    "external_id": "SMITH1234",
    "payout_minimum": 10000,
    "channel_status": "full-processing",
    "suppliers": [],
    "statement_period": "month",
    "cardholder_present": false,
    "mail_failures": true,
    "server_to_server": false,
    "tokenex_id": "1234567887654321",
    "tokenex_api_key": "QcFfUs9p8faeP974xwuvq6vqo55PTiWj",
    "chargeback_mail": "chargebacks@example.org",
    "descriptor": null,
    "channel_secret": ""
}

HTTP Request

POST https://tmtprotects.com/{{path}}/wp-json/tmt/v2/channels

Schema

Parameter Type Description
name^ string Title for the channel.
account_mode string The mode that the channel is in.
Enum: test, draft, live, closed, affiliate, protection-only
Default: test
currencies^ string The ISO 4217 value of the base currency of the channel.
Enum: valid currencies
language string Default mail receipt language.
Enum: deDE, enGB, esES, frFR, itIT, jaJA, kkKK, koKO, lvLV, ptBR, roRO, ruRU, ukUK, uzUZ, zhZH
Default: enGB
primary_mail string Comma separated list of email addresses to use if BCC'ing email.
mail_bcc_transactional_mails boolean Whether to BCC mail receipts to primary mail.
Default: false
mail_failures boolean Whether to send mail to primary mail on transaction failures.
Default: false
receipt_label string Company name to use in mail receipts. Defaults to site name.
external_id string The external identifier for the channel.
chargeback_mail string Comma separated list of email addresses to send Chargeback notification email to.

^Required

Update A Channel

Make sure to replace {{path}} with your site path, {{id}} with a valid channel ID and {{token}} with a valid API token.

$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/channels/{{id}}',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_POSTFIELDS => {
        "name": "GBP Channel",
        "currencies": "GBP",
        "language": "enGB",
        "primary_mail": "john.smith@example.org,jane.smith@example.org",
        "mail_bcc_transactional_mails": true,
        "mail_failures": true,
        "receipt_label": "Smith Inc",
        "external_id": "SMITH1234",
        "chargeback_mail": "chargebacks@example.org",
    },
    CURLOPT_HTTPHEADER => array(
        'Content-Type: application/json',
        'Authorization: Bearer {{token}}'
    ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import http.client
import json
conn = http.client.HTTPSConnection("tmtprotects.com")
payload = json.dumps({
    "name": "GBP Channel",
    "currencies": "GBP",
    "language": "enGB",
    "primary_mail": "john.smith@example.org,jane.smith@example.org",
    "mail_bcc_transactional_mails": true,
    "mail_failures": true,
    "receipt_label": "Smith Inc",
    "external_id": "SMITH1234",
    "chargeback_mail": "chargebacks@example.org",
})
headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer {{token}}}}'
}
conn.request("PUT", "/{{path}}/wp-json/tmt/v2/channels/{{id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
 curl --location --request PUT 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/channels/{{id}}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{token}}' \
--data-raw '{
    "name": "GBP Channel",
    "currencies": "GBP",
    "language": "enGB",
    "primary_mail": "john.smith@example.org,jane.smith@example.org",
    "mail_bcc_transactional_mails": true,
    "mail_failures": true,
    "receipt_label": "Smith Inc",
    "external_id": "SMITH1234",
    "chargeback_mail": "chargebacks@example.org",
}
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer {{token}}");


var raw = JSON.stringify({
    "name": "GBP Channel",
    "currencies": "GBP",
    "language": "enGB",
    "primary_mail": "john.smith@example.org,jane.smith@example.org",
    "mail_bcc_transactional_mails": true,
    "mail_failures": true,
    "receipt_label": "Smith Inc",
    "external_id": "SMITH1234",
    "chargeback_mail": "chargebacks@example.org",
});


var requestOptions = {
    'method: 'PUT',
    headers: myHeaders,
    body: raw,
    redirect: 'follow'
};


fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/channels/{{id}}", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "id": 3403,
    "uuid": "87bccae4-0993-4749-acb7-3af7fcacf1f3",
    "name": "GBP Channel",
    "slug": "kautzer-nienow1666786311",
    "account_type": "protected-processing",
    "account_mode": "draft",
    "protection_type": "trust-my-travel",
    "currencies": "GBP",
    "quote_code": "Quote1",
    "forex_feed": {
        "base": "GBP",
        "symbol": {
            "grapheme": "£",
            "template": "$1",
            "rtl": false
        },
        "rates": {
            "EUR": {
                "symbol": "EUR",
                "quote_id": 66126030,
                "rate": 1.2132,
                "provider": "cambridge",
                "expires": "2023-10-11 14:00:00",
                "modified": "2022-10-11 14:49:14"
            },
            "USD": {
                "symbol": "USD",
                "quote_id": 66126136,
                "rate": 1.2155,
                "provider": "cambridge",
                "expires": "2023-10-11 14:00:00",
                "modified": "2022-10-11 14:49:37"
            }
        }
    },
    "language": "enGB",
    "primary_mail": "john.smith@example.org,jane.smith@example.org",
    "mail_bcc_transactional_mails": true,
    "receipt_label": "Smith Inc",
    "beneficiary_id": "",
    "settlement_currency": "GBP",
    "external_id": "SMITH1234",
    "payout_minimum": 10000,
    "channel_status": "full-processing",
    "suppliers": [],
    "statement_period": "month",
    "cardholder_present": false,
    "mail_failures": true,
    "server_to_server": false,
    "tokenex_id": "1234567887654321",
    "tokenex_api_key": "QcFfUs9p8faeP974xwuvq6vqo55PTiWj",
    "chargeback_mail": "chargebacks@example.org",
    "descriptor": null,
    "channel_secret": ""
}

HTTP Request

PUT https://tmtprotects.com/{{path}}/wp-json/tmt/v2/channels/{{id}}

Schema

Parameter Type Description
name^ string Title for the channel.
currencies^ string The ISO 4217 value of the base currency of the channel.
Enum: valid currencies
language string Default mail receipt language.
Enum: deDE, enGB, esES, frFR, itIT, jaJA, kkKK, koKO, lvLV, ptBR, roRO, ruRU, ukUK, uzUZ, zhZH
Default: enGB
primary_mail string Comma separated list of email addresses to use if BCC'ing email.
mail_bcc_transactional_mails boolean Whether to BCC mail receipts to primary mail.
Default: false
mail_failures boolean Whether to send mail to primary mail on transaction failures.
Default: false
receipt_label string Company name to use in mail receipts. Defaults to site name.
external_id string The external identifier for the channel.
chargeback_mail string Comma separated list of email addresses to send Chargeback notification email to.

^Required

Delete A Channel

Make sure to replace {{path}} with your site path, {{id}} with a valid channel ID and {{token}} with a valid API token.

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/channels/{{channel_id}}',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer {{token}}'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("tmtprotects.com")
payload = ''
headers = {
    'Authorization': 'Bearer {{token}}'
}
conn.request("DELETE", "/{{path}}/wp-json/tmt/v2/channels/{{channel_id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --location --request DELETE 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/channels/{{channel_id}}' \
--header 'Authorization: Bearer {{token}}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{token}}");

var requestOptions = {
    method: 'DELETE',
    headers: myHeaders,
    redirect: 'follow'
};

fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/channels/{{channel_id}}", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "deleted": true
}

HTTP Request

DELETE https://tmtprotects.com/{{path}}/wp-json/tmt/v2/channels/{{channel_id}}

Bookings

Get All Bookings

Make sure to replace {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/bookings',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer {{token}}'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("tmtprotects.com")
payload = ''
headers = {
    'Authorization': 'Bearer {{token}}'
}
conn.request("GET", "/{{path}}/wp-json/tmt/v2/bookings", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --location --request GET 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/bookings' \
--header 'Authorization: Bearer {{token}}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{token}}");

var requestOptions = {
    method: 'GET',
    headers: myHeaders,
    redirect: 'follow'
};

fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/bookings", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

[
    {
        "id": 9,
        "trust_id": "3-9",
        "author": "elvissauer",
        "status": "paid",
        "title": "Rohan | elnorarohan@example.org",
        "content": "Holiday for 2 to nowhere.",
        "firstname": "Elnora",
        "surname": "Rohan",
        "email": "elnorarohan@example.org",
        "date": "2023-05-02",
        "date_start": "2023-04-26",
        "pax": 3,
        "reference": "VENICE-12345",
        "total": 9999,
        "total_unpaid": 0,
        "currencies": "GBP",
        "countries": "IT",
        "transaction_ids": [
            11
        ],
        "channels": 3403,
        "language": "enGB",
        "author_id": 69,
        "authorname": "elvissauer",
        "suppliers": [
            "MO-5-FL",
            "PM-4-BU"
        ],
        "created": "2022-10-26 12:11:52",
        "modified": "2022-10-26 12:11:52",
        "_links": {
            "self": [
                {
                    "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/bookings/9"
                }
            ],
            "collection": [
                {
                    "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/bookings"
                }
            ]
        }
    }
    ...
]

HTTP Request

GET https://tmtprotects.com/{{path}}/wp-json/tmt/v2/bookings

Query Parameters

Parameter Default Description
include all Limit result set to comma separated list of IDs.
page 1 Page of the collection to view.
per_page 10 Maximum number of items to be returned per page.
order asc Enum: asc, desc
orderby id Sort collection by defined attribute.
before all Limit response to items published before a given ISO8601 compliant date.
after all Limit response to items published after a given ISO8601 compliant date.
status all Limit result set to items assigned one or more statuses.
channels all Limit result set to all bookings that have the specified terms assigned in the channels taxonomy.
countries all Limit result set to all bookings that have the specified terms assigned in the countries taxonomy.
surname all Limit result set to all bookings that have the specified surname
email all Limit result set to all bookings that have the specified email
date_before all Limit response to bookings with end date of travel before a given ISO8601 compliant date.
date_after all Limit response to bookings with end date of travel after a given ISO8601 compliant date.
reference all Limit result set to all bookings that have the specified reference

Get A Booking

Make sure to replace {{booking_id}} with a valid booking ID, {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/bookings/{{booking_id}}',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer {{token}}'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("tmtprotects.com")
payload = ''
headers = {
    'Authorization': 'Bearer {{token}}'
}
conn.request("GET", "/{{path}}/wp-json/tmt/v2/bookings/{{booking_id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --location --request GET 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/bookings/{{booking_id}}' \
--header 'Authorization: Bearer {{token}}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{token}}");

var requestOptions = {
    method: 'GET',
    headers: myHeaders,
    redirect: 'follow'
};

fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/bookings/{{booking_id}}", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "id": 9,
    "trust_id": "3-9",
    "author": "elvissauer",
    "status": "paid",
    "title": "Rohan | elnorarohan@example.org",
    "content": "Holiday for 2 to nowhere.",
    "firstname": "Elnora",
    "surname": "Rohan",
    "email": "elnorarohan@example.org",
    "date": "2023-05-02",
    "date_start": "2023-04-26",
    "pax": 3,
    "reference": "VENICE-12345",
    "total": 9999,
    "total_unpaid": 0,
    "currencies": "GBP",
    "countries": "IT",
    "transaction_ids": [
        11
    ],
    "channels": 3403,
    "language": "enGB",
    "author_id": 69,
    "authorname": "elvissauer",
    "suppliers": [
        "MO-5-FL",
        "PM-4-BU"
    ],
    "created": "2022-10-26 12:11:52",
    "modified": "2022-10-26 12:11:52",
    "_links": {
        "self": [
            {
                "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/bookings/9"
            }
        ],
        "collection": [
            {
                "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/bookings"
            }
        ]
    }
}

HTTP Request

GET https://tmtprotects.com/{{path}}/wp-json/tmt/v2/bookings/{{booking_id}}

Schema

Parameter Type Description
id^ integer Unique identifier for the booking.
trust_id^ string Identifier for the booking prefixed with Site ID.
author^ string The user name of the author of the booking.
status^ string The status of the booking. This is automatically set to unpaid and adjusted as and when payments are received.
Enum: authorized, completed, locked, paid, partial-payment, unpaid
title^ string The auto-generated title of the booking as format Trust ID, Surname, Email.
content string Description of the booking.
firstname string The first name of the lead traveller.
surname string The surname of the lead traveller.
email string The email of the lead traveller.
date string The end date of the booking in Y-m-d format.
date_start string The start date of the booking in Y-m-d format.
pax integer Number of people the booking is for.
reference string Your reference for the booking.
total integer The total base currency cost of the booking in cents. This cannot be updated to be less than the total of all linked transactions.
total_unpaid^ integer The total unpaid base currency cost of the booking in cents.
currencies string The ISO 4217 value of the base currency of the booking. Must match the base currency of the Channel.
Enum: valid currencies
countries string The ISO 3166-1 alpha-2 value of the country(s) the booking takes place in. A comma separated string can be used for multiple values
Enum: valid countries
transaction_ids^ array Unique identifier(s) for any transaction(s) attempted against the booking.
channels integer Unique identifier for the channel the booking is for.
language string Mail receipt language.
Enum: deDE, enGB, esES, frFR, itIT, jaJA, kkKK, koKO, lvLV, ptBR, roRO, ruRU, ukUK, uzUZ, zhZH
Default: enGB
author_id^ integer The user ID of the author of the booking.
authorname^ string The username of the author of the booking.
suppliers array IDs of suppliers included in the booking
created^ string The date the booking was created, in GMT.
modified^ string The date the booking was last modified, in GMT.

^Readonly

Create A Booking

Make sure to replace {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/bookings',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => {
        "content": "River cruise in Venice",
        "firstname": "John",
        "surname": "Smith",
        "email": "john.smith@example.org",
        "date": "2025-10-07",
        "date_start": "2025-10-07",
        "pax": 3,
        "reference": "VENICE-12345",
        "total": 9999,
        "currencies": "GBP",
        "countries": "IT",
        "channels": 10165,
        "language": "enGB",
        "suppliers": ["ZA-14-AP", "TZ-15-DM"],
    },
    CURLOPT_HTTPHEADER => array(
        'Content-Type: application/json',
        'Authorization: Bearer {{token}}'
    ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import http.client
import json
conn = http.client.HTTPSConnection("tmtprotects.com")
payload = json.dumps({
    "content": "River cruise in Venice",
    "firstname": "John",
    "surname": "Smith",
    "email": "john.smith@example.org",
    "date": "2025-10-07",
    "date_start": "2025-10-07",
    "pax": 3,
    "reference": "VENICE-12345",
    "total": 9999,
    "currencies": "GBP",
    "countries": "IT",
    "channels": 10165,
    "language": "enGB",
    "suppliers": ["ZA-14-AP", "TZ-15-DM"],
})
headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer {{token}}}}'
}
conn.request("POST", "/{{path}}/wp-json/tmt/v2/bookings", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
 curl --location --request POST 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/bookings' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{token}}' \
--data-raw '{
    "content": "River cruise in Venice",
    "firstname": "John",
    "surname": "Smith",
    "email": "john.smith@example.org",
    "date": "2025-10-07",
    "date_start": "2025-10-07",
    "pax": 3,
    "reference": "VENICE-12345",
    "total": 9999,
    "currencies": "GBP",
    "countries": "IT",
    "channels": 10165,
    "language": "enGB",
    "suppliers": ["ZA-14-AP", "TZ-15-DM"],
}
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer {{token}}");


var raw = JSON.stringify({
    "content": "River cruise in Venice",
    "firstname": "John",
    "surname": "Smith",
    "email": "john.smith@example.org",
    "date": "2025-10-07",
    "date_start": "2025-10-07",
    "pax": 3,
    "reference": "VENICE-12345",
    "total": 9999,
    "currencies": "GBP",
    "countries": "IT",
    "channels": 10165,
    "language": "enGB",
    "suppliers": ["ZA-14-AP", "TZ-15-DM"],
});


var requestOptions = {
    'method: 'POST',
    headers: myHeaders,
    body: raw,
    redirect: 'follow'
};


fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/bookings", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "id": 9,
    "trust_id": "3-9",
    "author": "elvissauer",
    "status": "paid",
    "title": "Rohan | elnorarohan@example.org",
    "content": "River cruise in Venice",
    "firstname": "John",
    "surname": "Smith",
    "email": "john.smith@example.org",
    "date": "2025-10-07",
    "date_start": "2025-10-07",
    "pax": "3",
    "reference": "VENICE-12345",
    "total": 9999,
    "total_unpaid": 0,
    "currencies": "GBP",
    "countries": "IT",
    "transaction_ids": [
        11
    ],
    "channels": 10165,
    "language": "enGB",
    "author_id": 69,
    "authorname": "elvissauer",
    "suppliers": [
        "ZA-14-AP",
        "TZ-15-DM"
    ],
    "created": "2022-10-26 12:11:52",
    "modified": "2022-10-26 12:11:52",
    "_links": {
        "self": [
            {
                "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/bookings/9"
            }
        ],
        "collection": [
            {
                "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/bookings"
            }
        ]
    }
}

HTTP Request

POST https://tmtprotects.com/{{path}}/wp-json/tmt/v2/bookings

Schema

Parameter Type Description
content string Description of the booking.
firstname^ string The first name of the lead traveller.
surname^ string The surname of the lead traveller.
email^ string The email of the lead traveller.
date^ string The end date of the booking in Y-m-d format.
date_start string The start date of the booking in Y-m-d format.
pax integer Number of people the booking is for.
reference string Your reference for the booking.
total^ integer The total base currency cost of the booking in cents. This cannot be updated to be less than the total of all linked transactions.
currencies^ string The ISO 4217 value of the base currency of the booking. Must match the base currency of the Channel.
Enum: valid currencies
countries^ string The ISO 3166-1 alpha-2 value of the country(s) the booking takes place in. A comma separated string can be used for multiple values
Enum: valid countries
channels^ integer Unique identifier for the channel the booking is for.
language string Mail receipt language.
Enum: deDE, enGB, esES, frFR, itIT, jaJA, kkKK, koKO, lvLV, ptBR, roRO, ruRU, ukUK, uzUZ, zhZH
Default: enGB
suppliers array IDs of suppliers included in the booking

^Required

Update A Booking

Make sure to replace {{path}} with your site path, {{id}} with a valid booking ID and {{token}} with a valid API token.

$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/bookings/{{id}}',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_POSTFIELDS => {
        "content": "River cruise in Venice",
        "firstname": "John",
        "surname": "Smith",
        "email": "john.smith@example.org",
        "date": "2025-10-07",
        "date_start": "2025-10-07",
        "pax": 3,
        "reference": "VENICE-12345",
        "total": 9999,
        "currencies": "GBP",
        "countries": "IT",
        "channels": 10165,
        "language": "enGB",
        "suppliers": ["ZA-14-AP", "TZ-15-DM"],
    },
    CURLOPT_HTTPHEADER => array(
        'Content-Type: application/json',
        'Authorization: Bearer {{token}}'
    ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import http.client
import json
conn = http.client.HTTPSConnection("tmtprotects.com")
payload = json.dumps({
    "content": "River cruise in Venice",
    "firstname": "John",
    "surname": "Smith",
    "email": "john.smith@example.org",
    "date": "2025-10-07",
    "date_start": "2025-10-07",
    "pax": 3,
    "reference": "VENICE-12345",
    "total": 9999,
    "currencies": "GBP",
    "countries": "IT",
    "channels": 10165,
    "language": "enGB",
    "suppliers": ["ZA-14-AP", "TZ-15-DM"],
})
headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer {{token}}}}'
}
conn.request("PUT", "/{{path}}/wp-json/tmt/v2/bookings/{{id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
 curl --location --request PUT 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/bookings/{{id}}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{token}}' \
--data-raw '{
    "content": "River cruise in Venice",
    "firstname": "John",
    "surname": "Smith",
    "email": "john.smith@example.org",
    "date": "2025-10-07",
    "date_start": "2025-10-07",
    "pax": 3,
    "reference": "VENICE-12345",
    "total": 9999,
    "currencies": "GBP",
    "countries": "IT",
    "channels": 10165,
    "language": "enGB",
    "suppliers": ["ZA-14-AP", "TZ-15-DM"],
}
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer {{token}}");


var raw = JSON.stringify({
    "content": "River cruise in Venice",
    "firstname": "John",
    "surname": "Smith",
    "email": "john.smith@example.org",
    "date": "2025-10-07",
    "date_start": "2025-10-07",
    "pax": 3,
    "reference": "VENICE-12345",
    "total": 9999,
    "currencies": "GBP",
    "countries": "IT",
    "channels": 10165,
    "language": "enGB",
    "suppliers": ["ZA-14-AP", "TZ-15-DM"],
});


var requestOptions = {
    'method: 'PUT',
    headers: myHeaders,
    body: raw,
    redirect: 'follow'
};


fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/bookings/{{id}}", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "id": 9,
    "trust_id": "3-9",
    "author": "elvissauer",
    "status": "paid",
    "title": "Rohan | elnorarohan@example.org",
    "content": "River cruise in Venice",
    "firstname": "John",
    "surname": "Smith",
    "email": "john.smith@example.org",
    "date": "2025-10-07",
    "date_start": "2025-10-07",
    "pax": "3",
    "reference": "VENICE-12345",
    "total": 9999,
    "total_unpaid": 0,
    "currencies": "GBP",
    "countries": "IT",
    "transaction_ids": [
        11
    ],
    "channels": 10165,
    "language": "enGB",
    "author_id": 69,
    "authorname": "elvissauer",
    "suppliers": [
        "ZA-14-AP",
        "TZ-15-DM"
    ],
    "created": "2022-10-26 12:11:52",
    "modified": "2022-10-26 12:11:52",
    "_links": {
        "self": [
            {
                "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/bookings/9"
            }
        ],
        "collection": [
            {
                "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/bookings"
            }
        ]
    }
}

HTTP Request

PUT https://tmtprotects.com/{{path}}/wp-json/tmt/v2/bookings/{{id}}

Schema

Parameter Type Description
content string Description of the booking.
firstname^ string The first name of the lead traveller.
surname^ string The surname of the lead traveller.
email^ string The email of the lead traveller.
date^ string The end date of the booking in Y-m-d format.
date_start string The start date of the booking in Y-m-d format.
pax integer Number of people the booking is for.
reference string Your reference for the booking.
total^ integer The total base currency cost of the booking in cents. This cannot be updated to be less than the total of all linked transactions.
currencies^ string The ISO 4217 value of the base currency of the booking. Must match the base currency of the Channel.
Enum: valid currencies
countries^ string The ISO 3166-1 alpha-2 value of the country(s) the booking takes place in. A comma separated string can be used for multiple values
Enum: valid countries
channels^ integer Unique identifier for the channel the booking is for.
language string Mail receipt language.
Enum: deDE, enGB, esES, frFR, itIT, jaJA, kkKK, koKO, lvLV, ptBR, roRO, ruRU, ukUK, uzUZ, zhZH
Default: enGB
suppliers array IDs of suppliers included in the booking

^Required

Delete A Booking

Make sure to replace {{path}} with your site path, {{id}} with a valid booking ID and {{token}} with a valid API token.

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/bookings/{{booking_id}}',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer {{token}}'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("tmtprotects.com")
payload = ''
headers = {
    'Authorization': 'Bearer {{token}}'
}
conn.request("DELETE", "/{{path}}/wp-json/tmt/v2/bookings/{{booking_id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --location --request DELETE 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/bookings/{{booking_id}}' \
--header 'Authorization: Bearer {{token}}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{token}}");

var requestOptions = {
    method: 'DELETE',
    headers: myHeaders,
    redirect: 'follow'
};

fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/bookings/{{booking_id}}", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "deleted": true
}

HTTP Request

DELETE https://tmtprotects.com/{{path}}/wp-json/tmt/v2/bookings/{{booking_id}}

Suppliers

Get All Suppliers

Make sure to replace {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/suppliers',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer {{token}}'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("tmtprotects.com")
payload = ''
headers = {
    'Authorization': 'Bearer {{token}}'
}
conn.request("GET", "/{{path}}/wp-json/tmt/v2/suppliers", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --location --request GET 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/suppliers' \
--header 'Authorization: Bearer {{token}}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{token}}");

var requestOptions = {
    method: 'GET',
    headers: myHeaders,
    redirect: 'follow'
};

fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/suppliers", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

[
    {
        "id": "PM-4-BU",
        "name": "McKenzie, Glover and Upton",
        "url": "https://mckenziegloverandupton.com",
        "category": "BU",
        "country": "PM"
    }
    ...
]

HTTP Request

GET https://tmtprotects.com/{{path}}/wp-json/tmt/v2/suppliers

Query Parameters

Parameter Default Description
include all Limit result set to comma separated list of IDs.
page 1 Page of the collection to view.
per_page 10 Maximum number of items to be returned per page.
order asc Enum: asc, desc
orderby id Sort collection by defined attribute.
name all Search on wildcard name matches.
url all Search on url matches.
countries all Limit result set to all suppliers that have the countries specified.
categories all Limit result set to all suppliers that have the categories specified.

Get A Supplier

Make sure to replace {[supplier_id}} with a valid supplier ID, {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/suppliers/{[supplier_id}}',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer {{token}}'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("tmtprotects.com")
payload = ''
headers = {
    'Authorization': 'Bearer {{token}}'
}
conn.request("GET", "/{{path}}/wp-json/tmt/v2/suppliers/{{supplier_id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --location --request GET 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/suppliers/{{supplier_id}}' \
--header 'Authorization: Bearer {{token}}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{token}}");

var requestOptions = {
    method: 'GET',
    headers: myHeaders,
    redirect: 'follow'
};

fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/suppliers/{{supplier_id}}", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "id": "PM-4-BU",
    "name": "McKenzie, Glover and Upton",
    "url": "https://mckenziegloverandupton.com",
    "category": "BU",
    "country": "PM"
}

HTTP Request

GET https://tmtprotects.com/{{path}}/wp-json/tmt/v2/suppliers/{{supplier_id}}

Schema

Parameter Type Description
id^ string Unique identifier for the supplier.
name^ string The name of the supplier.
url^ url The url of the supplier's website.
country^ string The ISO 3166-1 alpha-2 country code of the country the supplier is located in.
Enum: valid countries
category^ string The category code of the supplier.
Enum: valid category code

^Readonly

Transactions

Get All Transactions

Make sure to replace {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer {{token}}'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("tmtprotects.com")
payload = ''
headers = {
    'Authorization': 'Bearer {{token}}'
}
conn.request("GET", "/{{path}}/wp-json/tmt/v2/transactions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --location --request GET 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions' \
--header 'Authorization: Bearer {{token}}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{token}}");

var requestOptions = {
    method: 'GET',
    headers: myHeaders,
    redirect: 'follow'
};

fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

[
    {
        "id": 11,
        "uuid": "cfc75e35-2869-4647-a8be-27472d43b534",
        "trust_id": "3-11",
        "created": "2022-10-26 12:11:52",
        "modified": "2022-10-26 12:11:52",
        "author": null,
        "status": "complete",
        "adjustments": [],
        "auth_code": null,
        "author_id": 1,
        "authorname": "modaluser3",
        "allocations": [
            {
                "id": 5,
                "value": 1000,
                "total": 1000,
                "channels": 3404,
                "currencies": "GBP",
                "operator": "flat",
                "reversed": false,
                "debit": {
                    "currencies": "GBP",
                    "total": 1000
                },
                "credit": {
                    "currencies": "GBP",
                    "total": 1000
                }
            }
        ],
        "bookings": [
            {
                "id": 9,
                "total": 9999,
                "reference": "VENICE-12345",
                "country": "IT",
                "channels": "3403",
                "currencies": "GBP"
            }
        ],
        "channels": 3403,
        "content": "Succeeded",
        "countries": "FR",
        "issuer_countries": "FR",
        "currencies": "GBP",
        "forex_id": null,
        "forex_rate": null,
        "forex": null,
        "hash": "88e23fb157df71cacba069d49324cfd1f069df3feeeb583aecb1d7c46ec328d9",
        "language": "enGB",
        "last_four_digits": "1111",
        "linked_id": null,
        "payee_email": "tomasturcotte@example.org",
        "payee_name": "Tomas",
        "payee_surname": "Turcotte",
        "payment_ids": [
            27,
            28,
            29,
            30,
            31,
            32
        ],
        "psp": "aci",
        "statement_date": "2022-10-26 00:00:00",
        "title": "Tomas Turcotte | tomasturcotte@example.org | purchase",
        "total_remaining": 9999,
        "total": 9999,
        "transaction_type": "purchase",
        "transaction_types": "purchase",
        "_links": {
            "self": [
                {
                    "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/transactions/11"
                }
            ],
            "collection": [
                {
                    "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/transactions"
                }
            ]
        },
        "token": "BXIDCT8H7AA",
        "attempt_3ds": false,
        "redirect_url": null,
        "payment_methods": "credit-card",
        "ip_address": "242.175.179.79",
        "bin_number": "403317",
        "card_type": "visa",
        "card_types": "visa"
    }
    ...
]

HTTP Request

GET https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions

Query Parameters

Parameter Default Description
include all Limit result set to specific IDs.
page 1 Page of the collection to view.
per_page 10 Maximum number of items to be returned per page.
order asc Enum: asc, desc
orderby id Sort collection by defined attribute.
after all Limit response to posts published after a given ISO8601 compliant date.
before all Limit response to posts published before a given ISO8601 compliant date.
exclude all Ensure result set excludes specific IDs.
status all Limit result set to posts assigned one or more statuses.
channels all Limit result set to all transactions that have the specified terms assigned in the channels taxonomy.
channels_exclude all Limit result set to all transactions except those that have the specified terms assigned in the channels taxonomy.
bin_number all Limit result set to all transactions that have the specified terms assigned in the bin_number taxonomy.
countries all Limit result set to all transactions that have the specified terms assigned in the countries taxonomy.
currencies all Limit result set to all transactions that have the specified terms assigned in the currencies taxonomy.
currencies_exclude all Limit result set to all transactions except those that have the specified terms assigned in the currencies taxonomy.
last_four_digits all Limit result set to all transactions that have the specified terms assigned in the last_four_digits taxonomy.
payment_methods all Limit result set to all transactions that have the specified terms assigned in the payment_methods taxonomy.
transaction_types all Limit result set to all transactions that have the specified terms assigned in the transaction_types taxonomy.
payee_surname all Limit result set to all transactions that have the specified payee_surname
payee_email all Limit result set to all transactions that have the specified payee_email
reference all Reference for the booking(s) the transaction was for.

Get A Transaction

Make sure to replace {{transaction_id}} with a valid transaction ID, {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions/{{transaction_id}}',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer {{token}}'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("tmtprotects.com")
payload = ''
headers = {
    'Authorization': 'Bearer {{token}}'
}
conn.request("GET", "/{{path}}/wp-json/tmt/v2/transactions/{{transaction_id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --location --request GET 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions/{{transaction_id}}' \
--header 'Authorization: Bearer {{token}}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{token}}");

var requestOptions = {
    method: 'GET',
    headers: myHeaders,
    redirect: 'follow'
};

fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions/{{transaction_id}}", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "id": 11,
    "uuid": "cfc75e35-2869-4647-a8be-27472d43b534",
    "trust_id": "3-11",
    "created": "2022-10-26 12:11:52",
    "modified": "2022-10-26 12:11:52",
    "author": null,
    "status": "complete",
    "adjustments": [],
    "auth_code": null,
    "author_id": 1,
    "authorname": "modaluser3",
    "allocations": [
        {
            "id": 5,
            "value": 1000,
            "total": 1000,
            "channels": 3404,
            "currencies": "GBP",
            "operator": "flat",
            "reversed": false,
            "debit": {
                "currencies": "GBP",
                "total": 1000
            },
            "credit": {
                "currencies": "GBP",
                "total": 1000
            }
        }
    ],
    "bookings": [
        {
            "id": 9,
            "total": 9999,
            "reference": "VENICE-12345",
            "country": "IT",
            "channels": "3403",
            "currencies": "GBP"
        }
    ],
    "channels": 3403,
    "content": "Succeeded",
    "countries": "FR",
    "issuer_countries": "FR",
    "currencies": "GBP",
    "forex_id": null,
    "forex_rate": null,
    "forex": null,
    "hash": "88e23fb157df71cacba069d49324cfd1f069df3feeeb583aecb1d7c46ec328d9",
    "language": "enGB",
    "last_four_digits": "1111",
    "linked_id": null,
    "payee_email": "tomasturcotte@example.org",
    "payee_name": "Tomas",
    "payee_surname": "Turcotte",
    "payment_ids": [
        27,
        28,
        29,
        30,
        31,
        32
    ],
    "psp": "aci",
    "statement_date": "2022-10-26 00:00:00",
    "title": "Tomas Turcotte | tomasturcotte@example.org | purchase",
    "total_remaining": 9999,
    "total": 9999,
    "transaction_type": "purchase",
    "transaction_types": "purchase",
    "_links": {
        "self": [
            {
                "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/transactions/11"
            }
        ],
        "collection": [
            {
                "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/transactions"
            }
        ]
    },
    "token": "BXIDCT8H7AA",
    "attempt_3ds": false,
    "redirect_url": null,
    "payment_methods": "credit-card",
    "ip_address": "242.175.179.79",
    "bin_number": "403317",
    "card_type": "visa",
    "card_types": "visa"
}

HTTP Request

GET https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions/{{transaction_id}}

Schema

Parameter Type Description
id^ integer Unique identifier for the transaction.
trust_id^ string Identifier for the transaction prefixed with Site ID.
uuid^ string Unique identifier for the transaction.
author^ integer Deprecated: The user ID of the author of the transaction.
author_id^ integer The user ID of the author of the transaction.
authorname^ string The username of the author of the transaction.
status^ string The status of the transaction.
Enum: complete, expired, failed, incomplete, locked, pending
created^ string The date the transaction was created, in GMT.
modified^ string The date the booking was last modified, in GMT.
title^ string The name of the transaction. Auto generated from booking title and transaction type
total_remaining^ integer The total available for refund, capture or void on the transaction.
card_type^ string Deprecated: The card type used for the transaction as returned by the Payment Service Provider.
Enum: visa, master, amex, jcb, diners, discover, other
card_types^ string The card type used for the transaction as returned by the Payment Service Provider.
Enum: visa, master, amex, jcb, diners, discover, other
statement_date^ string The date that the transaction is available for statements.
last_four_digits^ string Last four digits of the credit card used for the transaction. Can be set for protection only requests. Ignored in other requests
forex^ array Forex applied to transaction (forex transaction only). These values will be auto-generated.
forex_id^ integer ID of the forex transaction.
forex_rate^ string Exchange rate applied to transaction (forex transaction only). This value will be auto-generated.
payment_ids^ array IDs of credits and debits generated in relation to the transaction.
adjustments^ array IDs of any transactions that adjusted this one.
content^ string Payment gateway response
language string Mail receipt language.
Enum: deDE, enGB, esES, frFR, itIT, jaJA, kkKK, koKO, lvLV, ptBR, roRO, ruRU, ukUK, uzUZ, zhZH
Default: enGB
channels integer Unique identifier for the channel the transaction is for.
currencies string The ISO 4217 value of the currency of the transaction.
Enum: valid currencies
total integer The transaction total in cents.
transaction_type^ string Deprecated: The transaction type
transaction_types string The transaction type N.B. chargeback, chargeback-override and chargeback-reversal are for admin use only.
Enum: authorize, capture, chargeback, chargeback-reversal, chargeback-override, purchase, refund, retained_authorize, retained_purchase, vault, void
allocations array Allocate part of the transaction to another channel.
bookings array Funds allocation for the booking(s) the transaction is for.
psp string The payment service provider for the transaction. Must be a valid psp ID if channel is protection only
payment_methods string The payment method for the transaction.
Enum: bank-transfer, credit-card, sofort, ideal, giropay, alipay, rapipago, dlocal
payee_name string The first name of the payer as registered to their payment method (e.g. cardholder name).
payee_surname string The surname of the payer as registered to their payment method (e.g. cardholder name).
payee_email string The email address of the payer.
countries string The ISO 3166-1 alpha-2 value of the country the payment method is registered in.
Enum: valid countries
issuer_countries^ string The ISO 3166-1 alpha-2 value of the country the credit card is registered in.
token string The transaction token.
ip_address string The IP address of the user requesting the transaction.
bin_number string BIN number of the credit card used for the transaction.
attempt_3ds boolean Whether to attempt to enable 3DSecure on this transaction.
redirect_url string UTF8 encoded URL to redirect APM requests to.
linked_id integer Unique identifier for the transaction that we are applying the transaction_type to.
auth_code^ string Six digit authorization code generated by the bank when the transaction is created.
hash^ string Hash of the transaction's id, total, status and created timestamp which is used to verify the transaction once created.

^Readonly

Capture A Transaction

Make sure to replace {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => {
        "channels": 10165,
        "currencies": "GBP",
        "total": 9999,
        "transaction_types": "capture",
        "allocations": [
            {
                "channels": 10342,
                "currencies": "GBP",
                "total": 1000,
                "operator": "flat"
            }
        ],
        "bookings": [
            {
                "id": 342,
                "currencies": "GBP",
                "total": 9999
            }
        ],
        "linked_id": 351,
    },
    CURLOPT_HTTPHEADER => array(
        'Content-Type: application/json',
        'Authorization: Bearer {{token}}'
    ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import http.client
import json
conn = http.client.HTTPSConnection("tmtprotects.com")
payload = json.dumps({
    "channels": 10165,
    "currencies": "GBP",
    "total": 9999,
    "transaction_types": "capture",
    "allocations": [
        {
            "channels": 10342,
            "currencies": "GBP",
            "total": 1000,
            "operator": "flat"
        }
    ],
    "bookings": [
        {
            "id": 342,
            "currencies": "GBP",
            "total": 9999
        }
    ],
    "linked_id": 351,
})
headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer {{token}}}}'
}
conn.request("POST", "/{{path}}/wp-json/tmt/v2/transactions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
 curl --location --request POST 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{token}}' \
--data-raw '{
    "channels": 10165,
    "currencies": "GBP",
    "total": 9999,
    "transaction_types": "capture",
    "allocations": [
        {
            "channels": 10342,
            "currencies": "GBP",
            "total": 1000,
            "operator": "flat"
        }
    ],
    "bookings": [
        {
            "id": 342,
            "currencies": "GBP",
            "total": 9999
        }
    ],
    "linked_id": 351,
}
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer {{token}}");


var raw = JSON.stringify({
    "channels": 10165,
    "currencies": "GBP",
    "total": 9999,
    "transaction_types": "capture",
    "allocations": [
        {
            "channels": 10342,
            "currencies": "GBP",
            "total": 1000,
            "operator": "flat"
        }
    ],
    "bookings": [
        {
            "id": 342,
            "currencies": "GBP",
            "total": 9999
        }
    ],
    "linked_id": 351,
});


var requestOptions = {
    'method: 'POST',
    headers: myHeaders,
    body: raw,
    redirect: 'follow'
};


fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "id": 14,
    "uuid": "2547acc1-24c1-4847-8331-82c8afba5c6a",
    "trust_id": "3-14",
    "created": "2022-10-26 12:11:52",
    "modified": "2022-10-26 12:11:52",
    "author": null,
    "status": "complete",
    "adjustments": [],
    "auth_code": null,
    "author_id": null,
    "authorname": "",
    "allocations": {
        "id": 6,
        "value": 1000,
        "total": 1000,
        "channels": 10342,
        "currencies": "GBP",
        "operator": "flat",
        "reversed": false,
        "debit": {
            "currencies": "GBP",
            "total": 1000
        },
        "credit": {
            "currencies": "GBP",
            "total": 1000
        }
    },
    "bookings": {
        "id": 342,
        "total": 9999,
        "reference": "VENICE-12345",
        "country": "IT",
        "channels": "3403",
        "currencies": "GBP"
    },
    "channels": 10165,
    "content": "",
    "countries": "GB",
    "issuer_countries": "US",
    "currencies": "GBP",
    "forex_id": null,
    "forex_rate": null,
    "forex": null,
    "hash": "8ec3d87eef9975bb5d8b329c88e96bfe2ae9b4294542961c1bc45164c603dea5",
    "language": "enGB",
    "last_four_digits": null,
    "linked_id": 351,
    "payee_email": "john.smith@example.org",
    "payee_name": "John",
    "payee_surname": "Smith",
    "payment_ids": [
        35,
        36,
        37,
        38,
        39,
        40
    ],
    "psp": "aci",
    "statement_date": "2022-10-26 00:00:00",
    "title": "John Smith | john.smith@example.org | capture",
    "total_remaining": 9999,
    "total": 9999,
    "transaction_type": "capture",
    "transaction_types": "capture",
    "_links": {
        "self": [
            {
                "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/transactions/14"
            }
        ],
        "collection": [
            {
                "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/transactions"
            }
        ]
    },
    "token": "424242AbqWedkL4242",
    "attempt_3ds": true,
    "redirect_url": "https%3A%2F%2Fwww.example.com%2Fredirect-page%3Fid%3D12345",
    "payment_methods": "credit-card",
    "ip_address": "192.0.0.1",
    "bin_number": 424242,
    "card_type": null,
    "card_types": null
}

HTTP Request

POST https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions

If you opted to use the modal to create an authorize transaction by using the transactionType option you will need to capture the transaction via an API call. You can apply allocations at this stage if it suits your use case.

Schema

Parameter Type Description
channels^ integer Unique identifier for the channel the transaction is for.
currencies^ string The ISO 4217 value of the currency of the transaction.
Enum: valid currencies
total^ integer The transaction total in cents.
transaction_types^ string capture
allocations array Allocate part of the transaction to another channel.
bookings^ array Funds allocation for the booking(s) the transaction is for.
linked_id^ integer Unique identifier for the transaction that we are applying the transaction_type to.

^Required

Allocation Schema

Parameter Type Description
channels integer Unique identifier for the channel the allocation is for.
currencies string The ISO 4217 value of the currency the amount is in. Only required if operator is flat. Must match currency of allocation channel.
Enum: valid currencies
total integer Amount to allocate.
operator string Whether to allocate a percentage or flat amount.
Enum: percent, flat

^Required

Void A Transaction

Make sure to replace {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => {
        "channels": 10165,
        "currencies": "GBP",
        "total": 9999,
        "transaction_types": "void",
        "bookings": [
            {
                "id": 342,
                "currencies": "GBP",
                "total": 9999
            }
        ],
        "linked_id": 351,
    },
    CURLOPT_HTTPHEADER => array(
        'Content-Type: application/json',
        'Authorization: Bearer {{token}}'
    ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import http.client
import json
conn = http.client.HTTPSConnection("tmtprotects.com")
payload = json.dumps({
    "channels": 10165,
    "currencies": "GBP",
    "total": 9999,
    "transaction_types": "void",
    "bookings": [
        {
            "id": 342,
            "currencies": "GBP",
            "total": 9999
        }
    ],
    "linked_id": 351,
})
headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer {{token}}}}'
}
conn.request("POST", "/{{path}}/wp-json/tmt/v2/transactions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
 curl --location --request POST 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{token}}' \
--data-raw '{
    "channels": 10165,
    "currencies": "GBP",
    "total": 9999,
    "transaction_types": "void",
    "bookings": [
        {
            "id": 342,
            "currencies": "GBP",
            "total": 9999
        }
    ],
    "linked_id": 351,
}
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer {{token}}");


var raw = JSON.stringify({
    "channels": 10165,
    "currencies": "GBP",
    "total": 9999,
    "transaction_types": "void",
    "bookings": [
        {
            "id": 342,
            "currencies": "GBP",
            "total": 9999
        }
    ],
    "linked_id": 351,
});


var requestOptions = {
    'method: 'POST',
    headers: myHeaders,
    body: raw,
    redirect: 'follow'
};


fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "id": 15,
    "uuid": "71478e9b-3c3f-4dda-a605-c2d04aab79cc",
    "trust_id": "3-15",
    "created": "2022-10-26 12:11:52",
    "modified": "2022-10-26 12:11:52",
    "author": null,
    "status": "complete",
    "adjustments": [],
    "auth_code": null,
    "author_id": null,
    "authorname": "",
    "allocations": [],
    "bookings": {
        "id": 342,
        "total": 9999,
        "reference": "VENICE-12345",
        "country": "IT",
        "channels": "3403",
        "currencies": "GBP"
    },
    "channels": 10165,
    "content": "",
    "countries": "GB",
    "issuer_countries": "FR",
    "currencies": "GBP",
    "forex_id": null,
    "forex_rate": null,
    "forex": null,
    "hash": "cc7940b1aa30a89871880fa5a85a938031e837c3d1d89c3a2500456dedfe81b4",
    "language": "enGB",
    "last_four_digits": null,
    "linked_id": 351,
    "payee_email": "john.smith@example.org",
    "payee_name": "John",
    "payee_surname": "Smith",
    "payment_ids": [
        41
    ],
    "psp": "aci",
    "statement_date": "2022-10-26 00:00:00",
    "title": "John Smith | john.smith@example.org | void",
    "total_remaining": 0,
    "total": 9999,
    "transaction_type": "void",
    "transaction_types": "void",
    "_links": {
        "self": [
            {
                "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/transactions/15"
            }
        ],
        "collection": [
            {
                "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/transactions"
            }
        ]
    },
    "token": "424242AbqWedkL4242",
    "attempt_3ds": true,
    "redirect_url": "https%3A%2F%2Fwww.example.com%2Fredirect-page%3Fid%3D12345",
    "payment_methods": "credit-card",
    "ip_address": "192.0.0.1",
    "bin_number": 424242,
    "card_type": null,
    "card_types": null
}

HTTP Request

POST https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions

If you opted to use the modal to create an authorize transaction by using the transactionType option and decide not to go ahead with capturing the transaction, you should void the transaction via an API call.

Schema

Parameter Type Description
channels^ integer Unique identifier for the channel the transaction is for.
currencies^ string The ISO 4217 value of the currency of the transaction.
Enum: valid currencies
total^ integer The transaction total in cents.
transaction_types^ string void
bookings^ array Funds allocation for the booking(s) the transaction is for.
linked_id^ integer Unique identifier for the transaction that we are applying the transaction_type to.

^Required

Update A Transaction

Make sure to replace {{path}} with your site path, {{id}} with a valid transaction ID and {{token}} with a valid API token.

$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions/{{id}}',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_POSTFIELDS => {
        "allocations": [
            {
                "channels": 10342,
                "currencies": "GBP",
                "total": 1000,
                "operator": "flat"
            }
        ],
    },
    CURLOPT_HTTPHEADER => array(
        'Content-Type: application/json',
        'Authorization: Bearer {{token}}'
    ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import http.client
import json
conn = http.client.HTTPSConnection("tmtprotects.com")
payload = json.dumps({
    "allocations": [
        {
            "channels": 10342,
            "currencies": "GBP",
            "total": 1000,
            "operator": "flat"
        }
    ],
})
headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer {{token}}}}'
}
conn.request("PUT", "/{{path}}/wp-json/tmt/v2/transactions/{{id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
 curl --location --request PUT 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions/{{id}}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{token}}' \
--data-raw '{
    "allocations": [
        {
            "channels": 10342,
            "currencies": "GBP",
            "total": 1000,
            "operator": "flat"
        }
    ],
}
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer {{token}}");


var raw = JSON.stringify({
    "allocations": [
        {
            "channels": 10342,
            "currencies": "GBP",
            "total": 1000,
            "operator": "flat"
        }
    ],
});


var requestOptions = {
    'method: 'PUT',
    headers: myHeaders,
    body: raw,
    redirect: 'follow'
};


fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions/{{id}}", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "id": 11,
    "uuid": "cfc75e35-2869-4647-a8be-27472d43b534",
    "trust_id": "3-11",
    "created": "2022-10-26 12:11:52",
    "modified": "2022-10-26 12:11:52",
    "author": null,
    "status": "complete",
    "adjustments": [],
    "auth_code": null,
    "author_id": 1,
    "authorname": "modaluser3",
    "allocations": {
        "id": 5,
        "value": 1000,
        "total": 1000,
        "channels": 10342,
        "currencies": "GBP",
        "operator": "flat",
        "reversed": false,
        "debit": {
            "currencies": "GBP",
            "total": 1000
        },
        "credit": {
            "currencies": "GBP",
            "total": 1000
        }
    },
    "bookings": {
        "id": 342,
        "total": 9999,
        "reference": "VENICE-12345",
        "country": "IT",
        "channels": "3403",
        "currencies": "GBP"
    },
    "channels": 10165,
    "content": "Succeeded",
    "countries": "GB",
    "issuer_countries": "FR",
    "currencies": "GBP",
    "forex_id": null,
    "forex_rate": null,
    "forex": null,
    "hash": "88e23fb157df71cacba069d49324cfd1f069df3feeeb583aecb1d7c46ec328d9",
    "language": "enGB",
    "last_four_digits": "1111",
    "linked_id": 351,
    "payee_email": "john.smith@example.org",
    "payee_name": "John",
    "payee_surname": "Smith",
    "payment_ids": [
        27,
        28,
        29,
        30,
        31,
        32
    ],
    "psp": "aci",
    "statement_date": "2022-10-26 00:00:00",
    "title": "John Smith | john.smith@example.org | purchase",
    "total_remaining": 9999,
    "total": 9999,
    "transaction_type": "purchase",
    "transaction_types": "purchase",
    "_links": {
        "self": [
            {
                "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/transactions/11"
            }
        ],
        "collection": [
            {
                "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/transactions"
            }
        ]
    },
    "token": "424242AbqWedkL4242",
    "attempt_3ds": true,
    "redirect_url": "https%3A%2F%2Fwww.example.com%2Fredirect-page%3Fid%3D12345",
    "payment_methods": "credit-card",
    "ip_address": "192.0.0.1",
    "bin_number": 424242,
    "card_type": "visa",
    "card_types": "visa"
}

HTTP Request

PUT https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions/{{id}}

Schema

Parameter Type Description
allocations array Allocate part of the transaction to another channel.

^Required

Allocation Schema

Parameter Type Description
channels integer Unique identifier for the channel the allocation is for.
currencies string The ISO 4217 value of the currency the amount is in. Only required if operator is flat. Must match currency of allocation channel.
Enum: valid currencies
total integer Amount to allocate.
operator string Whether to allocate a percentage or flat amount.
Enum: percent, flat

^Required

Refund A Transaction

Make sure to replace {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => {
        "channels": 10165,
        "currencies": "GBP",
        "total": 9999,
        "transaction_types": "refund",
        "allocations": [
            {
                "channels": 10342,
                "currencies": "GBP",
                "total": 1000,
                "operator": "flat"
            }
        ],
        "bookings": [
            {
                "id": 342,
                "currencies": "GBP",
                "total": 9999
            }
        ],
        "linked_id": 351,
    },
    CURLOPT_HTTPHEADER => array(
        'Content-Type: application/json',
        'Authorization: Bearer {{token}}'
    ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import http.client
import json
conn = http.client.HTTPSConnection("tmtprotects.com")
payload = json.dumps({
    "channels": 10165,
    "currencies": "GBP",
    "total": 9999,
    "transaction_types": "refund",
    "allocations": [
        {
            "channels": 10342,
            "currencies": "GBP",
            "total": 1000,
            "operator": "flat"
        }
    ],
    "bookings": [
        {
            "id": 342,
            "currencies": "GBP",
            "total": 9999
        }
    ],
    "linked_id": 351,
})
headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer {{token}}}}'
}
conn.request("POST", "/{{path}}/wp-json/tmt/v2/transactions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
 curl --location --request POST 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{token}}' \
--data-raw '{
    "channels": 10165,
    "currencies": "GBP",
    "total": 9999,
    "transaction_types": "refund",
    "allocations": [
        {
            "channels": 10342,
            "currencies": "GBP",
            "total": 1000,
            "operator": "flat"
        }
    ],
    "bookings": [
        {
            "id": 342,
            "currencies": "GBP",
            "total": 9999
        }
    ],
    "linked_id": 351,
}
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer {{token}}");


var raw = JSON.stringify({
    "channels": 10165,
    "currencies": "GBP",
    "total": 9999,
    "transaction_types": "refund",
    "allocations": [
        {
            "channels": 10342,
            "currencies": "GBP",
            "total": 1000,
            "operator": "flat"
        }
    ],
    "bookings": [
        {
            "id": 342,
            "currencies": "GBP",
            "total": 9999
        }
    ],
    "linked_id": 351,
});


var requestOptions = {
    'method: 'POST',
    headers: myHeaders,
    body: raw,
    redirect: 'follow'
};


fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "id": 18,
    "uuid": "7499c1e2-96d6-4b58-a521-9e2f488fd1f3",
    "trust_id": "3-18",
    "created": "2022-10-26 12:11:52",
    "modified": "2022-10-26 12:11:52",
    "author": null,
    "status": "complete",
    "adjustments": [],
    "auth_code": null,
    "author_id": null,
    "authorname": "",
    "allocations": {
        "id": 9,
        "value": 1000,
        "total": 1000,
        "channels": 10342,
        "currencies": "GBP",
        "operator": "flat",
        "reversed": true,
        "debit": {
            "currencies": "GBP",
            "total": 1000
        },
        "credit": {
            "currencies": "GBP",
            "total": 1000
        }
    },
    "bookings": {
        "id": 342,
        "total": 9999,
        "reference": "VENICE-12345",
        "country": "IT",
        "channels": "3403",
        "currencies": "GBP"
    },
    "channels": 10165,
    "content": "",
    "countries": "GB",
    "issuer_countries": "GB",
    "currencies": "GBP",
    "forex_id": null,
    "forex_rate": null,
    "forex": null,
    "hash": "e4b9fb7c039b33eb2fa274b712ad06e755025419ffd164031c956ad8ad8a46e5",
    "language": "enGB",
    "last_four_digits": null,
    "linked_id": 351,
    "payee_email": "john.smith@example.org",
    "payee_name": "John",
    "payee_surname": "Smith",
    "payment_ids": [
        51,
        52,
        53
    ],
    "psp": "aci",
    "statement_date": "2022-10-26 00:00:00",
    "title": "John Smith | john.smith@example.org | refund",
    "total_remaining": 0,
    "total": 9999,
    "transaction_type": "refund",
    "transaction_types": "refund",
    "_links": {
        "self": [
            {
                "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/transactions/18"
            }
        ],
        "collection": [
            {
                "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/transactions"
            }
        ]
    },
    "token": "424242AbqWedkL4242",
    "attempt_3ds": true,
    "redirect_url": "https%3A%2F%2Fwww.example.com%2Fredirect-page%3Fid%3D12345",
    "payment_methods": "credit-card",
    "ip_address": "192.0.0.1",
    "bin_number": 424242,
    "card_type": null,
    "card_types": null
}

To refund a transaction, you make a POST request to the transactions endpoint and include a reference to the ID of the transaction being refunded in the linked_id field.

If you are refunding a transaction that included allocations, you can reverse the allocation by including an allocations object in the request.

HTTP Request

POST https://tmtprotects.com/{{path}}/wp-json/tmt/v2/transactions

Schema

Parameter Type Description
channels^ integer Unique identifier for the channel the transaction is for.
currencies^ string The ISO 4217 value of the currency of the transaction.
Enum: valid currencies
total^ integer The transaction total in cents.
transaction_types^ string refund
allocations array Reverse an allocation made in the transaction being refunded. NB: Only applicable if the transaction being refunded involves allocations
bookings^ array Funds allocation for the booking(s) the transaction is for.
linked_id^ integer Unique identifier for the transaction that we are applying the transaction_type to.

^Required

Allocation Schema

Parameter Type Description
channels integer Unique identifier for the channel the allocation reversal is for.
currencies string The ISO 4217 value of the currency the amount is in. Only required if operator is flat. Must match currency of allocation channel.
Enum: valid currencies
total integer Amount to reverse from the initial allocation.
operator string Whether to reverse a percentage or flat amount.
Enum: percent, flat

^Required

Payments

The payments endpoint returns all internal payments made against a transaction. These payments include processing fees, reserves, forex credits and allocations.

Get All Payments

Make sure to replace {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/payments',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer {{token}}'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("tmtprotects.com")
payload = ''
headers = {
    'Authorization': 'Bearer {{token}}'
}
conn.request("GET", "/{{path}}/wp-json/tmt/v2/payments", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --location --request GET 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/payments' \
--header 'Authorization: Bearer {{token}}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{token}}");

var requestOptions = {
    method: 'GET',
    headers: myHeaders,
    redirect: 'follow'
};

fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/payments", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

[
    {
        "id": 27,
        "trust_id": "3-27",
        "created": "2022-10-26 12:11:52",
        "modified": "2022-10-26 12:11:52",
        "member_id": 3,
        "currencies": "GBP",
        "payment_types": "debit",
        "total": 30,
        "channels": 3403,
        "transaction_id": 11,
        "payment_classifications": "tmt",
        "content": "3403-11: Transaction Fee",
        "title": "3403-11: Transaction Fee",
        "statement_date": "2022-10-26 12:11:52",
        "reversed": false
    }
    ...
]

HTTP Request

GET https://tmtprotects.com/{{path}}/wp-json/tmt/v2/payments

Query Parameters

Parameter Default Description
include all Limit result set to comma separated list of IDs.
page 1 Page of the collection to view.
per_page 10 Maximum number of items to be returned per page.
order asc Enum: asc, desc
orderby id Sort collection by defined attribute.
after all Limit response to posts published after a given ISO8601 compliant date.
before all Limit response to posts published before a given ISO8601 compliant date.
exclude all Ensure result set excludes specific IDs.
status all Limit result set to posts assigned one or more statuses.
channels all Limit result set to all payments that have the specified terms assigned in the channels taxonomy.
channels_exclude all Limit result set to all payments except those that have the specified terms assigned in the channels taxonomy.
payment_classifications all Limit result set to all payments that have the specified terms assigned in the payment_classifications taxonomy.
payment_classifications_exclude all Limit result set to all payments except those that have the specified terms assigned in the payment_classifications taxonomy.
payment_types all Limit result set to all payments that have the specified terms assigned in the payment_types taxonomy.
payment_types_exclude all Limit result set to all payments except those that have the specified terms assigned in the payment_types taxonomy.

Get A Payment

Make sure to replace {{payment_id}} with a valid payment ID, {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/payments/{{payment_id}}',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer {{token}}'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("tmtprotects.com")
payload = ''
headers = {
    'Authorization': 'Bearer {{token}}'
}
conn.request("GET", "/{{path}}/wp-json/tmt/v2/payments/{{payment_id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --location --request GET 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/payments/{{payment_id}}' \
--header 'Authorization: Bearer {{token}}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{token}}");

var requestOptions = {
    method: 'GET',
    headers: myHeaders,
    redirect: 'follow'
};

fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/payments/{{payment_id}}", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "id": 27,
    "trust_id": "3-27",
    "created": "2022-10-26 12:11:52",
    "modified": "2022-10-26 12:11:52",
    "member_id": 3,
    "currencies": "GBP",
    "payment_types": "debit",
    "total": 30,
    "channels": 3403,
    "transaction_id": 11,
    "payment_classifications": "tmt",
    "content": "3403-11: Transaction Fee",
    "title": "3403-11: Transaction Fee",
    "statement_date": "2022-10-26 12:11:52",
    "reversed": false
}

HTTP Request

GET https://tmtprotects.com/{{path}}/wp-json/tmt/v2/payments/{{payment_id}}

Schema

Parameter Type Description
id^ integer Unique identifier for the payment.
trust_id^ string Identifier for the payment prefixed with Site ID.
member_id^ integer Member ID.
created^ string The date the payment was created, in GMT.
modified^ string The date the payment was modified, in GMT.
title^ string The title of the payment.
content^ string Description of the payment.
currencies^ string The ISO 4217 value of the currency of the payment.
Enum: valid currencies
payment_types^ string The type of payment.
Enum: credit, debit
total^ integer The payment total in cents.
channels^ integer Unique identifier for the channel the payment belongs too.
transaction_id^ integer Unique identifier for the transaction that triggered the payment.
payment_classifications^ string The classification of the payment.
Enum: allocation, chargeback-fee, forex, reserve, statement, tmt
statement_date^ string The date that the payent is available for statements.
reversed^ boolean Whether the payment has been subsequently reversed.

^Readonly

Statements

On Monday and Friday of every week, a statement will be generated indicating total money in and deductions.

Get All Statements

Make sure to replace {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/statements',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer {{token}}'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("tmtprotects.com")
payload = ''
headers = {
    'Authorization': 'Bearer {{token}}'
}
conn.request("GET", "/{{path}}/wp-json/tmt/v2/statements", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --location --request GET 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/statements' \
--header 'Authorization: Bearer {{token}}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{token}}");

var requestOptions = {
    method: 'GET',
    headers: myHeaders,
    redirect: 'follow'
};

fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/statements", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

[
    {
        "member_id": 3,
        "id": 2,
        "trust_id": "3-2",
        "status": "pending",
        "title": "3403-kautzer-nienow1666786311-WEEK-40-2-2022",
        "statement_date": "2022-10-10 00:00:00",
        "modified_date": "2022-10-26 12:11:52",
        "date_range": {
            "start": "2022-10-07 00:00:00",
            "end": "2022-10-09 00:00:00"
        },
        "channels": "3403",
        "statement_batches": "WEEK-40-2-2022",
        "credits": {
            "gross_booking_transactions": 43135,
            "reserve_release": 5027,
            "forex_commission": 716,
            "allocations": 0,
            "chargeback_reversals": 3165,
            "chargeback_overrides": 0,
            "carried_over_to_next_statement": 0,
            "total": 52043
        },
        "debits": {
            "reserve": 4314,
            "purchase_charges": 1630,
            "authorize_charges": 0,
            "allocations": 0,
            "capture_charges": 0,
            "void_charges": 0,
            "refunds": 1506,
            "refund_charges": 30,
            "chargebacks": 7893,
            "chargeback_charges": 6000,
            "owing_from_previous_statement": 0,
            "total": 21373
        },
        "release_fee": 0,
        "total": 30670,
        "currencies": "GBP",
        "booking_transactions": [],
        "_links": {
            "self": [
                {
                    "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/statements/2"
                }
            ],
            "collection": [
                {
                    "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/statements"
                }
            ]
        }
    }
    ...
]

HTTP Request

GET https://tmtprotects.com/{{path}}/wp-json/tmt/v2/statements

Query Parameters

Parameter Default Description
include all Limit result set to comma separated list of IDs.
page 1 Page of the collection to view.
per_page 10 Maximum number of items to be returned per page.
order asc Enum: asc, desc
orderby id Sort collection by defined attribute.
after all Limit response to posts published after a given ISO8601 compliant date.
before all Limit response to posts published before a given ISO8601 compliant date.
exclude all Ensure result set excludes specific IDs.
status all Limit result set to items assigned one or more statuses.
channels all Limit result set to all statements that have the specified terms assigned in the channels taxonomy.
currencies all Limit result set to all statements that have the specified terms assigned in the currencies taxonomy.

Get A Statement

Make sure to replace {{statement_id}} with a valid statement ID, {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/statements/{{statement_id}}',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer {{token}}'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("tmtprotects.com")
payload = ''
headers = {
    'Authorization': 'Bearer {{token}}'
}
conn.request("GET", "/{{path}}/wp-json/tmt/v2/statements/{{statement_id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --location --request GET 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/statements/{{statement_id}}' \
--header 'Authorization: Bearer {{token}}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{token}}");

var requestOptions = {
    method: 'GET',
    headers: myHeaders,
    redirect: 'follow'
};

fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/statements/{{statement_id}}", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "member_id": 3,
    "id": 2,
    "trust_id": "3-2",
    "status": "pending",
    "title": "3403-kautzer-nienow1666786311-WEEK-40-2-2022",
    "statement_date": "2022-10-10 00:00:00",
    "modified_date": "2022-10-26 12:11:52",
    "date_range": {
        "start": "2022-10-07 00:00:00",
        "end": "2022-10-09 00:00:00"
    },
    "channels": "3403",
    "statement_batches": "WEEK-40-2-2022",
    "credits": {
        "gross_booking_transactions": 43135,
        "reserve_release": 5027,
        "forex_commission": 716,
        "allocations": 0,
        "chargeback_reversals": 3165,
        "chargeback_overrides": 0,
        "carried_over_to_next_statement": 0,
        "total": 52043
    },
    "debits": {
        "reserve": 4314,
        "purchase_charges": 1630,
        "authorize_charges": 0,
        "allocations": 0,
        "capture_charges": 0,
        "void_charges": 0,
        "refunds": 1506,
        "refund_charges": 30,
        "chargebacks": 7893,
        "chargeback_charges": 6000,
        "owing_from_previous_statement": 0,
        "total": 21373
    },
    "release_fee": 0,
    "total": 30670,
    "currencies": "GBP",
    "booking_transactions": [],
    "_links": {
        "self": [
            {
                "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/statements/2"
            }
        ],
        "collection": [
            {
                "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/statements"
            }
        ]
    }
}

HTTP Request

GET https://tmtprotects.com/{{path}}/wp-json/tmt/v2/statements/{{statement_id}}

Schema

Parameter Type Description
id^ integer Unique identifier for the statement.
trust_id^ string Identifier for the statement prefixed with Site ID.
member_id^ integer Member ID.
modified_date^ string The date the statement was modified, in GMT.
statement_date^ string The date the statement was created, in GMT.
date_range^ object The date and time range within which all transactions and payments for the statement took place, in GMT
status^ string The status of the statement.
Enum: pending, publish
title^ string The title of the statement.
channels^ integer Unique identifier for the channel the statement belongs too.
currencies^ string The ISO 4217 value of the currency of the statement.
Enum: valid currencies
booking_transactions^ array Transactions and Payments ordered by booking. Deprecated.
credits^ object Credits applied to the statment.
debits^ object Debits applied to the statment.
release_fee^ integer The statement release fee in cents.
total^ integer The statement total in cents.
statement_batches^ string The statement batch ID that the statement is for.

^Readonly

Get A Statement Export

Make sure to replace {{statement_id}} with a valid statement ID, {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/statements/{{statement_id}}?csv_url=true',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer {{token}}'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("tmtprotects.com")
payload = ''
headers = {
    'Authorization': 'Bearer {{token}}'
}
conn.request("GET", "/{{path}}/wp-json/tmt/v2/statements/{{statement_id}}?csv_url=true", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --location --request GET 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/statements/{{statement_id}}?csv_url=true' \
--header 'Authorization: Bearer {{token}}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{token}}");

var requestOptions = {
    method: 'GET',
    headers: myHeaders,
    redirect: 'follow'
};

fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/statements/{{statement_id}}?csv_url=true", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "member_id": 3,
    "id": 2,
    "trust_id": "3-2",
    "status": "pending",
    "title": "3403-kautzer-nienow1666786311-WEEK-40-2-2022",
    "statement_date": "2022-10-10 00:00:00",
    "modified_date": "2022-10-26 12:11:52",
    "date_range": {
        "start": "2022-10-07 00:00:00",
        "end": "2022-10-09 00:00:00"
    },
    "channels": "3403",
    "statement_batches": "WEEK-40-2-2022",
    "credits": {
        "gross_booking_transactions": 43135,
        "reserve_release": 5027,
        "forex_commission": 716,
        "allocations": 0,
        "chargeback_reversals": 3165,
        "chargeback_overrides": 0,
        "carried_over_to_next_statement": 0,
        "total": 52043
    },
    "debits": {
        "reserve": 4314,
        "purchase_charges": 1630,
        "authorize_charges": 0,
        "allocations": 0,
        "capture_charges": 0,
        "void_charges": 0,
        "refunds": 1506,
        "refund_charges": 30,
        "chargebacks": 7893,
        "chargeback_charges": 6000,
        "owing_from_previous_statement": 0,
        "total": 21373
    },
    "release_fee": 0,
    "total": 30670,
    "currencies": "GBP",
    "booking_transactions": [],
    "_links": {
        "self": [
            {
                "href": "https://localhost/tmt-test/wp-json/tmt/v2/statements/2",
                "csv": "https://tmt-statements.s3.eu-west-1.amazonaws.com//3/3403/3403-kautzer-nienow1666786311-WEEK-40-2-2022.zip?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIATUEVSS5OMXONFKNV%2F20210707%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20210707T141334Z&X-Amz-SignedHeaders=host&X-Amz-Expires=900&X-Amz-Signature=aeca51e588bd166660f0cd246706be93f5d53e0fedeee46fe0f81743672537ca"
            }
        ],
        "collection": [
            {
                "href": "https://localhost/tmt-test/wp-json/tmt/v2/statements"
            }
        ]
    }
}

HTTP Request

GET https://tmtprotects.com/{{path}}/wp-json/tmt/v2/statements/{{statement_id}}?csv_url=true

As well as viewing a single statement, you can also request a URL for a CSV download that includes the transactions that the statement is based on. This is done by including the csv_url parameter and setting it to true

The URL for the CSV download will be included in response._links.self[0].csv

Ledger

The ledger endpoint returns all monies ready for release in the next payout period. This includes published statements and ad-hoc credits and debits.

Get All Ledger Entries

Make sure to replace {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/ledgers',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer {{token}}'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("tmtprotects.com")
payload = ''
headers = {
    'Authorization': 'Bearer {{token}}'
}
conn.request("GET", "/{{path}}/wp-json/tmt/v2/ledgers", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --location --request GET 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/ledgers' \
--header 'Authorization: Bearer {{token}}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{token}}");

var requestOptions = {
    method: 'GET',
    headers: myHeaders,
    redirect: 'follow'
};

fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/ledgers", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

[
    {
        "id": 2,
        "channels": 3403,
        "title": "3403-kautzer-nienow1666786311-WEEK-40-2-2022",
        "type": "credit",
        "total": 30670,
        "status": "pending",
        "currencies": "GBP",
        "related": {
            "type": "statements",
            "id": 2
        },
        "ledger_entry_date": "2022-10-26 12:11:52",
        "modified_date": "2022-10-26 12:11:52",
        "_links": {
            "self": [
                {
                    "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/ledger/2"
                }
            ],
            "collection": [
                {
                    "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/ledger"
                }
            ]
        }
    }
    ...
]

HTTP Request

GET https://tmtprotects.com/{{path}}/wp-json/tmt/v2/ledger

Query Parameters

Parameter Default Description
include all Limit result set to comma separated list of IDs.
page 1 Page of the collection to view.
per_page 10 Maximum number of items to be returned per page.
order asc Enum: asc, desc
orderby id Sort collection by defined attribute.
after all Limit response to ledger entries created after a given ISO8601 compliant date.
before all Limit response to ledger entries created before a given ISO8601 compliant date.
status all Limit result set to items assigned one or more statuses.
channels all Limit result set to ledger entries assigned to the specified channel.
aggregate null Enum: total

Get A Ledger Entry

Make sure to replace {{ledger_id}} with a valid ledger ID, {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/ledger/{{ledger_id}}',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer {{token}}'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("tmtprotects.com")
payload = ''
headers = {
    'Authorization': 'Bearer {{token}}'
}
conn.request("GET", "/{{path}}/wp-json/tmt/v2/ledger/{{ledger_id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --location --request GET 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/ledger/{{ledger_id}}' \
--header 'Authorization: Bearer {{token}}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{token}}");

var requestOptions = {
    method: 'GET',
    headers: myHeaders,
    redirect: 'follow'
};

fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/ledger/{{ledger_id}}", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "id": 2,
    "channels": 3403,
    "title": "3403-kautzer-nienow1666786311-WEEK-40-2-2022",
    "type": "credit",
    "total": 30670,
    "status": "pending",
    "currencies": "GBP",
    "related": {
        "type": "statements",
        "id": 2
    },
    "ledger_entry_date": "2022-10-26 12:11:52",
    "modified_date": "2022-10-26 12:11:52",
    "_links": {
        "self": [
            {
                "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/ledger/2"
            }
        ],
        "collection": [
            {
                "href": "https://tmtprotects.com/tmt-test/wp-json/tmt/v2/ledger"
            }
        ]
    }
}

HTTP Request

GET https://tmtprotects.com/{{path}}/wp-json/tmt/v2/ledger/{{ledger_id}}

Schema

Parameter Type Description
id^ integer Unique identifier for the ledger entry.
channels^ integer Unique identifier for the channel the ledger entry belongs to.
title^ string The ledger entry title.
type^ string Indicates whether the ledger entry is a debit or credit transaction.
Enum: debit, credit
total^ integer The ledger entry total in cents.
status^ string Indicates whether the ledger entry is pending or has been published.
Enum: pending, publish
currencies^ string The ISO 4217 value of the currency associated with the channel of the ledger entry.
Enum: valid currencies
related^ object The original item related to the ledger entry.
ledger_entry_date^ string The date the ledger entry was created, in GMT.
modified_date^ string The date the ledger entry was modified, in GMT.

^Readonly

Get Channel Total in Ledger

Make sure to replace {{channel_id}} with a valid channel ID, {{status}} with "pending" for ledger owing or "publish" for ledger paid {{path}} with your site path and {{token}} with a valid API token.

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/ledger?channels={{channel_id}}&status={{status}}&aggregate=total',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer {{token}}'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("tmtprotects.com")
payload = ''
headers = {
    'Authorization': 'Bearer {{token}}'
}
conn.request("GET", "/{{path}}/wp-json/tmt/v2/ledger?channels={{channel_id}}&status={{status}}&aggregate=total", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --location --request GET 'https://tmtprotects.com/{{path}}/wp-json/tmt/v2/ledger?channels={{channel_id}}&status={{status}}&aggregate=total' \
--header 'Authorization: Bearer {{token}}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{token}}");

var requestOptions = {
    method: 'GET',
    headers: myHeaders,
    redirect: 'follow'
};

fetch("https://tmtprotects.com/{{path}}/wp-json/tmt/v2/ledger?channels={{channel_id}}&status={{status}}&aggregate=total", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "total": "30670"
}

HTTP Request

GET https://tmtprotects.com/{{path}}/wp-json/tmt/v2/ledger?channels={{channel_id}}&status={{status}}&aggregate=total

Errors

The API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- You do not have permissions to view this resource or perform this action.
404 Not Found -- The item could not be found.
500 Internal Server Error -- We had a problem with our server. Try again later.
504 Server Timeout -- Our server timed out performing the request. Try again later.

Changelog

3.6.1

3.6.0

3.5.0

3.4.0

3.3.0

3.1.0

3.0.2