fix(connector): send paypal billing agreements as billing_agreement_id - #13767
Open
cryptiklemur wants to merge 2 commits into
Open
fix(connector): send paypal billing agreements as billing_agreement_id#13767cryptiklemur wants to merge 2 commits into
cryptiklemur wants to merge 2 commits into
Conversation
Changed Files
|
Orders v2 accepts a stored paypal payment method under two different keys. Payment Method Tokens v3 entries go in vault_id, Express Checkout billing agreements go in billing_agreement_id. The connector sent both as vault_id, so a merchant migrating existing billing agreements gets PERMISSION_DENIED. Billing agreement ids are prefixed B-, which is how the two are told apart.
cryptiklemur
force-pushed
the
paypal-billing-agreement-mit
branch
from
August 18, 2026 13:28
45d27ab to
ee745db
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
Orders v2 accepts a stored PayPal payment method under two different keys:
vault_idbilling_agreement_idB-...The connector sends both as
vault_id. For a merchant migrating existing billing agreements from another provider, every MIT fails.The two keys are not interchangeable. Probing Orders v2 with the same made-up
B-id under each key gives different failures, so PayPal routes them separately:BILLING_AGREEMENT_NOT_FOUNDis the expected answer for an id that does not exist, so the format is recognised under that key and not under the other. A real billing agreement charged successfully throughbilling_agreement_idagainst live PayPal.This picks the key by prefix, so v3 vault tokens keep their current behaviour.
Additional Changes
Motivation and Context
Closes #13768
Merchants moving to Hyperswitch from a provider that stored Express Checkout billing agreements cannot charge those agreements today. Their subscribers would have to re-authorise, even though PayPal keeps the agreements valid until the buyer cancels them.
How did you test it?
Manually, against PayPal.
Sent the same
B-id to Orders v2 under each key and compared the errors, as above. Charged a real Express Checkout billing agreement throughbilling_agreement_idand it completed, confirming the key works for reference transactions.cargo check -p hyperswitch_connectors --features v1reports no errors inpaypal. The remaining errors in that run are intrustlyandworldpayxmland need feature flags unrelated to this change.Checklist
cargo fmt --allon stable; nightly was not available, so thenightly-only import rules are unverified)
cargo clippy