Integrating with Windcave on your website

Integrating with Windcave on your website

Purpose

This article explains how to integrate Windcave into your online booking module, allowing you to either take payment at the time of booking or merely register the customer’s card for future charges. We offer an integration method that doesn't require you to integrate directly with Windcave, allowing you to manage the booking and payment process all within the RCM API. 

Integration Process

1. Create the transaction

After you've made a successful RCM booking via the API, invoke the RCM "createdpspayment" method with the following parameters:

Parameter
Value
reservationref
Booking reference code returned from the "booking" method.
transactiontype
The type of transaction to create: "purchase" for a payment, "validate" to register/save the card for future transactions.
amount
The payment amount or "0" for a validate transaction.
returnurl
The URL on your website that Windcave will redirect to after the transaction is completed.

The API will return a "RedirectUrl" property that you will embed in an iframe to display the Windcave card entry form. 

JavaScript example:
  1. var jsonStr = JSON.stringify({
  2.   "method" : "createdpspayment",
  3.   "reservationref" : "<yourBookingRef>",        // from your booking API call
  4.   "transactiontype" : "validate",                        // or "purchase" for payment
  5.   "amount" : 0,                                                   // 0 for validate transactions; total due for payments
  6.   "returnurl" : "<yourReturnUrl>"                    // a page on your website that will handle the redirect from Windcave after the transaction is complete
  7. });
  8. ajaxCall(jsonStr, function(apiResult) {
  9.   if (apiResult.status === 'OK') {
  10.     var redirectUrl = apiResult.results.RedirectUrl;
  11.     // …load iframe (see step 2)…
  12.   }
  13. });

2. Embed the Windcave card entry form

Embed the redirect URL in an iframe on your confirmation or checkout page:

  1. <iframe id="paymentIFrame" src="about:blank" style="width:100%;height:600px;"></iframe>

  2. <script>
  3.   // once you have redirectUrl from step 1:
  4.   document.getElementById('paymentIFrame').src = redirectUrl;
  5. </script>
This displays Windcave’s secure card entry form within your site’s page.

3. Handle the redirect from Windcave

Windcave will redirect to the return URL provided in the "createdpspayment" call.

On your return URL page, retrieve the "result" query parameter and include it in your "getdpspayment" API call:

Parameter
Value
reservationref
The booking reference code returned from the booking method call.
result
The Windcave result from the redirect query parameter.

The response will include the transaction details to include in your call to "confirmpayment" or "rebillingtoken". 

JavaScript Example:
  1. // Get result query parameter from the URL
  2. var result = new URLSearchParams(window.location.search).get('result');

  3. var jsonStr = JSON.stringify({
  4.   "method" : "getdpspayment",
  5.   "reservationref" : "<yourBookingRef>",        // from your booking API call
  6.   "result": result                                                 // the result from the URL
  7. });
  8. ajaxCall(jsonStr, function(apiResult) {
  9.   if (apiResult.status === 'OK') {    
  10.     // …call confirmpayment or rebillingtoken method (see step 4)…
  11.   }
  12. });

4. Save the transaction details in RCM

Once you have the transaction details from the previous step, you can save the transaction against the booking in RCM using the "confirmpayment" method for purchases or the "rebillingtoken" method for validate transactions.

confirmpayment - For purchases

Use the transaction details from the previous step to call the "confirmpayment" API method:

Parameter Value
reservationref Booking reference code returned from booking method.
amount Payment amount.
success Indicate if payment was successful.
paytype Payment type, like Visa or Mastercard.
paydate Payment date.
supplierid Please email support@rentalcarmanager.com to confirm what your supplierid is.
transactid The RebillingToken value returned by the getdpspayment method. 
dpstxnref The TransactionId value returned by the getdpspayment method. 
cardholder The cardholder’s name returned by the getdpspayment method.
paysource Optional Payment Source. E.g. "Payment from website.com."
cardnumber The masked card number returned by the getdpspayment method.
cardexpiry The card expiry returned by getdpspayment in the format of “MM/YY”.
transtype The transaction type, in this case “Payment”.
merchfeeid Optional Merchant Fee ID corresponding to a Merchant Fee ID setup within the system.
payscenario Payment scenario when calling this method, possible values are: 1= at time of original booking (default), 2=convertquote, 3=prehire e.g. editbooking.
emailoption Email option, 0=never send email, 1=default behaviour, 2=always send email.

Example request body:
{
    "method": "confirmpayment",
    "reservationref": "43F355C1223",
    "amount": 500,  
    "success": true,
    "paytype": "Visa",
    "paydate": "01/01/2026",
    "supplierid": 0,
    "transactid": "0000030003321649",
    "dpstxnref": "00000003021b18ac",
    "cardnumber": "9969",
    "cardexpiry": "01/25",
    "cardholder": "John Doe",
    "transtype": "Payment"
}

