-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
Field naming inconsistency: last_4 in webhooks vs last4 in API responses
Environment
- Checkout SDK version: N/A (API inconsistency)
- Platform and version: PHP 8.x
- Operating System and version: All platforms
Description
Checkout.com uses inconsistent field names for card's last four digits:
- Webhook events use
last_4(with underscore) - REST API responses use
last4(no underscore)
Expected behavior
Field name should be consistent across all endpoints - either last4 or last_4 everywhere.
Current behavior
Webhook event (card_verified):
"source" => [
"last_4" => "0018" // With underscore
]API response (GET /payments/{id}):
"source" => [
"last4" => "0018" // No underscore
]Steps to reproduce
- Receive a
card_verifiedwebhook - observelast_4field - Call
GET /payments/{id}- observelast4field - Note the inconsistency
Possible solution
Standarize on one naming convention (preferably last_4 with underscore) across all endpoints. Provide deprecation period for the old field name.
Current workaround required:
$lastFour = $data['last_4'] ?? $data['last4'] ?? null;Additional information
This affects all integrations using both webhooks and REST API. All other card fields (expiry_month, fingerprint, etc.) are consistent - only last4/last_4 has this issue.
Metadata
Metadata
Assignees
Labels
No labels