@rnw-community/react-native-payments
Version:
Accept Payments with Apple Pay and Android Pay using the Payment Request API.
7 lines (4 loc) • 316 B
text/typescript
import { isError } from '@rnw-community/shared';
const nativeCancellationCodes: ReadonlySet<string> = new Set(['E_CANCELLED_BY_USER', 'payment_error']);
export const isNativeUserCancellation = (error: unknown): boolean =>
isError(error) && nativeCancellationCodes.has((error as { code?: string }).code ?? '');