Skip to content

BUG: withAddressMatchIndicator(true) serializes as "NO" due to type-casting flaw (v14.0.5) #140

Description

@RadoslavSheytanovGP

Impact

Merchants using GP-API HPP via Links cannot control the Billing/Shipping address match checkbox. Passing true to withAddressMatchIndicator() silently fails and results in "NO" being sent in the API payload. This is actively affecting live client integrations.

Root Cause

There is a conflicting data-type mutation between HPPBuilder.php and GpApiAuthorizationRequestBuilder.php.

  1. HPPBuilder.php instantly mutates the injected boolean to a string:
    $this->payer->addressMatchIndicator = StringUtils::boolToYesNo($indicator); (true becomes "YES")
  2. Later, GpApiAuthorizationRequestBuilder.php expects the property to still be a boolean:
    $requestData['payer']['address_match_indicator'] = is_bool($payer->addressMatchIndicator) ? StringUtils::boolToYesNo($payer->addressMatchIndicator) : "NO";
  3. Because the value was already mutated to the string "YES" by the builder, is_bool("YES") evaluates to false, triggering the hardcoded fallback of "NO".

Steps to Reproduce

  1. Initialize HPPBuilder in a PHP SDK 14.0.5 environment.
  2. Call ->withAddressMatchIndicator(true)
  3. Inspect the generated authorization request payload.
  4. Observe address_match_indicator is incorrectly sent as "NO".

Suggested Fix

Either:

  1. Stop mutating the boolean in HPPBuilder.php and let the request builder handle serialization at the boundary layer.
  2. Update the check in GpApiAuthorizationRequestBuilder.php to handle string evaluations correctly.

Environment

  • PHP SDK Version: 14.0.5
  • Integration: GP-API HPP via Links

Reported by:
Rado Sheytanoff-Ruxton
Product Advocate at Global Payments Inc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions