Account Information API

The Account Information API includes details about each of your customers. Your template site will use this information as part of the single-sign-on (SSO) protocol to verify the user’s account. It will be used for purchases, loyalty redemption, and more.

This API can also be used by an Expedia agent to verify the traveler’s unique identifier (for example, credit card number) as part of the request to get the user account details. The details received will be used to validate the traveler on the phone before proceeding with shopping and booking for the traveler.

See the Common data and responses page for additional information.

Credit card encryption and decryption

Expedia uses an industry-standard JWE (JSON web encryption) technique for encrypting and decrypting credit card details: asymmetric encryption using a public and private key pair.

Encryption use cases

The places where encryption should take place include:

  • Request: cardNumber
  • Response: cardDetails

In the request parameter, you should set up a 2048-bit CA (certificate authority)-signed RSA (Rivest Shamir Adleman) private key certificate and share it with Expedia. We’ll then use your public key to encrypt the cardNumber field using JWE and RSA.

In the response parameter, we’ll set up a 2048-bit CA-signed RSA private key and will share the corresponding public key certificate and share it with you. Using the Expedia public key, you’ll then encrypt each element of cardDetails using JWE and RSA.

We’ve laid out the steps to the encryption process below.

Encryption, step-by-step

Step 1: Fetch the public certificate and get the RSA 2048 public key.

  1. Generate a random symmetric key (RSK) of 256 bits length.
  2. Encrypt the RSK using the RSA 2048 public key using the algorithm RSA-OAEP-256.

Step 2: Generate a random initialization vector (IV) of 96 bits length.

Step 3: Encrypt plaintext data by using the RSK, IV, and the algorithm A256GCM to form the ciphertext and authentication tag data.

Step 4: Base64URL-encode the ciphertext to produce Base64URL (JWE ciphertext).

Step 5: Base64URL-encode the authentication tag, IV, RSK, and the JWE header JSON to produce:

  • Authentication tag data: Base64URL (JWE authentication tag).
  • IV: Base64URL (JWE initialization vector)
  • RSK: Base64URL (JWE encrypted key)
  • JWE header JSON: Base64URL (UTF8 (JWE header))

Then serialize the JWE object to its compact format consisting of Base64URL-encoded parts delimited by periods ('.') to produce:

Base64URL (UTF8) (JWE header) || '.' || Base64URL (JWE encrypted key) || '.' || Base64URL (JWE initialization vector) || '.' || Base64URL (JWE ciphertext) || '.' || Base64URL (JWE authentication tag)

Code samples

Sample Java for encryption

JWE encryption can be implemented efficiently and quickly the with help of third party JWE libraries. For example, this java code for encryption was created with the help of Nimbus JOSE+JWT library.

public String encryptWithJWE(String plainText){
    X509Certificate publicCertificate = <fetch public cert>
    //get RSA public key
    final X509EncodedKeySpec publicKeySpec = new 
    X509EncodedKeySpec(publicCertificate.getPublicKey().getEncoded());
    final KeyFactory keyFactory = KeyFactory.getInstance("RSA");
    RSAPublicKey rsaPublicKey = (RSAPublicKey) keyFactory.generatePublic(publicKeySpec);
    //get keyID
    String keyID = certificateManager.getKid(publicCertificate);
    // Create JWE Header containing the needed metadata for encryption and decryption
    JWEHeader jweHeader = new JWEHeader.Builder(JWEAlgorithm.RSA_OAEP_256, EncryptionMethod.A256GCM)
        .type(JOSEObjectType.JWT)
        .customParam(IAT, System.currentTimeMillis())
        .keyID(keyID)
        .build();
/*

Sample JWE header

{
"alg":"RSA-OAEP-256",
"typ":"JWT",
"enc":"A256GCM",
"iat":<Time (in UTC) when JWE was issued, expressed in UNIX epoch time (seconds since 1 January, 1970)>,
"kid":<Key ID or subject key Identifier from the public key certificate>
}
*/
    JWEObject jweObject = new JWEObject(jweHeader, new Payload(plainText));
    RSAEncrypter encrypter = new RSAEncrypter(rsaPublicKey);
    jweObject.encrypt(encrypter);
    return jweObject.serialize();
    }

Decryption of card number in request

Expedia will encrypt cardNumber in the request. The decryption path is the reverse of the encryption path:

  1. When you receive the encrypted JWE, you should decode the first section of the JWE, the JOSE header to determine the algorithm, the encryption, and the keyId (alg, enc, kid).
  2. You’ll then validate the iat (issued-at: the time the JWT was issued) to make sure it’s no more than 5 minutes different from the current time. (The token will expire after 5 minutes.)
  3. Next, fetch your private key and decrypt the JWE encryption key.
  4. Then, using the decrypted RSK, the JWE initialization vector, and the JWE authentication tag, you can decrypt the JWE ciphertext parameter and verify it.

Code sample

Sample Java for encryption