rebillingtoken - For validate transactions

Use the transaction details from the previous step to call the "rebillingtoken" API method:

Parameter Value
reservationref Booking reference code returned from booking method
paytype Payment type, like Visa or Mastercard
supplierid Please email support@rentalcarmanager.com to confirm what your supplierid is.
paysource Optional payment source. E.g. "Payment from website.com."
rebillingtoken The RebillingToken returned by the getdpspayment method
cardnumber The masked card number returned by the getdpspayment method
cardexpiry The card expiry returned by getdpspayment in the format of “MM/YY”.
cardholder The cardholder’s name returned by the getdpspayment method.

Example request body:
{
    "method": "rebillingtoken",
    "reservationref": "43F355C1223",    
    "paytype": "Credit Card",    
    "supplierid": 0,
    "paysource": "Website",
    "rebillingtoken": "0000030003321649",    
    "cardnumber": "9969",
    "cardexpiry": "01/25",
    "cardholder": "John Doe"    
}

Including a merchant fee/card surcharge

For payments where you are including a merchant fee, the RCM Merchant Fee ID must be passed in with the request to the "confirmpayment" method, using parameter name "merchfeeid".  The "amount" parameter should be inclusive of the merchant fee value.  Failure to do this will result in an incorrect balance on bookings as the merchant fee won't be listed.

Find Default Merchant Fee

To check the API for a default fee, use the method "tender_types", and look for a tender type with "isonlinepaymentdefault" = true.  With this record, you should extract the "extrafee_id" (use to pass in to the API with the payment info) and "extrafee_fee" (percentage value) (use to calculate the amount of the merchant fee).  There is also a tax flag which might be relevant to calculations.
  1. function SetMerchantFee() {
  2. var jsonStr = JSON.stringify({
  3. "method": "tender_types"
  4. });
  5. ajaxCall(jsonStr, function (apiresult) {
  6. if (apiresult.status === 'OK') {
  7. rcmTenderTypes = apiresult.results;
  8. $.each(rcmTenderTypes, function (index, tender) {
  9. if (tender.isonlinepaymentdefault === true) {
  10. if (tender.extrafee_id > 0) {
  11. rcmMerchantFeeId = tender.extrafee_id;
  12. rcmMerchantFeePercentage = tender.extrafee_fee;
  13. rcmMerchantFeeApplyTax = tender.extrafee_applytax;
  14. }
  15. return false; // break $.each once found
  16. }
  17. });
  18. } else {
  19. console.log(apiresult.error);
  20. }
  21. });
  22. }

Calculate Merchant Fee Amount

The calculated amount needs to allow for any non-inclusive taxes if necessary.  See below for an example:
  1. function CalculateMerchantFee(baseAmount) {
  2. if (rcmMerchantFeeId > 0 && rcmMerchantFeePercentage !== 0) {
  3. var fee = baseAmount * rcmMerchantFeePercentage / 100.00;
  4. if (rcmMerchantFeeApplyTax && rcmTaxInclusive === false && rcmTaxRate > 0) {
  5. fee += rcmTaxRate * fee;
  6. }
  7. return fee;
  8. }
  9. return 0;
  10. }
Make sure that the "amount" always includes the merchant fee amount.
E.g. if base amount is $100 with a 2% merchant fee, then the customer pays $102 and you should pass in "amount" = 102. 

    Important Articles


      • Related Articles

      • Integrating with Stripe on your website

        Purpose This article will outline what is needed to replace your existing Vault integration with a Stripe integration. You will have the choice of either taking a payment at the time of booking or saving card details to be charged in the future (like ...
      • Integrating with Paystack on your website

        Purpose This article will outline what is needed to replace your existing Vault integration with a Paystack integration. You will have the choice of either taking a payment at the time of booking or saving card details to be charged in the future ...
      • Integrating with VostroPay on your website

        Purpose This article will outline what is needed to replace your existing Vault integration with a VostroPay (Till Payments) integration. You will have the choice of either taking a payment at the time of booking or saving card details to be charged ...
      • API V3.2 Booking Process

        Overview The RCM API and Agent API allow you to make unallocated bookings for a specified vehicle category, for a specified pickup and drop off date. An unallocated booking is a booking that has been made for a particular category (e.g. small car), ...
      • Getting Started with API V3.2

        Overview Rental Car Manager (RCM) provides a Web API through which you are able to use to build a set of booking steps which you can plug into your website. This API also allows for Agents to have access and search for availability of vehicles and to ...