home > support > API > List Payments

List Payments

List of payments


Notes

List of payments is useful to perform reports of transactions. You can request payments for a specific period but if not dates sent, will return payments made in the actual day. As well is possible to ask for payments from a specific staff member. Can be used by operators and travel agents.

REST info

Endpoint/c/booking/payment/list
FormatsXML
Example/c/booking/payment/list.xml
VerbGET

Code samples

PHP examples use the PHP Client Library with SimpleXML

Description

object list_payments ( [ string $queryString = "" [, int $channel = 0 ]] ) 


Parameters

queryString
Search query string, see possible values in the table below
$channel
ID for a Channel (supplier) to list payments from

Example

// Set the Channel ID
// For Suppliers this can be found in the API settings page
// For Partners this can be a specific Channel or 0 to list from all
$channel = 3;

//QueryString: period
$qs= "from_date=2016-03-18&from_time=00:00:00&to_date=2018-03-21";

// Query the TourCMS API
$result = $tourcms->list_payments($qs, $channel);

// Loop through each Tour and print out the Tour ID
foreach($result->payments->payment as $payment) {
	print 'Booking id: ' . $payment->booking_id .' - ';
	print 'Payment type: ' . $payment->payment_type .'
'; }
Booking id: 10 - Payment type: cash
Booking id: 11 - Booking type: card

C# examples use the .Net Client Library

Code sample here soon

VB examples use the .Net Client Library

Code sample here soon

NodeJS examples use the NodeJS Wrapper

Example


TourCMS.listPayments({
  channelId: 3,
  qs: {
    from_date: "2018-03-23",
    to_date: "2018-03-26"
  },
  callback: function(response, status) {
    if (response.total_payments == 0)
      console.log("No payments made");
    else{
      //Loop through each component and output its component key
      response.payments.payment.forEach(function(payment) {
        console.log("Booking " + payment.booking_id + ": " + payment.payment_value + "(" + payment.payment_currency + ")");
      });
    }
  }
});
						
Booking 19280: 45.34(GBP)
Booking 19284: 4.67(GBP)
Booking 19286: 4.67(GBP)
Booking 19288: 4.67(GBP)
Booking 19288: 41.89(GBP)
Booking 19290: 4.67(GBP)
Booking 19324: 16.63(GBP)
Booking 19327: 16.63(GBP)

Looking for sample code in a different language? TourCMS and community provided API libraries

Querystring parameters

Querystring parameters
XML NodeNotes
from_date
to_date
YYYY-MM-DD. Use these two dates to restrict results to just those payments created during a certain date period.
from_time
to_time
00:00:00. Use these two times to restrict results to just those payments created during a certain time period.
staff_user_paymentsUse to search for payments made by a specific staff member. Only works for operators.
per_pageNumber of results to return per page. Default is 1000. Max is 1000.
pageInteger for which page number to return. Default is page 1.
no_limitSend 1 if not limit payments and returns all according to the queryString.

A Channel ID can also be passed in the request header, if using an API wrapper the Channel ID is passed as the second parameter

Response fields

Response fields
XML NodeNotes
request Confirmation of the request that you sent
error Any error message returned, if there is no error this will just contain the text OK
total_payments Number of payments made according to the request
payments

Array of payments

XML NodeNotes
payment

There will be one payment node for each payment returned

Each payment node contains the following child nodes.

XML NodeNotes
payment_idPayment ID
booking_idBooking ID
booking_statusBooking status (quotation, provisional, confirmed, archived)
booking_nameName of the booking
account_idAccount ID
channel_idChannel ID
staff_usernameStaff userame who made the booking
payment_date_timeDate when the payment was made (YYYY-MM-DD 00:00:00)
payment_valueValue of the payment
refunded_valueReturns refunded value in that case or 0 otherwise
payment_currencyCurrency of the payment
payment_typeType of the payment (card, cash, refund...)
payment_referenceReference of the payment. Can be empty if not apply
payment_noteNote added when payment was made
paid_byPayment made by: C, customer; A, agent
paid_by_idCustomer ID or Agent ID according to who made the payment (paid_by)
payment_transaction_referencePayment transaction reference
gateway_modeGateway mode

More information