Context
AdyenClient._set_url_version uses the following regex to replace the API version in endpoint URLs:
endpoint = re.sub(r"\.com/v\d{1,2}", f".com/{new_version}", endpoint)
This only matches URLs where the version segment appears immediately after the domain, e.g.:
checkout-test.adyen.com/v71 ✓
management-test.adyen.com/v3 ✓
It does not match PAL-based URLs where the version is deeper in the path, e.g.:
pal-test.adyen.com/pal/servlet/Recurring/v68 ✗
pal-test.adyen.com/pal/servlet/Payment/v68 ✗
pal-test.adyen.com/pal/servlet/BinLookup/v54 ✗
Proposed Change
Update the regex to match a version segment anywhere in the path:
endpoint = re.sub(r"/v\d+(?=/|$)", f"/{new_version}", endpoint)
Also add a None guard to avoid corrupting unrelated service URLs when only one api_*_version is set:
version = version_lookup[service]
if version is None:
return endpoint
Benefit
Setting api_recurring_version, api_payment_version, api_payout_version, api_bin_lookup_version, or api_stored_value_version on AdyenClient currently has no effect. The fix makes version overrides work consistently across all services.
Context
AdyenClient._set_url_versionuses the following regex to replace the API version in endpoint URLs:This only matches URLs where the version segment appears immediately after the domain, e.g.:
checkout-test.adyen.com/v71✓management-test.adyen.com/v3✓It does not match PAL-based URLs where the version is deeper in the path, e.g.:
pal-test.adyen.com/pal/servlet/Recurring/v68✗pal-test.adyen.com/pal/servlet/Payment/v68✗pal-test.adyen.com/pal/servlet/BinLookup/v54✗Proposed Change
Update the regex to match a version segment anywhere in the path:
Also add a
Noneguard to avoid corrupting unrelated service URLs when only oneapi_*_versionis set:Benefit
Setting
api_recurring_version,api_payment_version,api_payout_version,api_bin_lookup_version, orapi_stored_value_versiononAdyenClientcurrently has no effect. The fix makes version overrides work consistently across all services.