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_verified webhook - observe last_4 field
- Call
GET /payments/{id} - observe last4 field
- 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.
Field naming inconsistency:
last_4in webhooks vslast4in API responsesEnvironment
Description
Checkout.com uses inconsistent field names for card's last four digits:
last_4(with underscore)last4(no underscore)Expected behavior
Field name should be consistent across all endpoints - either
last4orlast_4everywhere.Current behavior
Webhook event (
card_verified):API response (
GET /payments/{id}):Steps to reproduce
card_verifiedwebhook - observelast_4fieldGET /payments/{id}- observelast4fieldPossible solution
Standarize on one naming convention (preferably
last_4with underscore) across all endpoints. Provide deprecation period for the old field name.Current workaround required:
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.