Usage examples
Examples to use with the Fraud Prevention SDK for Java to implement common workflows
Expand All
|
Collapse All
OrderPurchaseScreen
Request object
{
"transaction": {
"site_info": {
"country_code": "USA",
"agent_assisted": false
},
"device_details": {
"device_box": "TrustWidget",
"ip_address": "1.1.1.1",
"source": null
},
"customer_account": {
"account_type": "STANDARD",
"name": {
"last_name": "Smith",
"first_name": "John",
"middle_name": null,
"title": null,
"suffix": null
},
"email_address": "test@example.com",
"user_id": null,
"telephones": null,
"address": null,
"registered_time": null
},
"transaction_details": {
"order_id": "33322220004",
"current_order_status": "IN_PROGRESS",
"order_type": "CREATE",
"travel_products": [
{
"type": "CAR",
"price": {
"value": 100.0,
"currency_code": "USD"
},
"inventory_type": "Agency",
"inventory_source": "AGENCY",
"travelers_references": [
"Reference"
],
"pick_up_location": "pick up location",
"drop_off_location": "drop off location",
"pickup_time": "2023-01-18T08:00:00-07:00",
"return_time": "2023-01-08T07:30:00-07:00"
}
],
"travelers": [
{
"traveler_name": {
"last_name": "Brown",
"first_name": "Sally",
"middle_name": null,
"title": null,
"suffix": null
},
"primary": true,
"email_address": "imsafe@example.com",
"telephones": [
{
"country_access_code": "1",
"area_code": "962",
"phone_number": "1234567",
"type": "HOME",
"platform_type": null,
"extension_number": null,
"preference_rank": null,
"last_verified_date_time": null,
"verified_flag": null
}
],
"age": null,
"birth_date": "1970-04-08T08:00:00-07:00",
"citizenship_country_code": null,
"traveler_id": null
}
],
"payments": [
{
"method": "CREDIT_CARD",
"brand": "VISA",
"billing_name": {
"last_name": "Brown",
"first_name": "Sally",
"middle_name": null,
"title": null,
"suffix": null
},
"billing_address": {
"address_line1": "address",
"city": "city",
"zip_code": "11183",
"country_code": "USA",
"address_type": null,
"address_line2": null,
"state": null
},
"billing_email_address": "sally@example.com",
"card_type": "MASTER_CARD",
"card_number": "4111111111111111",
"expiry_date": "2027-04-08T08:00:00-07:00",
"telephones": [
{
"country_access_code": "1",
"area_code": "962",
"phone_number": "1234567",
"type": "HOME",
"platform_type": null,
"extension_number": null,
"preference_rank": null,
"last_verified_date_time": null,
"verified_flag": null
}
],
"reason": null,
"authorized_amount": {
"value": 100.0,
"currency_code": "USD"
},
"verified_amount": {
"value": 123.0,
"currency_code": "USD"
},
"three_digits_secure_criteria": null,
"operations": null,
"electronic_commerce_indicator": null,
"virtual_credit_card_flag": null,
"wallet_type": null,
"card_avs_response": "Z",
"card_cvv_response": "0",
"merchant_order_code": null,
"card_authentication_failure_count": null
}
]
}
}
}
SDK example
SiteInfo siteInfo =
SiteInfo.builder()
.countryCode("USA")
.agentAssisted(false)
.build();
DeviceDetails deviceDetails =
DeviceDetails.builder()
.deviceBox("TrustWidget")
.ipAddress("1.1.1.1")
.build();
CustomerAccount customerAccount =
CustomerAccount.builder()
.accountType(CustomerAccount.AccountType.STANDARD)
.name(
Name.builder()
.firstName("John")
.lastName("Smith")
.build()
).emailAddress("test@example.com")
.build();
List<Telephone> telephones =
List.of(
Telephone.builder()
.type(TelephoneType.HOME)
.countryAccessCode("1")
.areaCode("962")
.phoneNumber("1234567")
.build()
);
OffsetDateTime birthDate =
OffsetDateTime.of(
LocalDate.of(1970, 4, 8),
LocalTime.of(8, 0),
ZoneOffset.of("-07:00")
);
List<Traveler> travelers =
List.of(
Traveler.builder()
.emailAddress("imsafe@example.com")
.primary(true)
.telephones(telephones)
.travelerName(
Name.builder()
.firstName("Sally")
.lastName("Brown")
.build()
).birthDate(birthDate)
.build()
);
Amount price =
Amount.builder()
.currencyCode("USD")
.value(100)
.build();
OffsetDateTime returnTime =
OffsetDateTime.of(
LocalDate.of(2023, 1, 8),
LocalTime.of(7, 30),
ZoneOffset.of("-07:00")
);
OffsetDateTime pickupTime =
OffsetDateTime.of(
LocalDate.of(2023, 1, 18),
LocalTime.of(8, 0),
ZoneOffset.of("-07:00")
);
List<TravelProduct> travelProducts =
List.of(
Car.builder()
.inventoryType("Agency")
.inventorySource(TravelProduct.InventorySource.AGENCY)
.travelersReferences(List.of("Reference"))
.price(price)
.pickUpLocation("pick up location")
.dropOffLocation("drop off location")
.returnTime(returnTime)
.pickupTime(pickupTime)
.build()
);
OffsetDateTime expiryDate =
OffsetDateTime.of(
LocalDate.of(2027, 4, 8),
LocalTime.of(8, 0),
ZoneOffset.of("-07:00")
);
List<CreditCard> payments =
List.of(
CreditCard.builder()
.billingName(
Name.builder()
.firstName("Sally")
.lastName("Brown")
.build()
).brand(Payment.Brand.VISA)
.authorizedAmount(
Amount.builder()
.value(100)
.currencyCode("USD")
.build()
).verifiedAmount(
Amount.builder()
.value(123)
.currencyCode("USD")
.build()
).cardAvsResponse("Z")
.cardCvvResponse("0")
.billingEmailAddress("sally@example.com")
.cardNumber("4111111111111111")
.telephones(telephones)
.cardType(CreditCard.CardType.MASTER_CARD)
.expiryDate(expiryDate)
.billingAddress(
PaymentBillingAddress.builder()
.zipCode("11183")
.addressLine1("address")
.city("city")
.countryCode("USA")
.build()
).build()
);
TransactionDetails transactionDetails =
TransactionDetails.builder()
.orderId("33322220004")
.currentOrderStatus(TransactionDetails.CurrentOrderStatus.IN_PROGRESS)
.orderType(TransactionDetails.OrderType.CREATE)
.travelers(travelers)
.travelProducts(travelProducts)
.payments(payments)
.build();
OrderPurchaseTransaction transaction =
OrderPurchaseTransaction.builder()
.siteInfo(siteInfo)
.deviceDetails(deviceDetails)
.customerAccount(customerAccount)
.transactionDetails(transactionDetails)
.build();
OrderPurchaseScreenRequest request =
OrderPurchaseScreenRequest.builder()
.transaction(transaction)
.build();
FraudPreventionV2Client client = FraudPreventionV2Client.builder().build();
OrderPurchaseScreenResponse response = client.screen(request);
OrderPurchaseUpdate: Order Update
Request object
{
"type": "ORDER_UPDATE",
"risk_id": "RISK_ID",
"order_status": "COMPLETED",
"acquirer_reference_number": null,
"cancellation_reason": {
"primary_reason_code": "PRIMARY REASON CODE",
"sub_reason_code": "SUB REASON CODE",
"primary_reason_description": "PRIMARY REASON DESCRIPTION",
"sub_reason_description": "SUB REASON DESCRIPTION"
}
}
SDK example
CancellationReason cancellationReason =
CancellationReason.builder()
.primaryReasonCode("PRIMARY REASON CODE")
.subReasonCode("SUB REASON CODE")
.primaryReasonDescription("PRIMARY REASON DESCRIPTION")
.subReasonDescription("SUB REASON DESCRIPTION")
.build();
OrderUpdate orderUpdate =
OrderUpdate.builder()
.riskId("RISK_ID")
.orderStatus(Status.COMPLETED)
.cancellationReason(cancellationReason)
.build();
FraudPreventionV2Client client = FraudPreventionV2Client.builder().build();
client.update(orderUpdate);
OrderPurchaseUpdate: Chargeback Feedback
Request object
{
"type": "CHARGEBACK_FEEDBACK",
"risk_id": "RISK_ID",
"chargeback_detail": {
"chargeback_status": "RECEIVED",
"chargeback_reason": "FRAUD",
"chargeback_amount": {
"value": 100.0,
"currency_code": "USD"
},
"bank_reason_code": "BANK_REASON_CODE",
"chargeback_reported_date_time": "2023-06-05T15:31:02.882011+03:00"
}
}
SDK example
ChargebackDetail chargebackDetail =
ChargebackDetail.builder()
.chargebackReason(ChargebackDetail.ChargebackReason.FRAUD)
.chargebackAmount(
Amount.builder()
.value(100)
.currencyCode("USD")
.build()
).bankReasonCode("BANK_REASON_CODE")
.chargebackReportedDateTime(OffsetDateTime.now())
.chargebackStatus(ChargebackDetail.ChargebackStatus.RECEIVED)
.build();
ChargebackFeedback chargebackFeedback =
ChargebackFeedback.builder()
.riskId("RISK_ID")
.chargebackDetail(chargebackDetail)
.build();
FraudPreventionV2Client client = FraudPreventionV2Client.builder().build();
client.update(chargebackFeedback);
OrderPurchaseUpdate: Insult Feedback
Request object
{
"type": "INSULT_FEEDBACK",
"risk_id": "RISK_ID",
"insult_detail": {
"insult_reported_date_time": "2023-06-05T15:31:03.361215+03:00"
}
}
SDK example
InsultDetail insultDetail =
InsultDetail.builder()
.insultReportedDateTime(OffsetDateTime.now())
.build();
InsultFeedback insultFeedback =
InsultFeedback.builder()
.riskId("RISK_ID")
.insultDetail(insultDetail)
.build();
FraudPreventionV2Client client = FraudPreventionV2Client.builder().build();
client.update(insultFeedback);
OrderPurchaseUpdate: Issued Refund Update
Request object
{
"refundStatus": "ISSUED",
"risk_id": "RISK_ID",
"refund_details": {
"refund_issued_date_time": "2023-06-05T15:31:03.957554+03:00",
"refund_issued_amount": {
"value": 100.0,
"currency_code": "USD"
}
},
"type": "REFUND_UPDATE",
"refund_status": "ISSUED"
}
SDK example
IssuedRefundUpdateDetails issuedRefundUpdateDetails =
IssuedRefundUpdateDetails.builder()
.refundIssuedDateTime(OffsetDateTime.now())
.refundIssuedAmount(
Amount.builder()
.value(100)
.currencyCode("USD")
.build()
).build();
IssuedRefundUpdate issuedRefundUpdate =
IssuedRefundUpdate.builder()
.riskId("RISK_ID")
.refundDetails(issuedRefundUpdateDetails)
.build();
FraudPreventionV2Client client = FraudPreventionV2Client.builder().build();
client.update(issuedRefundUpdate);
OrderPurchaseUpdate: Settled Refund Update
Request object
{
"refundStatus": "SETTLED",
"risk_id": "RISK_ID",
"refund_details": {
"refund_settlement_date_time": "2023-06-05T15:31:04.363157+03:00",
"refund_deposit_date_time": "2023-06-05T15:31:04.363193+03:00",
"acquirer_reference_number": "ACQUIRER_REF_NUMBER",
"settlement_id": "SETTLEMENT_ID",
"refund_settled_amount": {
"value": 100.0,
"currency_code": "USD"
}
},
"type": "REFUND_UPDATE",
"refund_status": "SETTLED"
}
SDK example
SettledRefundUpdateDetails settledRefundUpdateDetails =
SettledRefundUpdateDetails.builder()
.refundSettlementDateTime(OffsetDateTime.now())
.refundDepositDateTime(OffsetDateTime.now())
.acquirerReferenceNumber("ACQUIRER_REF_NUMBER")
.settlementId("SETTLEMENT_ID")
.refundSettledAmount(
Amount.builder()
.value(100)
.currencyCode("USD")
.build()
).build();
SettledRefundUpdate settledRefundUpdate =
SettledRefundUpdate.builder()
.riskId("RISK_ID")
.refundDetails(settledRefundUpdateDetails)
.build();
FraudPreventionV2Client client = FraudPreventionV2Client.builder().build();
client.update(settledRefundUpdate);
OrderPurchaseUpdate: Payment Update
Request object
{
"type": "PAYMENT_UPDATE",
"risk_id": "RISK_ID",
"merchant_order_code": "MERCHANT_ORDER_CODE"
}
SDK example
PaymentUpdate paymentUpdate =
PaymentUpdate.builder()
.riskId("RISK_ID")
.merchantOrderCode("MERCHANT_ORDER_CODE")
.build();
FraudPreventionV2Client client = FraudPreventionV2Client.builder().build();
client.update(paymentUpdate);
AccountTakeoverScreen
Request object
{
"transaction": {
"site_info": {
"locale": "en-US",
"name": "expedia.com",
"brand_name": "BRAND_NAME",
"placement_name": "LOGIN"
},
"device_details": {
"source": "SOURCE",
"device_box": "DEVICE_BOX",
"ip_address": "127.0.0.1",
"user_agent": "USER_AGENT",
"type": "WEBSITE"
},
"customer_account": {
"user_id": "USER_ID",
"account_type": "INDIVIDUAL",
"account_role": "USER",
"name": {
"last_name": "LAST_NAME",
"first_name": "FIRST_NAME",
"middle_name": "MIDDLE_NAME",
"title": "TITLE",
"suffix": "SUFFIX"
},
"username": "USERNAME",
"email_address": "user@example.com",
"telephones": [
{
"type": "HOME",
"platform_type": "MOBILE",
"country_access_code": "1",
"area_code": "123",
"phone_number": "123456",
"extension_number": "123",
"preference_rank": 0,
"last_verified_date_time": "1970-01-01T00:00:00+00:00",
"verified_flag": false
}
],
"address": {
"address_type": "HOME",
"address_line1": "ADDRESS_LINE1",
"address_line2": "ADDRESS_LINE2",
"city": "CITY",
"state": "AB",
"zip_code": "ZIP_CODE",
"country_code": "ABC"
},
"registered_time": "1970-01-01T00:00:00+00:00",
"active_flag": false,
"loyalty_member_id": "LOYALTY_MEMBER_ID"
},
"transaction_details": {
"type": "LOGIN",
"transaction_date_time": "1970-01-01T00:00:00+00:00",
"transaction_id": "TRANSACTION_ID",
"current_user_session": {
"session_id": "SESSION_ID",
"start_date_time": "1970-01-01T00:00:00+00:00",
"challenge_detail": {
"displayed_flag": false,
"type": "CAPTCHA",
"status": "SUCCESS"
}
},
"authentication_type": "CREDENTIALS",
"authentication_sub_type": "EMAIL",
"successful_login_flag": false,
"failed_login_reason": "INVALID_CREDENTIALS"
}
}
}
SDK example
AccountTakeoverSiteInfo siteInfo =
AccountTakeoverSiteInfo.builder()
.locale("en-US")
.name("expedia.com")
.brandName("BRAND_NAME")
.placementName(AccountTakeoverSiteInfo.PlacementName.LOGIN)
.build();
AccountTakeoverDeviceDetails deviceDetails =
AccountTakeoverDeviceDetails.builder()
.source("SOURCE")
.deviceBox("DEVICE_BOX")
.ipAddress("127.0.0.1")
.userAgent("USER_AGENT")
.type(AccountTakeoverDeviceDetails.Type.WEBSITE)
.build();
AccountTakeoverName name =
AccountTakeoverName.builder()
.firstName("FIRST_NAME")
.middleName("MIDDLE_NAME")
.lastName("LAST_NAME")
.suffix("SUFFIX")
.title("TITLE")
.build();
Telephone telephone =
Telephone.builder()
.type(TelephoneType.HOME)
.platformType(TelephonePlatformType.MOBILE)
.countryAccessCode("1")
.areaCode("123")
.phoneNumber("123456")
.extensionNumber("123")
.preferenceRank(BigDecimal.ZERO)
.lastVerifiedDateTime(OffsetDateTime.now())
.verifiedFlag(false)
.build();
CustomerAccountAddress address =
CustomerAccountAddress.builder()
.addressType(CustomerAccountAddress.AddressType.HOME)
.addressLine1("ADDRESS_LINE1")
.addressLine2("ADDRESS_LINE2")
.city("CITY")
.state("AB")
.zipCode("ZIP_CODE")
.countryCode("ABC")
.build();
AccountTakeoverCustomerAccount customerAccount =
AccountTakeoverCustomerAccount.builder()
.userId("USER_ID")
.accountType(AccountTakeoverCustomerAccount.AccountType.INDIVIDUAL)
.accountRole(AccountTakeoverCustomerAccount.AccountRole.USER)
.name(name)
.username("username")
.emailAddress("user@example.com")
.telephones(List.of(telephone))
.address(address)
.registeredTime(OffsetDateTime.now())
.activeFlag(false)
.loyaltyMemberId("LOYALTY_MEMBER_ID")
.build();
ChallengeDetail challengeDetail =
ChallengeDetail.builder()
.displayedFlag(false)
.type(ChallengeDetail.Type.CAPTCHA)
.status(ChallengeDetail.Status.SUCCESS)
.build();
CurrentUserSession currentUserSession =
CurrentUserSession.builder()
.sessionId("SESSION_ID")
.startDateTime(OffsetDateTime.now())
.challengeDetail(challengeDetail)
.build();
LoginTransactionDetails loginTransactionDetails =
LoginTransactionDetails.builder()
.transactionDateTime(OffsetDateTime.now())
.transactionId("TRANSACTION_ID")
.currentUserSession(currentUserSession)
.authenticationType(LoginTransactionDetails.AuthenticationType.CREDENTIALS)
.authenticationSubType(LoginTransactionDetails.AuthenticationSubType.EMAIL)
.successfulLoginFlag(false)
.failedLoginReason(LoginTransactionDetails.FailedLoginReason.INVALID_CREDENTIALS)
.build();
AccountTransaction accountTransaction =
AccountTransaction.builder()
.siteInfo(siteInfo)
.customerAccount(customerAccount)
.deviceDetails(deviceDetails)
.transactionDetails(loginTransactionDetails)
.build();
AccountScreenRequest accountScreenRequest =
AccountScreenRequest.builder()
.transaction(accountTransaction)
.build();
FraudPreventionV2Client client = FraudPreventionV2Client.builder().build();
AccountScreenResponse response = client.screenAccount(accountScreenRequest);
AccountTakeoverUpdate: Multifactor Authentication Update
Request
{
"type": "MULTI_FACTOR_AUTHENTICATION_UPDATE",
"risk_id": "RISK_ID",
"multi_factor_authentication_attempts": [
{
"delivery_method": "SMS",
"status": "SUCCESS",
"reference_id": "REF_ID",
"provider_name": "PROVIDER_NAME",
"attempt_count": 1,
"update_start_date_time": "1970-01-01T00:00:00+00:00",
"update_end_date_time": "1970-01-01T00:00:00+00:00",
"telephone": {
"country_access_code": "1",
"area_code": "123",
"phone_number": "123456"
}
}
]
}
SDK Example
Telephone telephone =
Telephone.builder()
.countryAccessCode("1")
.areaCode("123")
.phoneNumber("123456")
.build();
MultiFactorAuthenticationAttempt multiFactorAuthenticationAttempt =
MultiFactorAuthenticationAttempt.builder()
.deliveryMethod(MultiFactorAuthenticationAttempt.DeliveryMethod.SMS)
.status(MultiFactorAuthenticationAttempt.Status.SUCCESS)
.referenceId("REF_ID")
.providerName("PROVIDER_NAME")
.attemptCount(BigDecimal.ONE)
.updateStartDateTime(OffsetDateTime.now())
.updateEndDateTime(OffsetDateTime.now())
.telephone(telephone)
.build();
MultiFactorAuthenticationUpdate multiFactorAuthenticationUpdate =
MultiFactorAuthenticationUpdate.builder()
.riskId("RISK_ID")
.multiFactorAuthenticationAttempts(List.of(multiFactorAuthenticationAttempt))
.build();
FraudPreventionV2Client client = FraudPreventionV2Client.builder().build();
AccountUpdateResponse response =
client.notifyWithAccountUpdate(multiFactorAuthenticationUpdate);
AccountTakeoverUpdate: Remediation Update
Request
{
"type": "REMEDIATION_UPDATE",
"risk_id": "RISK_ID",
"remediation_update_actions": [
{
"action_name": "PASSWORD_RESET",
"status": "SUCCESS",
"update_end_date_time": "1970-01-01T00:00:00+00:00"
}
]
}
SDK Example
RemediationUpdateAction remediationUpdateAction =
RemediationUpdateAction.builder()
.actionName(RemediationUpdateAction.ActionName.PASSWORD_RESET)
.status(RemediationUpdateAction.Status.SUCCESS)
.updateEndDateTime(OffsetDateTime.now())
.build();
RemediationUpdate remediationUpdate =
RemediationUpdate.builder()
.riskId("RISK_ID")
.remediationUpdateActions(List.of(remediationUpdateAction))
.build();
FraudPreventionV2Client client = FraudPreventionV2Client.builder().build();
AccountUpdateResponse response =
client.notifyWithAccountUpdate(remediationUpdate);