react-native-pay
Skill for @gmisoftware/react-native-pay. Presents the platform payment sheet (Apple Pay /
Google Pay) and returns a payment token to JavaScript.
This library does not charge anyone. It tokenizes. Everything after that is your backend.
Paths like package/src/... are relative to a library checkout, not this skills repo.
Version verification
Package: @gmisoftware/react-native-pay
Version: 0.0.16
Commit: 2078fdda8bdef87b51d20039d7684a255f0baadc
Verification date: 2026-08-210.0.x — treat the API as unstable; re-verify against the installed copy.
npm view @gmisoftware/react-native-pay version
node -p "require('@gmisoftware/react-native-pay/package.json').version"When to use
- Adding Apple Pay or Google Pay to React Native / Expo
- Merchant IDs, entitlements, Expo config plugin
- Button missing / Google Pay unavailable
- Backend token handling and gateway choice
- Testing payments; judging whether an integration is safe to ship
- Changing Nitro specs / Swift / Kotlin / config plugin
When NOT to use
| Situation | Instead |
|---|---|
| Card fields, PayPal, subscriptions billing | Your gateway's React Native SDK |
| Charging, refunds, webhooks, reconciliation | Gateway server SDK |
| Apple Pay on the web | Apple's web Payment Request docs |
| Wallet passes / loyalty cards | PassKit pass APIs |
| Showing backend decline inside the Apple Pay sheet | Not possible today — see limitations |
Core architecture
JS builds PaymentRequest
→ HybridPaymentHandler.startPayment(request)
→ OS sheet (PassKit / Google Pay)
→ encrypted token → PaymentResult
→ YOUR CODE → YOUR BACKEND → gateway charge| Export | Role |
|---|---|
HybridPaymentHandler |
Availability + startPayment |
usePaymentCheckout |
Cart state, availability, status |
ApplePayButton / GooglePayButton |
Platform-exclusive native buttons |
usePaymentCheckout and the exported HybridPaymentHandler each call createHybridObject at
module scope — two native instances. Pick one; do not mix
(architecture.md).
Full surface: api.md. No subpath exports.
Security boundary (read first)
| Question | Answer |
|---|---|
| Network requests in the library? | No |
| Stores credentials/tokens? | No |
| Contacts a payment gateway? | No (gateway name is OS config only) |
| Charges the card? | No |
| Raw token exposed to JS? | Yes — PaymentResult.token.paymentData |
LIBRARY: present sheet, return token
YOU: send token to backend over TLS
BACKEND: authorise/capture with SECRET keys- Never put gateway secrets in the client (source,
.env,app.config.js, binary). - Never trust client-reported amounts — backend recomputes from its order record.
- Treat the token as short-lived — do not log, persist, or send off-backend.
- Crash/analytics must not capture
paymentData. - UI contract is
pending→succeeded|failedfrom the backend — not the sheet. - Authorise the caller against the referenced order before charging.
Details: security.md.
Critical behaviours
- Apple Pay sheet always reports success — hardcoded
.successafter 1s; sheet success ≠ payment succeeded (apple-pay.md). - Google Pay defaults to TEST — omitting
googlePayEnvironment→ test tokens that cannot charge; set'PRODUCTION'explicitly (google-pay.md). canMakePaymentsdiffers — iOS queries the device; Android is a string list check. PreferpayServiceStatus().canMakePaymentson Android.- Failures resolve, they do not reject — check
result.success, do not rely ontry/catch.
Problem → reference routing
| Problem | Start here |
|---|---|
| Safe to ship? Backend responsibilities | security.md |
| Token → gateway (Stripe / Braintree / Adyen) | security + api.md |
| TEST vs PRODUCTION Google Pay | google-pay.md |
| Setup / Expo / native wiring | setup.md |
| Apple Pay from scratch | setup → apple-pay.md |
| Google Pay from scratch | setup → google-pay.md |
| Button missing / unavailable | debugging.md |
| Exact API / field names | api.md |
| Testing on simulator/device; release gate | testing.md |
| Native architecture | architecture.md |
| Contributing to the library | contributing.md |
Common mistakes
- Shipping Stripe/Braintree secret keys in the app
- Treating sheet success as a successful charge
- Omitting
googlePayEnvironment: 'PRODUCTION' - Gating Android UI on
canMakePaymentsalone try/catcharoundstartPaymentfor cancellation- Using Expo Go (Nitro requires a development build)
- Logging or sending
PaymentResultto crash/analytics - Inventing APIs (
processPayment,stripeSecretKey,onPaymentCaptured— none exist) - Mixing
usePaymentCheckoutwith the exportedHybridPaymentHandler.startPayment
Troubleshooting
- Module missing / Expo Go → setup.md
- Availability / button → platform refs + debugging.md
- Wrong money / token shape → security.md
- Confusing sheet result → critical behaviours above
Known limitations
| Limitation | Consequence |
|---|---|
| iOS sheet always succeeds | Backend decline cannot appear in Apple Pay UI |
Android ignores custom supportedNetworks |
Hardcoded Visa/MC/Amex/Discover |
| One payment at a time | Second startPayment overwrites the first |
| Buttons are platform-exclusive | Branch on Platform.OS |
transactionId is a client UUID |
Not a gateway idempotency key |
| No Expo Go | Development build required |
| Simulator/emulator tokens unusable | Sheet may open; live charge needs a signed device |
Accuracy
Never invent configuration keys or claim "PCI compliant". Describe what crosses the boundary. Jest mocks Nitro — green tests do not prove a payment works.