Skip to content

Commit

Permalink
fix: handle url callback android (#1423)
Browse files Browse the repository at this point in the history
* always return false on android

* doc string

* Update CHANGELOG.md
  • Loading branch information
charliecruzan-stripe authored Jun 28, 2023
1 parent a2fe05a commit 0cbf9fc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## Fixes

- Only call `handleURLCallback` on iOS. [#1423](https://github.com/stripe/stripe-react-native/pull/1423)

## 0.28.0 - 2023-06-16

## Features
Expand Down
11 changes: 10 additions & 1 deletion src/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,17 @@ export const createTokenForCVCUpdate = async (
}
};

/**
* Call this method in your app whenever you receive a URL for a Stripe callback.
* For convenience, you can pass all URLs you receive to this method first, and
* check the return value to easily determine whether it is a callback URL that Stripe will handle
* or if your app should process it normally. This is iOS-only, and will always return false on Android.
*/
export const handleURLCallback = async (url: string): Promise<boolean> => {
const stripeHandled = await NativeStripeSdk.handleURLCallback(url);
const stripeHandled =
Platform.OS === 'ios'
? await NativeStripeSdk.handleURLCallback(url)
: false;
return stripeHandled;
};

Expand Down

0 comments on commit 0cbf9fc

Please sign in to comment.