Skip to content

feat(ios): add four Apple Pay button types - #121

Merged
jkasprzyk17 merged 1 commit into
mainfrom
feat/apple-pay-button-types
Nov 23, 2026
Merged

jkasprzyk17 merged 1 commit into
mainfrom
feat/apple-pay-button-types

Conversation

@jkasprzyk17

@jkasprzyk17 jkasprzyk17 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds plain, checkout, subscribe and inStore to ApplePayButtonType, so all 17 PKPaymentButtonType values are covered. Subscription apps now have a matching button.
  • Maps them to .plain, .checkout, .subscribe and .inStore in ApplePayButtonFactory.mapButtonType. All exist since iOS 12, below the library's minimum.
  • Adds ApplePayButtonFactoryTests, which checks the mapping for every type and the JS names of the new ones.
  • Updates the type list in README.md, docs/docs/api/components.md and docs/docs/troubleshooting.md; components.md notes that plain shows only the Apple Pay mark.

Fixes #80

Test plan

  • cd package && bun run typecheck
  • cd package && bun run lint
  • cd package && bun run test:ci (301 passed, after rebasing on main)
  • cd package && bun run check:docs
  • bun run docs:build
  • cd package && bun run specs: output matches the commit
  • xcodebuild test ... -scheme NitroPay-Unit-Tests on an iOS 26.5 simulator: 143 tests, 0 failures (before the rebase onto feat(android): Google Pay DIRECT tokenization #119/feat(android): request assurance details #120, which only touch Android and TS)
  • cd example && bunx expo run:ios: a temporary screen rendered each new type; all show Apple's label (screenshot below). The temporary screen is not part of this PR.
  • ./gradlew :gmisoftware_react-native-pay:testDebugUnitTest (not run; no hand-written Kotlin changed, see Risk)
  • cd example && bunx expo run:android (not run; Apple Pay button is iOS-only)

Risk

  • Additive change to a string union; existing values keep working.
  • Nitrogen reordered the generated GooglePayButtonType enum in C++/Kotlin/JNI (plain, checkout, subscribe and pay changed their numeric order), because those literals are now seen first in the Apple spec. All generated files are regenerated together, and the Android code and JNI refer to the values by name, so behaviour is unchanged.

Notes


Run Proof on this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

new-types

Add plain, checkout, subscribe and inStore to ApplePayButtonType and map them to PKPaymentButtonType. Regenerated Nitro bindings; Nitrogen reorders GooglePayButtonType's generated enum because the shared literals are now seen first in the Apple spec.

Fixes #80
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features
    • Added support for Apple Pay button styles for plain, checkout, subscription, and in-store payments.
  • Documentation
    • Updated the Apple Pay button style reference and troubleshooting guidance to include the additional options.

The TypeScript ApplePayButtonType union and iOS factory now support plain, checkout, subscribe, and inStore. XCTest coverage and documentation were updated for the expanded button types.

Changes: Apple Pay button type support

Layer / File(s) Summary
Add button types and PassKit mappings
package/src/specs/ApplePayButton.nitro.ts, package/ios/ApplePayButtonFactory.swift
The ApplePayButtonType union adds four values. The iOS factory maps them to their corresponding PassKit types.
Test and document button types
package/ios/Tests/ApplePayButtonFactoryTests.swift, README.md, docs/docs/api/components.md, docs/docs/troubleshooting.md
XCTest coverage checks 17 mappings and parses four JavaScript button names. The README and documentation list the added types. The API documentation describes plain and inStore.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

Suggested reviewers: piotr-graczyk-dev

Merge Risk: Minimal · up to e47cb · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed Title 'feat(ios): add four Apple Pay button types' has a conventional type prefix and names the main change. It is 42 characters, under the 50-character target. It does not name the issue or the mappi…
Description check Passed Description states the four new ApplePayButtonType values, the ApplePayButtonFactory.mapButtonType mapping, the new XCTest suite, and the README and docs updates. It also lists test runs and risks, an…
Linked Issues check Passed Issue #80 is the only directly linked issue. Its coding requirements are:

1. Add plain, checkout, subscribe and inStore to ApplePayButtonType. The raw summary shows this in `package/src/spe…
Out of Scope Changes check Passed All reviewed changes connect to #80 or to its generated and documented consequences:

- Spec union, factory mapping, and XCTest coverage: directly required by #80.
- README, components.md, and `trou…
Security Check Passed The PR adds four enum cases (plain, checkout, subscribe, inStore) to the Apple Pay button type. It maps them to PassKit button types, adds XCTest coverage, and updates docs. I found no securit…
Full details: Title check

Explanation

Title 'feat(ios): add four Apple Pay button types' has a conventional type prefix and names the main change. It is 42 characters, under the 50-character target. It does not name the issue or the mapping step, which is acceptable.

Full details: Description check

Explanation

Description states the four new ApplePayButtonType values, the ApplePayButtonFactory.mapButtonType mapping, the new XCTest suite, and the README and docs updates. It also lists test runs and risks, and matches the changeset closely.

Full details: Linked Issues check

Explanation

Issue #80 is the only directly linked issue. Its coding requirements are:

  1. Add plain, checkout, subscribe and inStore to ApplePayButtonType. The raw summary shows this in package/src/specs/ApplePayButton.nitro.ts (+4 lines).
  2. Map the new values in ApplePayButtonFactory.mapButtonType. The raw summary shows +4 lines in package/ios/ApplePayButtonFactory.swift.
  3. Add an XCTest for the mapping. package/ios/Tests/ApplePayButtonFactoryTests.swift (+39 lines) asserts all 17 mappings and the JS names of the new types.
  4. Update README.md and docs/docs/api/components.md. Both are updated, and the troubleshooting doc is also updated.
  5. Run bun run specs. The PR reports the generated output matches the commit. The generated files are in ignored_files, so this cannot be checked from the reviewed source.

Acceptance criterion: each new type shows Apple's label. This is a visual check. The author reports a temporary example screen rendered each type with Apple's label, and the PR includes a screenshot. The mapping test covers the code path.

Note: the raw summary spells the factory case as .instore, while the PR description and #80 use .inStore. The reported iOS XCTest run (143 tests, 0 failures) suggests the compiled name is correct. The source was not inspected directly, so this is a minor residual uncertainty, not a failure.

Full details: Out of Scope Changes check

Explanation

All reviewed changes connect to #80 or to its generated and documented consequences:

  • Spec union, factory mapping, and XCTest coverage: directly required by #80.
  • README, components.md, and troubleshooting.md type lists: required by #80's documentation step.
  • Regenerated GooglePayButtonType ordering in C++, Kotlin, and JNI: a generated side effect of adding the values to the shared Nitro spec. These files are in ignored_files and were not inspected. The PR states Android code refers to values by name. This is accepted as generated output, not as hand-written scope creep.

No unrelated hand-written change appears in the summary.

Full details: Security Check

Explanation

The PR adds four enum cases (plain, checkout, subscribe, inStore) to the Apple Pay button type. It maps them to PassKit button types, adds XCTest coverage, and updates docs. I found no security vulnerability in the changed code. Evidence from the diff (refs/coderabbit/pre-merge-check/base..head): - package/ios/ApplePayButtonFactory.swift: four new case lines map enum values to PKPaymentButtonType constants. This is a fixed, bounded mapping. No input is parsed, no sink is reached, and no auth or permission logic changes. - package/src/specs/ApplePayButton.nitro.ts: four string literals added to a TypeScript union. No runtime validation or data flow changes. - package/nitrogen/generated/ios/swift/ApplePayButtonType.swift: init?(fromString:) and the string conversion gain the four new cases. The default branch still returns nil for unknown strings, so no new unsafe parsing path appears. - Generated Android/shared C++ files: the GooglePayButtonType enum order changes. The JNI code looks up fields by name (getStaticField<...>("PLAIN")), and the Kotlin enum keeps explicit value integers. The reorder does not change lookup behavior, and no persisted or cross-trust numeric value depends on the order. - ApplePayButtonFactoryTests.swift is a new test file. It adds no secrets, network calls, or logging. - README and docs changes are text only. No dependency manifests changed. No secrets, credentials, logging, network, file-path, or deserialization code was added. No attacker-controlled input reaches a new sink. The findings are none, so no inline comments are required.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: bf84e2d0-1e95-42b4-975d-f2dad4e09e7d
Commits

Reviewing files that changed from the base of the PR and between fab64eb and e47cb89.

Files ignored due to path filters: 5

  • package/nitrogen/generated/android/c++/JGooglePayButtonType.hpp is excluded by !**/generated/**
  • package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/GooglePayButtonType.kt is excluded by !**/generated/**
  • package/nitrogen/generated/ios/swift/ApplePayButtonType.swift is excluded by !**/generated/**
  • package/nitrogen/generated/shared/c++/ApplePayButtonType.hpp is excluded by !**/generated/**
  • package/nitrogen/generated/shared/c++/GooglePayButtonType.hpp is excluded by !**/generated/**
Files selected for processing: 6

  • README.md
  • docs/docs/api/components.md
  • docs/docs/troubleshooting.md
  • package/ios/ApplePayButtonFactory.swift
  • package/ios/Tests/ApplePayButtonFactoryTests.swift
  • package/src/specs/ApplePayButton.nitro.ts

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

@jkasprzyk17

Copy link
Copy Markdown
Contributor Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@jkasprzyk17

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Action performed

Full review finished.

@jkasprzyk17
jkasprzyk17 merged commit bdaa942 into main Nov 23, 2026
8 checks passed
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.

Apple Pay button: plain, checkout, subscribe and inStore types are missing

1 participant