Derivative Pricing Plans

In this section we will see how to push and pull the offers of your properties.

Get the offers

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

To get the offers, use the following function:

GetOffers(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 GetOffers(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, "GetOffers", 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.GetOffers', $args);
$result = $server->send($message);
$struct = $result->value();
?>

This function returns the list of all the active offers for the current property. The offers are represented by a <tag>value</tag> structure. This is an example:


<offers>
	<offer>
		<id>23790</id>
		<label>10% off - Low Season</label>
		<unitID>1</unitID>
		<discount>10</discount>
		<start>2019-02-01</start>
		<end>2019-04-01</end>
		<minimumStay>1</minimumStay>
		<maximumStay>30</maximumStay>
		<sellLimit>5</sellLimit>
		<condCancel>2398</condCancel>
		<condPay>238</condPay>
	</offer>
</offers>

Create new offers

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

To create new rates, use the following function:

CreateOffers(user, password, token, propertyID, offers)

The parameter rates must be a string encoded in a precise format (in the next paragraph you will see how). Here are examples of how your code should be:


/** java /*	
public String CreateOffers(String username, String password, String token, Int propertyID, String offers) throws Exception {
  Vector params = new Vector();
  params.addElement(username);
  params.addElement(password);
  params.addElement(token);
  params.addElement(propertyID);
  params.addElement(offers);
  Object[] objects = (Object[]) xmlRpcClient.execute(config, "CreateOffers", 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($offers, 'string')
);
$message = new xmlrpcmsg('xrws.CreateOffers', $args);
$result = $server->send($message);
$struct = $result->value();
?>

How to correctly encode the offers

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

  • label is the name of the current offer
  • unitID is the unit identifier (to which the rates refer)
  • discount is the discount percentage
  • start is the starting date of the current offer
  • end is the ending date of the current offer
  • minimumStay is the minimum number of nights bookable with this offer
  • maximumStay is the maximum number of nights bookable with this offer
  • sellLimit is the sell limit referring to the number of units
  • condCancel is the cancellation condition identifier
  • condPay is the payment condition identifier

Your offers string must look like this:


[offers]
	[offer]
		[label]10% off - Low Season[/label]
		[unitID]1[/unitID]
		[discount]10[/discount]
		[start]2019-02-01[/start]
		[end]2019-04-01[/end]
		[minimumStay]1[/minimumStay]
		[maximumStay]30[/maximumStay]
		[sellLimit]5[/sellLimit]
		[condCancel]2398[/condCancel]
		[condPay]238[/condPay]
	[/offer]
[/offers]

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

Update offers

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

To update rates, use the following function:

UpdateOffers(user, password, token, propertyID, offers)

Here is an example of how your code should be:


/** java /*	
public String UpdateOffers(String username, String password, String token, Int propertyID, String offers) throws Exception {
  Vector params = new Vector();
  params.addElement(username);
  params.addElement(password);
  params.addElement(token);
  params.addElement(propertyID);
  params.addElement(offers);
  Object[] objects = (Object[]) xmlRpcClient.execute(config, "UpdateOffers", 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($offers, 'string')
);
$message = new xmlrpcmsg('xrws.UpdateOffers', $args);
$result = $server->send($message);
$struct = $result->value();
?>

How to correctly encode the offers

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

  • id is the offer identifier
The other parameters are the same as for the CreateOffer function.

Your offers string must look like this:


[offer]
	[id]23790[/id]
	...
[/offer]

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