Checking access…

Skip to main content
Audience: CCG Platform Engineers

V1 vs V2 β€” What Changed and Why

Engineers understanding the V1-to-V2 design shift and its consequences. For exact contract differences, see the comparison reference. Before changing code, follow the migration checklist.

Purpose​

This document is the definitive reference for any engineer transitioning from V1 to V2 β€” whether implementing a new V2 feature, maintaining a V1 service that must interoperate with V2, or reviewing code. It explains what changed, why it changed, and what the practical consequences are for day-to-day development.

Start here if you are new to V2

Read this document before any domain-specific guide. Understanding the delta between V1 and V2 is the fastest way to become productive.

Summary: Core Philosophy Changes​

AspectV1V2
Payment modelSingle flat Payment entity per transactionPayment β†’ PaymentAllocation hierarchy (one payment, N allocations)
Split-tenderNot supportedUp to 2 allocations per payment, each processed independently
API versioningNo version prefix (e.g. /payments)Explicit /v2/ prefix on every endpoint
Response on creation200 OK with final state202 Accepted β€” async; state polled or received via webhook
Error contractErrorResponse DTO (ad-hoc per controller)Problem DTO (RFC 7807-aligned) with ErrorGroup taxonomy
IdempotencyPartial / inconsistentExplicit: merchantTransactionId as composite key, 5-attempt limit
Validation layersSingle-layer (Bean Validation)Multi-layer: Bean Validation β†’ structural validator β†’ business rule validator β†’ command pipeline
Event modelV1 DTOs in event/ packageV2 DTOs in events/v2/ package of wallet-event-commons
Vendor integrationEvent Grid used; adapter logic co-located within the payment servicewallet-stripe-adapter-service is a fully separate microservice; all vendor events flow exclusively through Event Grid
Refund typesLinked (against a payment) and Unlinked (against a payment method) β€” both supportedLinked and Unlinked both supported; V2 adds refundAllocations array for per-allocation partial and split-tender refund control
State machineSimple: created β†’ completed / failedRich: 15+ states with explicit transient and terminal classifications
Shared librarywallet-event-commons with mixed v1/v2 packageswallet-event-commons v2 packages only (v1 in active deprecation)
ObservabilityUnstructured / partial loggingStructured JSON logging with standard fields; distributed tracing

V1 vs V2 β€” State Machine Changes​

V1 had a flat status model. V2 adds 15+ states to precisely represent asynchronous processing:

V1 StatesV2 States (additions)
CREATEDINITIATED β†’ PENDING β†’ PROCESSING β†’ PROCESSING_DEDUP_CHECK
AUTHORIZEDAUTH_REQUIRED β†’ CONFIRMATION_INITIALIZED β†’ AUTHORIZED
CAPTUREDCAPTURE_INITIALIZED β†’ COMPLETED
FAILEDFAILED (unchanged terminal)
CANCELLEDCANCEL_INITIALIZED β†’ CANCELLED / CANCEL_FAILED
(not present)ACCEPTED (ACH bank account accepted, settlement pending)
(not present)ROLLED_BACK (split-tender allocation reversed after sibling failure)
(not present)PENDING_FOR_CUSTOMER_CREATION
(not present)PENDING_FOR_PAYMENT_METHOD_CREATION

Key implication: V2 clients must treat non-terminal states as "in progress" and use webhooks or polling. The V1 pattern of treating the HTTP response status as the final answer does not apply in V2.

V1 vs V2 β€” Shared Library (wallet-event-commons)​

ConcernV1V2
DTO locationcom.optum.wallet.common.event.*com.optum.wallet.common.events.v2.*
Error DTOErrorResponseProblem (RFC 7807)
EnumsSome duplicated across packagesCanonical in com.optum.wallet.common.enums.*
Refund error DTOCustom per-serviceRefundApiErrorResponse (shared)
WebhooksNo shared webhook DTOShared MerchantWebhookEvent envelope

Rule for V2 engineers: Always import from com.optum.wallet.common.events.v2.* and com.optum.wallet.common.enums.*. Never use com.optum.wallet.common.event.* (v1) in new code.

V1 vs V2 β€” Coding Patterns​

Customer Identity Resolution​

// V1 β€” customer referenced by internal UUID
{
"customer": { "id": "550e8400-..." }
}

// V2 β€” customer resolved by external identifier (priority order)
// 1. enterpriseIdentifier (highest priority)
// 2. hsid
// 3. metadata key-value
// At least one must be present.
{
"customer": { "hsid": "b313c1d1-..." }
}

Controller Base Path​

// V1
@RequestMapping("/payments")
public class PaymentController { ... }

// V2 β€” explicit version in base path
@RequestMapping("/v2/payments")
public class PaymentControllerV2 { ... }

Exception Handling​

// V1 β€” ad-hoc per controller
@ExceptionHandler(Exception.class)
public ResponseEntity<ErrorResponse> handle(Exception ex) {
return ResponseEntity.status(500).body(new ErrorResponse(...));
}

// V2 β€” centralized advisor scoped to V2 controllers
@RestControllerAdvice(assignableTypes = {PaymentControllerV2.class, RefundControllerV2.class})
public class ExceptionHandlersV2 {

@ExceptionHandler(PaymentFailedException.class)
public ResponseEntity<PaymentApiErrorResponse> handlePaymentFailed(PaymentFailedException ex) {
// Returns 422 with partial payment state in body
}

@ExceptionHandler(TransactionCommandException.class)
public ResponseEntity<Problem> handleCommandFailure(TransactionCommandException ex) {
// Returns 400 with Problem DTO
}
}