Skip to content

Fix ClientMetadataID Being Nil For PayPal Checkout With BillingAgreement Flow#1807

Merged
buzzamus merged 3 commits into
mainfrom
fix-cmid-for-xo-ba
May 27, 2026
Merged

Fix ClientMetadataID Being Nil For PayPal Checkout With BillingAgreement Flow#1807
buzzamus merged 3 commits into
mainfrom
fix-cmid-for-xo-ba

Conversation

@buzzamus

Copy link
Copy Markdown
Contributor

Summary of changes

  • When a merchant uses the checkout flow with PayPal and has shouldRequestBillingAgreement set to true the PP checkout token is returned for the CMID, but once the flow is completed a BA token is returned since a billing agreement has been requested. This caused the new BA token to override the existing CMID, which could no longer find the new token in the existing dictionary. This fix resolves that issue by setting to the EC token for this specific scenario.

AI Usage

Which AI Agent Was Used?

  • Copilot
  • Claude
  • Other (Type Name Here)

How was AI used?
For creating a quick testing scneario in the Demo app by adding a BA request toggle.

Estimated AI Code Contribution

  • less than 30%
  • 30 - 60%
  • 60 - 100%

Checklist

  • Added a changelog entry
  • Tested and confirmed payment flows affected by this change are functioning as expected

Authors

List GitHub usernames for everyone who contributed to this pull request.

@buzzamus buzzamus requested a review from a team May 27, 2026 15:38
@buzzamus buzzamus requested a review from a team as a code owner May 27, 2026 15:38
@github-actions

github-actions Bot commented May 27, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities found.

Scanned Files

None

@buzzamus buzzamus changed the title Fix cmid for xo ba Fix ClientMetadataID Being Nil For PayPal Checkout With BillingAgreement Flow May 27, 2026
let contactInformationToggle = Toggle(title: "Add Contact Information")
let amountBreakdownToggle = Toggle(title: "Amount Breakdown")
let requestBillingAgreementToggle = Toggle(title: "Request Billing Agreement")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I included this with the fix as we didn't have an easy way to test a checkout flow with requestBillingAgreement enabled, so figured this would be good to keep

@agedd agedd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ty for fixing this! can we add a unit test to test this scenario (approving ahead of time) 🚀

@jaxdesmarais jaxdesmarais left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding docstrings so future us does not forget this fix. 🚀

@buzzamus

Copy link
Copy Markdown
Contributor Author

ty for fixing this! can we add a unit test to test this scenario (approving ahead of time) 🚀

@agedd I actually started to, but both shouldRequestBillingAgreement and extractToken are private, so there isn't really a super good way to test this easily the way it currently is

@buzzamus buzzamus merged commit ee5394e into main May 27, 2026
99 of 108 checks passed
@buzzamus buzzamus deleted the fix-cmid-for-xo-ba branch May 27, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants