{
"Comment": "Express credit check — low-latency financing decision path covering Pass, Task, Choice, Wait, Succeed, and Fail states.",
"StartAt": "SetRequestMeta",
"States": {
"SetRequestMeta": {
"Type": "Pass",
"Parameters": {
"orderId.$": "$.orderId",
"customerId.$": "$.customerId",
"dealerId.$": "$.dealerId",
"modelCode.$": "$.modelCode",
"vehiclePrice.$": "$.vehiclePrice",
"trimLevel.$": "$.trimLevel",
"color.$": "$.color",
"addOns.$": "$.addOns",
"homeDelivery.$": "$.homeDelivery",
"deliveryAddress.$": "$.deliveryAddress",
"orderDate.$": "$.orderDate",
"customer.$": "$.customer",
"authorizationId.$": "$$.Execution.Id",
"channel": "EXPRESS"
},
"Next": "CreditScreen"
},
"CreditScreen": {
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke",
"Parameters": {
"FunctionName": "${RunCreditCheckFunctionArn}",
"Payload.$": "$"
},
"ResultPath": "$.credit",
"Retry": [
{
"ErrorEquals": [
"Lambda.ServiceException",
"Lambda.AWSLambdaException"
],
"IntervalSeconds": 2,
"MaxAttempts": 2,
"BackoffRate": 2
}
],
"Catch": [
{
"ErrorEquals": [
"States.ALL"
],
"ResultPath": "$.error",
"Next": "CreditCheckFailed"
}
],
"Next": "IsCreditApproved"
},
"IsCreditApproved": {
"Type": "Choice",
"Choices": [
{
"Variable": "$.credit.Payload.isApproved",
"BooleanEquals": true,
"Next": "ReserveVehicle"
}
],
"Default": "CreditDeclined"
},
"ReserveVehicle": {
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke",
"Parameters": {
"FunctionName": "${CheckInventoryFunctionArn}",
"Payload.$": "$"
},
"ResultPath": "$.reservation",
"Catch": [
{
"ErrorEquals": [
"States.ALL"
],
"ResultPath": "$.error",
"Next": "CreditCheckFailed"
}
],
"Next": "ReservationPropagationDelay"
},
"ReservationPropagationDelay": {
"Type": "Wait",
"Comment": "Brief hold to allow the vehicle reservation to propagate to downstream dealer management systems.",
"Seconds": 2,
"Next": "CreditApproved"
},
"CreditApproved": {
"Type": "Succeed"
},
"CreditDeclined": {
"Type": "Fail",
"Error": "CreditDeclined",
"Cause": "Customer credit application did not meet financing requirements"
},
"CreditCheckFailed": {
"Type": "Fail",
"Error": "CreditCheckFailed",
"Cause": "Credit check or inventory reservation lambda encountered an unexpected error"
}
}
}JSONExpand
100%
Automotive teams can use patterns like this to build reliable, compliant, and scalable automation for payment systems and can test and refine these flows locally with Thrubit to reduce cloud cost and speed up iteration.