Payment conditions

In this section we will see how to manage data about the payment conditions of your properties.

Understanding the conditions

In the BookingBnb system, Payment conditions are not linked to Cancellation conditions and don't have any limits. This means that you are free to create your own conditions and apply them to each unit, during your preferred periods.

The following table shows you some examples to better understand how to create your custom conditions.

Condition description Restrictions String
Guests pay 100% by credit card or online tp,%100
Guests pay 50% by credit card or online and 50% in cash tp,%50;ca,%50
Guests pay 75% by credit card or online and 25% in cash tp,%75;ca,%25
Guests pay 100% in cash ca,%100

Get the conditions

URL: https://api.bookingbnb.com/xrws/GetPaymentConditions/

To get the cancellation conditions, use the following function:

GetPaymentConditions(user, password, token, propertyID)

The arguments user and password are the credentials that a partner uses to enter the BookingBnb Control Panel. The argument token is the one our partners acquire when they register to our system. The argument propertyID is the identification number of the current property. To retrieve this ID, use the BookingBnb function GetProperties.

Here is an example of how your code should be:


/** java /*	
public String GetPaymentConditions(String username, String password, String token, Int propertyID) throws Exception {
  Vector params = new Vector();
  params.addElement(username);
  params.addElement(password);
  params.addElement(token);
  params.addElement(propertyID);
  Object[] objects = (Object[]) xmlRpcClient.execute(config, "GetPaymentConditions", params);
  return (String) objects[1];
}

/* php */
<?php
include("xmlrpc.inc");
$server = new xmlrpc_client($url);
$args = array(
	new xmlrpcval($user, 'string'), 
	new xmlrpcval($pass, 'string'), 
	new xmlrpcval($token, 'string'), 
	new xmlrpcval($propertyID, 'int')
);
$message = new xmlrpcmsg('xrws.GetPaymentConditions', $args);
$result = $server->send($message);
$struct = $result->value();
?>

This function returns the list of conditions identified by a ID. The conditions are represented by a <tag>value</tag> structure. This is an example:


<condPay>
  	<id>342</id>
  	<propertyID>23712</propertyID>
  	<label>75 card - 25 cash</label>
  	<restrictions>tp,%75;ca,%25</restrictions>
  </condPay>

Create new conditions

URL: https://api.bookingbnb.com/xrws/CreatePaymentConditions/

To create new conditions, use the following function:

CreatePaymentConditions(user, password, token, propertyID, conditions)

Here is an example of how your code should be:


/** java /*	
public String CreatePaymentConditions(String username, String password, String token, Int propertyID, String conditions) throws Exception {
  Vector params = new Vector();
  params.addElement(username);
  params.addElement(password);
  params.addElement(token);
  params.addElement(propertyID);
  params.addElement(conditions);
  Object[] objects = (Object[]) xmlRpcClient.execute(config, "CreatePaymentConditions", params);
  return (String) objects[1];
}

/* php */
<?php
include("xmlrpc.inc");
$server = new xmlrpc_client($url);
$args = array(
	new xmlrpcval($user, 'string'), 
	new xmlrpcval($pass, 'string'), 
	new xmlrpcval($token, 'string'), 
	new xmlrpcval($propertyID, 'int'),
	new xmlrpcval($conditions, 'string')
);
$message = new xmlrpcmsg('xrws.CreatePaymentConditions', $args);
$result = $server->send($message);
$struct = $result->value();
?>

How to correctly encode the conditions

Given a multi-dimensional array of conditions, that your system will produce, you must include the following parameters:

  • label is the name of the current cancellation condition
  • restrictions is the set of restrictions of the current cancellation condition


  $conditions[0][label]="50 card - 50 cash";
  $conditions[0][restrictions]="tp,%50;ca,%50";
  $conditions[1][label]="75 card - 25 cash";
  $conditions[1][restrictions]="tp,%75;ca,%25";
  $conditions[2][label]="Cash Only";
  $conditions[2][restrictions]="ca,%100";
  $conditions[3][label]="Card Only";
  $conditions[3][restrictions]="tp,%100";

Your conditions string must look like this:


[condPay]
	[label]50 card - 50 cash[/label]
	[restrictions]tp,%50;ca,%50[/restrictions]
[/condPay]
[condPay]
	[label]75 card - 25 cash[/label]
	[restrictions]tp,%75;ca,%25[/restrictions]
[/condPay]
[condPay]
	[label]Cash Only[/label]
	[restrictions]ca,%100[/restrictions]
[/condPay]
[condPay]
	[label]Card Only[/label]
	[restrictions]tp,%100[/restrictions]
[/condPay]

The function returns a status code, it can be ok or ko.

Update conditions

URL: https://api.bookingbnb.com/xrws/UpdatePaymentConditions/

To update conditions, use the following function:

UpdatePaymentConditions(user, password, token, propertyID, conditions)

Here is an example of how your code should be:


/** java /*	
public String UpdatePaymentConditions(String username, String password, String token, Int propertyID, String conditions) throws Exception {
  Vector params = new Vector();
  params.addElement(username);
  params.addElement(password);
  params.addElement(token);
  params.addElement(propertyID);
  params.addElement(conditions);
  Object[] objects = (Object[]) xmlRpcClient.execute(config, "UpdatePaymentConditions", params);
  return (String) objects[1];
}

/* php */
<?php
include("xmlrpc.inc");
$server = new xmlrpc_client($url);
$args = array(
	new xmlrpcval($user, 'string'), 
	new xmlrpcval($pass, 'string'), 
	new xmlrpcval($token, 'string'), 
	new xmlrpcval($propertyID, 'int'),
	new xmlrpcval($conditions, 'string')
);
$message = new xmlrpcmsg('xrws.UpdatePaymentConditions', $args);
$result = $server->send($message);
$struct = $result->value();
?>

How to correctly encode the conditions

Given a multi-dimensional array of conditions that your system can produce, you must include the following parameters:

  • id is the identifier of the current condition
  • newLabel is the new label of the current condition
  • newRestrictions is the new set of restrictions for the current condition

Here is an example of array in php:


  $conditions[0][id]=342;
  $conditions[0][newLabel]="70 card - 30 cash";
  $conditions[0][newRestrictions]="tp,%70;ca,%30";
  $conditions[1][id]=343;
  $conditions[1][newLabel]="75 card - 25 cash";
  $conditions[1][newRestrictions]="tp,%75;ca,%25";

Your conditions string must look like this:


[condCancel]
	[id]128[/id]
  	[newLabel]70 card - 30 cash[/newLabel]
  	[newRestrictions]tp,%70;ca,%30[/newRestrictions]
[/condCancel]
[condCancel]
	[id]129[/id]
  	[newLabel]75 card - 25 cash[/newLabel]
  	[newRestrictions]tp,%75;ca,%25[/newRestrictions]
[/condCancel]

The function returns a status code, it can be ok or ko.