JWE encryption can be implemented efficiently and quickly the with help of third party JWE libraries. For example, this java code for encryption was created with the help of Nimbus JOSE+JWT library.

public String decryptJWE(String jweString) {
    PrivateKey privateKey = <fetch private key>;
    RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) privateKey;
    JWEObject jweObject = JWEObject.parse(jweString);
    JWEHeader jweHeader = jweObject.getHeader();validateJweHeader(jweHeader);
    RSADecrypter rsaDecrypter = new RSADecrypter(rsaPrivateKey);
    jweObject.decrypt(rsaDecrypter);
    return jweObject.getPayload().toString();
}

Get account information

You’ll use this set of fields to fetch account info for a loyalty member or card holder using POST /user/v1/account.

Header

FieldDescriptionSample valueField typeMandatory?
partnerIdUnique identifier for your business, provided by ExpediaYOUR BRANDString, max 20 charactersYes
AuthorizationAccess token received by Expedia from your authorization server, to be validated by your teamStandard JSON web token (JWT)String, standard JWT lengthNo
Authorization2JSON web token (JWT) sent by Expedia; signature and claims to be validated on your endStandard JWTString, standard JWT lengthNo

Request

FieldDescriptionField typeMandatory?
requestIdUnique identifier for the transaction requestStringYes
membershipIdUnique customer identifierStringNo
loyaltyAccountNumberThe customer’s loyalty account number (also called programAccountNumber); this should only be populated if an identifier other than membershipId is required for loyalty operationsStringNo
programIdIdentifier for the loyalty program the customer is affiliated to or the tier name associated with the loyalty programStringNo
cardNumberCustomer credit card number (encrypted)StringNo
emailCustomer email addressStringNo

Response

FieldDescriptionField typeMandatory?
statusTransaction status (values: Approved, Declined)StringYes
requestIdUnique identifier for the transaction request (from request payload)StringYes
ProgramAccountProgram account details; see ProgramAccount table for nested fields  
languageIdThe languages in which the site will be viewableStringNo
channelTypePlatforms the site is optimized for (values: WEB, MOBILE, TABLET) No

ProgramAccount

FieldDescriptionSample valueMandatory?
programIdIdentifier for the loyalty program the customer is affiliated to or the tier name associated with the loyalty programAventura GoldYes
accountNameProgram name (if different from programId)AventuraNo
loyaltyAccountNumberThe customer’s loyalty account number (also called programAccountNumber); this should only be populated if an identifier other than membershipId is required for loyalty operations1234567No
lastFourDigitsOfCreditCardThe last 4 digits of the credit card the customer used for the booking0000No
loyaltyConversionRatioRatio of how payment converts to points earned (for example, $1 = 1 point) No
loyaltyAccountBalanceCurrent balance of customer’s earned loyalty points2003Yes

User information

FieldDescriptionSample valueMandatory?
userIdUnique identifier for customer; same as membershipId Yes
nameCustomer first, middle, and last name  
firstNameCustomer’s first name; nested under nameBobYes
middleNameCustomer’s middle name; nested under nameRobertNo
lastNameCustomer’s last name; nested under nameJonesYes
contactInfoCustomer contact information, including address, email and phone number No
addressCustomer address, including street address, city, state or province, and postal code; nested under contactInfo  
streetAddressCustomer street address; nested under address123 Main St.No
cityCity of customer’s street address; nested under addressBostonNo
stateState of customer’s street address; nested under addressMANo
countryCountry of customer’s street address; nested under addressUSANo
postalCodePostal code of customer’s street address; nested under address02112No
taxProvinceThe state or province in which the customer will be paying taxes; nested under addressMANo
emailCustomer’s email address; nested under contactInfobrjones@somewhere.comNo
contactNumberCustomer’s phone number; nested under contactInfo555-555-5555No
userTypeWhether the customer is a single (primary) user or associated with an organization No
dateOfBirthCustomer’s date of birth No
cardDetailsDetails about the credit card used in the transaction; if populated, some nested items must be encrypted No
cardNumber *Credit card number used in transaction (encrypted); nested under cardDetails Yes
cardTypeType of card used (encrypted); nested under cardDetails Yes
expirationDate *Expiration date of card in MM/YYYY format (encrypted); nested under cardDetails Yes
billingAddressBilling address of the card used in the transaction; nested under cardDetails  
firstAddressLine *First line of billing address (encrypted); nested under billingAddress Yes
secondAddressLineSecond line of billing address; nested under billingAddress No
thirdAddressLineThird line of billing address; nested under billingAddress No
cityCity element of billing address; nested under billingAddress No
provinceProvince or state element of billing address; nested under billingAddress No
countryCodeCountry element of billing address; nested under billingAddress No
postalCode *Postal code element of billing address (encrypted); nested under billingAddress Yes

Note: If any of the cardDetails fields are populated, those marked with a * are mandatory. All of the data in these fields are encrypted.

API details

Without credit card information

With credit card information

Did you find this page helpful?
How can we improve this content?
Thank you for helping us improve!