home > support > API > List Payments
List of payments
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.
Endpoint | /c/booking/payment/list |
Formats | XML |
Example | /c/booking/payment/list.xml |
Verb | GET |
PHP examples use the PHP Client Library with SimpleXML
object list_payments ( [ string $queryString = "" [, int $channel = 0 ]] )
// 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
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
Enter your TourCMS API credentials below to call the List Payments endpoint.
XML Node | Notes |
---|---|
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_payments | Use to search for payments made by a specific staff member. Only works for operators. |
per_page | Number of results to return per page. Default is 1000. Max is 1000. |
page | Integer for which page number to return. Default is page 1. |
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
XML Node | Notes | ||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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
|
||||||||||||||||||||||||||||||||||||||||||