PSD2 European Compliance
Use the SDK to ease compliance with PSD2 EEA regulations.
The Payment Services Directive 2 (PSD2) is an EEA regulation that requires changes to the check-out and booking process for all transactions involving a credit card issued by an EEA state. For more information on PSD2 please see here.
1. Shop
Get availability
List<Property> propertyList = rapidClient.getAvailability(
"YYYY-MM-DD",
"YYYY-MM-DD",
"USD",
"LANGUAGE",
"US",
List.of("OCCUPANCY"),
List.of("PROPERTY ID"),
BigDecimal.ONE,
"SALES-CHANNEL",
"SALES-ENV",
"CUSTOMER-IP"
);
Check room prices
Property property = propertyList.get(0);
if (property instanceof PropertyAvailability) {
PropertyAvailability propertyAvailability = (PropertyAvailability) property;
RoomPriceCheck roomPriceCheck = rapidClient.priceCheck(
"PROPERTY ID",
propertyAvailability.getRooms().get(0).getId(),
propertyAvailability.getRooms().get(0).getRates().get(0).getId(),
getPriceCheckToken(propertyAvailability)
);
}
2. Book
Create payment session
PaymentSessions paymentSessions = rapidClient.postPaymentSessions(
"CUSTOMER IP",
getPaymentSessionToken(roomPriceCheck),
createPaymentSessionRequest()
);
Pass the JavaScript challenge
If 2FA is required, the response will include an encodedChallengeConfig
. The encodedChallengeConfig
and paymentSessionId
returned will need to be passed as parameters into the JavaScript challenge method.
Create itinerary
ItineraryCreation itineraryCreation = rapidClient.postItinerary(
"CUSTOMER IP",
getPostItineraryToken(roomPriceCheck),
createItineraryRequest(true)
);
Complete payment session
CompletePaymentSession completePaymentSession = rapidClient.putCompletePaymentSession(
"CUSTOMER IP",
itineraryCreation.getItineraryId(),
getCompletePaymentSessionToken(itineraryCreation)
);
Resume on-hold booking
rapidClient.putResumeBooking(
"CUSTOMER IP",
completePaymentSession.getItineraryId(),
getResumeBookingToken(itineraryCreation)
);