Skip to content

Conversation

@carlosmuvi-stripe
Copy link
Contributor

Summary

Motivation

Testing

  • I tested this manually
  • I added automated tests

Documentation

Select one:

  • I have added relevant documentation for my changes.
  • This PR does not result in any developer-facing changes.

lng-stripe and others added 10 commits August 29, 2025 12:37
…ents (#2094)

* POC: conditionally include Onramp (Android only)

* use useCallback(); cleanup

* add jdoc

* document onramp types

* more docs

* WIP on iOS Split

* improve checkout API

* rm provideCheckoutClientSecret from useOnramp()

* Move onramp functions to their own module

* Fixes emitOnCheckoutClientSecretRequested using new onramp-specific protocol

* improve collectPaymentMethod signature

* fix Android

* (iOS) Allows a throwing lambda to propagte an error in `provideCheckoutClientSecret`

* improve error message

* fix errors; configure via gradle.properties

* [Onramp] Add create auth intent, create onramp session and checkout. (#2088)

* Integrate OnrampBackend API with authentication flow

- Add OnrampBackend class for createAuthIntent API calls
- Replace direct authenticateUser with createAuthIntent + authorize flow
- Update CryptoOnrampScreen to use two-step authentication
- Add proper error handling and state management for auth flow

Committed-By-Agent: cursor

* Fix OnrampBackend import path

- Update import from '../server/onrampBackend' to '../../server/onrampBackend'
- Resolves Metro bundler module resolution error

Committed-By-Agent: cursor

* Complete onramp session and checkout integration with loading states

- Add createOnrampSession endpoint to OnrampBackend
  - 60-second timeout, Bearer auth, proper error handling
  - Snake_case request format (cos_id) matching backend API

- Add checkout endpoint to OnrampBackend
  - POST /checkout with session ID and auth token
  - Returns OnrampSessionResponse with client_secret

- Implement session caching and checkout flow
  - Cache onrampSessionId when session creation succeeds
  - Replace INSERT_CLIENT_SECRET_HERE with real checkout API call
  - Update performCheckout to use cached session ID

- Add comprehensive validation system
  - validateOnrampSessionParams matches Android validation logic
  - Smart button enabling based on all required parameters
  - Clear messaging for missing requirements

- Implement loading states for better UX
  - Session creation: 'Creating Session...' with disabled state
  - Checkout: 'Checking Out...' with disabled state
  - Status messages show progress during operations
  - Prevent multiple clicks with proper state management

- Enhanced error handling and user feedback
  - try/finally blocks ensure loading states always reset
  - Detailed error messages from backend API responses
  - Auth token validation before checkout operations

Committed-By-Agent: cursor

* Refactor OnrampBackend architecture with reusable HTTP helper

- Extract common HTTP request logic into generic makeRequest<T> helper
- Add configurable options for timeout, authentication, and response transformation
- Reduce code duplication by ~65% across all API methods
- Improve maintainability with centralized error handling and logging
- Simplify method implementations to focus on business logic
- Add proper TypeScript typing for cross-platform timeout support

Benefits:
- createAuthIntent: 64 lines → 6 lines
- createOnrampSession: Uses timeout + auth + response transformation
- checkout: Uses timeout + auth + response transformation
- Consistent error handling and logging across all endpoints
- Easy to extend for future API methods

Committed-By-Agent: cursor

* cleans messages

* cleans up comments

* Fixing issues with old architecture being enabled

* Updates Stripe iOS SDK to 24.23.0

As a result, this fixes the following issue:

“Problems collecting bank account payment method
I was able to test the credit card payment method collection.
But if I call the SDK with collectPaymentMethod("BankAccount", {}) it ends up showing me the credit card payment method collection as well.”

And this also adapts to the latest performCheckout API changes in the native SDK, which throws errors instead of using a failure case on CheckoutResult, and also supports a cancellation result.

* (iOS) Deduplicate internal code around checking initialized types

* [Onramp] Fix destination network mismatch (#2089)

* Fix wallet address network mismatch issue

- Add network-specific default wallet addresses for all supported crypto networks
- Auto-update wallet address when network selection changes
- Prevent Ethereum addresses being used for Solana/Bitcoin/other networks
- Add visual feedback showing current network format
- Fix address format validation errors when switching networks

Fixes:
- Ethereum: 0x742d35... (EVM networks)
- Solana: 9WzDXwBbmkg8... (base58)
- Bitcoin: 1A1zP1eP... (base58 + version)
- Stellar: GDQP2KPQGKI... (base32)
- And more network-specific formats

This resolves the reported issue where users selecting Solana network
but using an Ethereum address format were getting validation errors.

Committed-By-Agent: cursor

* Fix onramp session destination network mismatch

- Track wallet network selection (Solana, Ethereum, etc.) during registration
- Map crypto networks to appropriate destination currencies (SOL, ETH, BTC, etc.)
- Pass correct destinationNetwork and destinationCurrency to createOnrampSession
- Add network-specific currency mapping for all supported networks
- Display selected network in wallet status section

Fixes the core issue where:
- User registers Solana wallet address
- But createOnrampSession used hardcoded 'ethereum' network + 'eth' currency
- Causing validation/processing errors on the backend

Now correctly maps:
- Solana → sol currency, solana network
- Bitcoin → btc currency, bitcoin network
- Ethereum/EVM → eth currency, respective network
- And all other supported networks

This resolves the reported Solana/Ethereum destination mismatch error.

Committed-By-Agent: cursor

* Remove dangerous default values from createOnrampSession API

- Remove default destinationNetwork, destinationCurrency, etc. from createOnrampSession
- Make all parameters required to prevent accidental network/currency mismatches
- Update convenience function to require all parameters explicitly
- Add missing customerIpAddress parameter to CryptoOnrampScreen call
- Update JSDoc to show examples instead of defaults

This prevents future issues where:
- Someone calls createOnrampSession without destinationCurrency
- It defaults to 'eth' even for Solana/Bitcoin wallets
- Causing the same network mismatch errors we just fixed

Now callers MUST explicitly provide all values, making the API safer.

Committed-By-Agent: cursor

* Spotless

* Revert "Spotless"

This reverts commit 6c63dd2.

* [Onramp] Adds `isAuthError` helper to SDK + sample `reAuth` error handler. (#2086)

* handles errors

* uses useOnramp

* spotless

* Merge branch 'lng/crypto-onramp-conditionally-load' into carlosmuvi/reauth-handling

* Unduplicate code

* Update CryptoOnrampScreen.tsx

* Update CryptoOnrampScreen.tsx

* Remove bad merge swift code

* Reverts spotless.

* moves error checker to onramp

Committed-By-Agent: cursor

---------

Co-authored-by: Twig <[email protected]>

* Onramp configuration for Expo (Android only)

* conditional iOS config

* mod podfile instead of using BuildProperties; add missing event

* spotless

* cleanup not implemented

* cleanup OnrampSdkModule initialise

* Standardizes binding-created error and cancellation text on iOS and Android; Consistently prefixes errors piped to example app with “:”.

---------

Co-authored-by: Michael Liberatore <[email protected]>
Co-authored-by: Twig <[email protected]>
Co-authored-by: Carlos Muñoz <[email protected]>
StripeSdk_minSdkVersion=21
# Keep StripeSdk_stripeVersion in sync with https://github.com/stripe/stripe-identity-react-native/blob/main/android/gradle.properties
StripeSdk_stripeVersion=21.23.+
StripeSdk_stripeVersion=21.24.4
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should point to. 21.26.0 here once released.

return
}

let errorResult = Errors.createError(ErrorType.Failed, "FUNCTION NOT IMPLEMENTED")
Copy link
Collaborator

Choose a reason for hiding this comment

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

TODO

promise.resolve(createOnrampNotConfiguredError())
return
}
promise.resolve(createFailedError(NotImplementedError()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

TODO

return
}

let errorResult = Errors.createError(ErrorType.Failed, "FUNCTION NOT IMPLEMENTED")
Copy link
Collaborator

Choose a reason for hiding this comment

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

TODO

lng-stripe and others added 17 commits September 8, 2025 14:52
# Conflicts:
#	example/ios/Podfile.lock
#	src/events.ts
* Updates native SDK versions.

* Remove Podfile.lock after attempting pod install with 24.23.1

Committed-By-Agent: cursor
…2103)

* Updates native SDK versions.

* Implements remaining bindings for StripeCryptoOnramp on iOS

* updates podfile

Committed-By-Agent: cursor

* update phone number testing

Committed-By-Agent: cursor

---------

Co-authored-by: Carlos Munoz <[email protected]>
Co-authored-by: Carlos Muñoz <[email protected]>
…2116)

The initialise method is async and returns a Promise, but it wasn't being
awaited. This could cause race conditions where subsequent Stripe operations
might be called before initialization completes.

Changes:
- Added await to initStripe function call to NativeStripeSdk.initialise
- Wrapped useEffect initialization in async IIFE
- Both Android and iOS initialization paths now properly await completion

Co-authored-by: Mikhail <[email protected]>
* Add new FormField for input

* Move UI into it's own sections

* Move sections into their own folder

* Move styles

* create utils file

* Move function into utils

* Rename screen to flow

* Remove verify screen

* Move register screen

* Fixes a build error

* Move styles back to CryptoOnrampFlow
* Reduce payment collection code

* Centralize alert showing logic

* Move the status section to its own file, cleanup styles
* don't recreate OnrampCoordinator

* add cryptoCustomerId configuration param

* Adds the cryptoCostumerId parameter to onramp coordinator creation

* Update iOS SDK, fix typo

* bump android 21.27.0

---------

Co-authored-by: Twig <[email protected]>
* Initial implementation of returning display data

* Allow bank account as well

* Initial implementation on both platforms

* Remove bankIconCode

* update for latest android changes

* Fills out more of the `paymentDisplayData` implementation on iOS

* Update api to be promise based

* Fix up to use result

* Update CryptoOnrampFlow.tsx

* Fix errors

* Uses alternate method for getting card brand

* Cleanup

* Update Onramp.ts

* Update StripeSdkImpl.swift

* Rename function

* Update typing information

* Refactors iOS `getCryptoTokenDisplayData` to return dictionary synchronously

* Fix compilation issue

* Update RN apis and kotlin parsing

* Updates iOS for new payment token dictionary structure

* Update CryptoOnrampFlow.tsx

* Fix pr comments

* Re-implement promise API

* Fix objc name

* Update to latest iOS SDK version

* Update iOS version

* update android sdk to 21.27.0

* Fix formatting

---------

Co-authored-by: Michael Liberatore <[email protected]>
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.

8 participants