Checking access…

Skip to main content
Audience: CCG Platform Engineers

Troubleshoot Customer Creation During Payment

Use these failure scenarios and log messages to investigate a payment paused in PENDING_FOR_CUSTOMER_CREATION or failed during customer lookup or creation.

Common Failure Scenarios​

ScenarioObserved StateRecovery
Customer service unavailable (network timeout)handleError() branch 2: errorGroup=INTERNAL_ERROR, httpStatus=504 GATEWAY_TIMEOUT; transaction transitions to FAILED via handlePostProcessingCommandFailure(); not publishable (504 βˆ‰ PUBLISHABLE_FAILED_HTTP_STATUSES); INTERNAL_ERROR βˆ‰ BUSINESS_RULE_VIOLATION_ERROR_GROUPS; GET returns 200 (FAILED)Caller retries POST /v2/payments
Customer service returns 422 (e.g. invalid metadata key)Post-processing wraps as UNPROCESSABLE_ENTITY/422; transaction β†’ FAILED; event publishedCaller polls GET /v2/payments β€” receives 422 with customer-service error detail
Customer service returns 4xx that is not 404 on USER_INITIATEDSame as above β€” preserved as 422 via PaymentException branchCaller polls GET, discovers failure
Customer creation event never arrivesTransaction stays in PENDING_FOR_CUSTOMER_CREATION indefinitelyOperational alert on stale PENDING_FOR_CUSTOMER_CREATION rows; manual requeue or support escalation
Customer event arrives but attempt creation failsTransaction transitions to FAILED, event publishedCaller investigates via PAYMENT_UPDATED webhook
Duplicate customer event delivered (at-least-once delivery)TransactionAttemptOrchestrator idempotency check returns empty FluxNo duplicate payments created
Missing customer object (MERCHANT_INITIATED)TransactionCommandException with no ErrorResponse β†’ wrapped as UNPROCESSABLE_ENTITY/422; transaction β†’ FAILEDCaller polls GET, discovers validation error
Null customerId (USER_INITIATED)Same as above β€” UNPROCESSABLE_ENTITY/422 via pollingCaller polls GET, discovers validation error

Logging Reference​

Key log messages to trace this flow in Splunk / Application Insights:

MessageLevelLocation
"Guest payment β€” skipping customer lookup for transaction: {merchantTransactionId}"INFOCustomerCheckCommand
"Customer not found for USER_INITIATED_PAYMENT transaction: {} β€” transitioning to PENDING_FOR_CUSTOMER_CREATION"INFOCustomerCheckCommand
"Failed to publish PENDING_FOR_CUSTOMER_CREATION event for transaction: {} β€” {}"WARNCustomerCheckCommand
"Resuming V2 transaction {} after customer creation"INFOCustomerConsumer
"Customer creation failed for transaction: {} β€” transitioning to FAILED"WARNCustomerConsumer
"Re-triggered TransactionAttempt with {} result(s) for transaction: {}"INFOCustomerConsumer
"Attempt creation failed for transaction: {} β€” transitioning to FAILED"ERRORCustomerConsumer
"Unable to process V2 transaction on customer creation"ERRORCustomerConsumer

Search query example (Splunk):

index=wallet_payment "PENDING_FOR_CUSTOMER_CREATION" OR "customer creation"
| eval flow=if(searchmatch("Resuming V2"), "resumed", if(searchmatch("FAILED"), "failed", "parked"))
| stats count by flow, merchantTransactionId

CC-12883 β€” Bug Fix (2026-05-06)

Prior to this fix, CustomerCheckCommand.isPreProcessingCommand() returned true, causing any customer-service error (e.g. invalid metadata key, 422 from customer service) to be returned synchronously as an HTTP 422. The contract requires these failures to be asynchronous. This was fixed by moving the command to post-processing (isPreProcessingCommand() = false) and adding correct PaymentException handling in handleError().

CC-12883 β€” Root Cause & Resolution​

Ticket: CC-12883
Symptom: POST /v2/payments returned 422 Unprocessable Entity synchronously when the customer object contained an invalid metadata key (e.g. a key not recognised by the customer service).
Expected: 202 Accepted always; failure surfaced via GET /v2/payments polling.

Root Causes​

Three defects combined to produce the bug:

#DefectImpact
1isPreProcessingCommand() returned trueCustomer check ran synchronously β€” any error became a synchronous HTTP response
2No PaymentException branch in handleError()Customer-service errors (delivered as PaymentException(ErrorResponse)) fell into the generic fallback, producing TransactionCommandException with no ErrorResponse β†’ shouldPublishFailedEvent() returned false β†’ failure invisible via polling
3PaymentException(ErrorResponse) constructor sets no string messagethrowable.getMessage() returns null β†’ "Customer validation failed: null" in error messages without Optional guard

Fixes Applied​

FileChange
CustomerCheckCommand.isPreProcessingCommand()true β†’ false
CustomerCheckCommand.handleError()Added PaymentException branch (branch 3) preserving downstream ErrorResponse with null-safe message extraction
CustomerCheckCommand.handleError()Added TransactionCommandException (null ErrorResponse) branch (branch 4) wrapping pre-validation failures as UNPROCESSABLE_ENTITY/422

End-to-End After Fix​

POST /v2/payments (invalid metadata)
β†’ 202 Accepted (transaction saved as INITIATED)
↓ async on boundedElastic
CustomerCheckCommand.execute()
β†’ customer service returns 422
β†’ handleError() β†’ PaymentException branch β†’ TransactionCommandException(errorResponse={422, UNPROCESSABLE_ENTITY})
β†’ handlePostProcessingCommandFailure()
β†’ transaction.status = FAILED, error = {httpStatus=422, group=UNPROCESSABLE_ENTITY}
β†’ publishFailedTransactionEvent() [422 ∈ PUBLISHABLE_FAILED_HTTP_STATUSES]

GET /v2/payments β†’ FAILED + isBusinessRuleViolation() β†’ 422 with detail