Skip to content

fix: route forward and identity clients to dedicated base URLs#334

Merged
david-ruiz-cko merged 5 commits into
masterfrom
fix/forward-identity-base-urls
May 12, 2026
Merged

fix: route forward and identity clients to dedicated base URLs#334
david-ruiz-cko merged 5 commits into
masterfrom
fix/forward-identity-base-urls

Conversation

@armando-rodriguez-cko
Copy link
Copy Markdown
Contributor

@armando-rodriguez-cko armando-rodriguez-cko commented May 11, 2026

Summary

The forward service and the identity-verification services (face authentication, ID document verification, identity verification, AML screening, applicants) live on their own hosts in the swagger spec, not under api.checkout.com. This PR adds dedicated URIs for both and routes the corresponding clients through them. It also tightens the subdomain validation regex to match the AWS PrivateLink prefix format documented at https://www.checkout.com/docs/developer-resources/api/private-connections/aws-privatelink^(?:pl-)?[a-z0-9]+$ (alphanumeric, optionally prefixed by the literal pl-). Finally, it exposes the identity-verification OAuth scope as a typed constant.

Changes

  • lib/Checkout/Environment.php — adds $forwardUri and $identityUri fields, constructor parameters, getForwardUri()/getIdentityUri() accessors, sandbox/production values
  • lib/Checkout/CheckoutApi.php — adds getForwardApiClient and getIdentityApiClient helpers; routes forwardClient to forward URI; caches the identity ApiClient once and reuses it across faceAuthenticationClient, idDocumentVerificationClient, identityVerificationClient, amlScreeningClient, applicantsClient
  • lib/Checkout/OAuthScope.php — adds public static $IdentityVerification = "identity-verification"
  • lib/Checkout/EnvironmentSubdomain.php — tightens regex to /^(?:pl-)?[a-z0-9]+$/
  • test/Checkout/Tests/CheckoutConfigurationTests.php — updates subdomain corpus: removes test-123 from accepted, adds pl-vkuhvk4v (docs example), adds test-123/foo-bar/pl- to rejected; adds testEnvironmentSandboxHasCorrectForwardAndIdentityUrls / testEnvironmentProductionHasCorrectForwardAndIdentityUrls
  • test/Checkout/Tests/CheckoutDefaultSdkTest.php — updates shouldInstantiateClientWithCustomHttpClient mock expectation from exactly(4) to exactly(6) (base, files, transfers, balances, forward, identity)

API Reference

  • https://forward.checkout.com / https://forward.sandbox.checkout.com — forward service (POST /forward (beta), GET /forward/{id} (beta), POST /forward/secrets, GET|POST|DELETE /forward/secrets/{name}). Scopes: forward (plus forward:secrets for secrets endpoints).
  • https://identity-verification.checkout.com / https://identity-verification.sandbox.checkout.com — identity services (/applicants, /identity-verifications (beta), /aml-verifications (beta), /face-authentications (beta), /id-document-verifications (beta)). Scope: identity-verification.
  • https://pl-{prefix}.api.{sandbox.,}checkout.com — AWS PrivateLink subdomain format

Breaking changes

  • None for SDK consumers from the URL split — Environment is constructed internally via the Environment::sandbox() / Environment::production() factories.
  • The subdomain regex is now stricter: arbitrary hyphenated subdomains like test-123 or foo-bar-baz are rejected. Only plain alphanumeric or the literal PrivateLink form (pl-{prefix}) are accepted.

README

Not affected.

@armando-rodriguez-cko armando-rodriguez-cko requested a review from a team May 11, 2026 13:28
Cache the identity ApiClient instance once instead of constructing it
inside each of the five identity client constructors. Updates
shouldInstantiateClientWithCustomHttpClient to expect six getClient()
calls (base, files, transfers, balances, forward, identity) instead of
the previous four.
Per the AWS PrivateLink docs (https://www.checkout.com/docs/developer-resources/api/private-connections/aws-privatelink),
the valid subdomain is the first eight characters of the client_id
(alphanumeric only), optionally with the literal pl- prefix when
calling through PrivateLink. Tighten the regex from RFC-1123-style
hyphenated to /^(?:pl-)?[a-z0-9]+$/ and update the test corpus:
test-123 moves to the rejected list, pl-vkuhvk4v (the docs example)
joins the accepted list, and pl-, foo-bar are added as rejected.
Per the swagger spec, all identity endpoints (applicants,
identity-verifications, aml-verifications, face-authentications,
id-document-verifications) require the OAuth scope
identity-verification. Expose it as a typed static so OAuth
clients can request it without hardcoding the string.
@armando-rodriguez-cko armando-rodriguez-cko force-pushed the fix/forward-identity-base-urls branch from f40e75a to 97b0185 Compare May 12, 2026 09:29
@sonarqubecloud
Copy link
Copy Markdown

@david-ruiz-cko david-ruiz-cko merged commit 74a1382 into master May 12, 2026
6 checks passed
@david-ruiz-cko david-ruiz-cko deleted the fix/forward-identity-base-urls branch May 12, 2026 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants