SDK Usage Examples
Screen Order
Request Object
{
"transaction": {
"site_info": {
"country_code": "USA",
"agent_assisted": false
},
"device_details": {
"device_box": "TrustWidget"
},
"customer_account": {
"account_type": "STANDARD",
"name": {
"last_name": "Expedia",
"first_name": "Sally"
},
"email_address": "riskrtest@expedia.com"
},
"transaction_details": {
"order_id": "33322220004",
"current_order_status": "IN_PROGRESS",
"order_type": "CREATE",
"travel_products": [
{
"price": {
"value": 100.0,
"currency_code": "USD"
},
"type": "Car",
"inventory_type": "InventoryType",
"inventory_source": "AGENCY",
"travelers_references": [
""
],
"pick_up_location": "pick up location",
"drop_off_location": "drop off location",
"pickup_time": "2020-04-15T08:00:00-07:00",
"return_time": "2020-04-08T07:30:00-07:00"
}
],
"travelers": [
{
"traveler_name": {
"last_name": "Expedia",
"first_name": "Sally"
},
"email_address": "imsafe@gmail.com",
"telephones": [
{
"country_access_code": "1",
"area_code": "212",
"phone_number": "12345678",
"type": "HOME"
}
],
"primary": true,
"birth_date": "2020-04-15T08:00:00-07:00"
}
],
"payments": [
{
"brand": "Visa",
"method": "CREDIT_CARD",
"billing_name": {
"last_name": "Expedia",
"first_name": "Sally"
},
"billing_email_address": "sally@example.com",
"authorized_amount": {
"value": 100.0,
"currency_code": "USD"
},
"card_type": "Visa",
"card_number": "378282246310005",
"card_avs_response": "Z",
"card_cvv_response": "T",
"telephones": [
{
"country_access_code": "1",
"area_code": "962",
"phone_number": "12345678",
"type": "HOME"
}
]
}
]
}
}
}
SDK Example
fraud_prevention_client = FraudPreventionClient(
ClientConfig(
key="KEY",
secret="SECRET",
endpoint="ENDPOINT",
)
)
telephone = Telephone(
type=TelephoneType.HOME,
country_access_code='1',
area_code='212',
phone_number='12345678'
)
site_info = SiteInfo(country_code='USA', agent_assisted=False)
device_details = DeviceDetails(device_box='TrustWidget')
name = Name(first_name='Sally', last_name='Expedia')
traveler = Traveler(
traveler_name=name,
email_address='imsafe@gmail.com',
telephones=[telephone],
primary=True,
birth_date=isoparse("2020-04-15T08:00:00.000-0700")
)
amount = Amount(value=100.0, currency_code='USD')
travel_product = Car(
type='Car',
inventory_type='InventoryType',
inventory_source='AGENCY',
travelers_references=[""],
price=amount,
pick_up_location='pick up location',
drop_off_location='drop off location',
return_time=isoparse('2020-04-08T07:30:00.000-0700'),
pickup_time=isoparse('2020-04-15T08:00:00.000-0700')
)
credit_card = CreditCard(
brand='Visa',
method=PaymentMethod('CREDIT_CARD'),
card_type='Visa',
billing_name=name,
authorized_amount=amount,
card_avs_response='Z',
card_cvv_response='T',
card_number='378282246310005',
billing_email_address='sally@example.com',
telephones=[telephone]
)
customer_account = CustomerAccount(account_type='STANDARD', email_address='riskrtest@expedia.com', name=name)
transaction_details = TransactionDetails(
order_id='33322220004',
current_order_status='IN_PROGRESS',
order_type='CREATE',
travelers=[traveler],
travel_products=[travel_product],
payments=[credit_card]
)
order_purchase_transaction = OrderPurchaseTransaction(
site_info=site_info,
device_details=device_details,
customer_account=customer_account,
transaction_details=transaction_details
)
order_purchase_screen_request = OrderPurchaseScreenRequest(transaction=order_purchase_transaction)
fraud_prevention_client.screen(order_purchase_screen_request)
Response Object
Json
{
"RISK_ID": "RISK_ID",
"decision": "ACCEPT",
"error_detail": null
}
Python
OrderPurchaseScreenResponse(
risk_id="RISK_ID",
decesion="ACCEPT",
error_detail=None
)
Order Update
Request Object
{
"type": "ORDER_UPDATE",
"risk_id": "RISK_ID",
"order_status": "COMPLETED",
"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
fraud_prevention_client = FraudPreventionClient(
ClientConfig(
key="KEY",
secret="SECRET",
endpoint="ENDPOINT",
)
)
order_update = OrderUpdate(
type=UpdateType.ORDER_UPDATE,
risk_id="04b918a7f2404dd78c1320345a89d0d3",
order_status=Status.COMPLETED,
cancellation_reason=CancellationReason(
primary_reason_code="PRIMARY REASON CODE",
sub_reason_code="SUB REASON CODE",
primary_reason_description="PRIMARY REASON DESCRIPTION",
sub_reason_description="SUB REASON DESCRIPTION"
)
)
fraud_prevention_client.update(order_update)