UNPKG

stripe-react-native-apple-pay

Version:

React Native wrapper around Stripe Apple Pay

48 lines (47 loc) 1.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.confirmPlatformPayPayment = void 0; exports.initStripe = initStripe; exports.isPlatformPaySupported = isPlatformPaySupported; var _NativeStripeSdk = _interopRequireDefault(require("./NativeStripeSdk")); var _types = require("./types"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function initStripe(params) { return _NativeStripeSdk.default.initialise(params); } function isPlatformPaySupported() { return _NativeStripeSdk.default.isPlatformPaySupported(); } const APPLE_PAY_NOT_SUPPORTED_MESSAGE = 'Apple pay is not supported on this device'; const confirmPlatformPayPayment = async (clientSecret, params) => { if (!(await _NativeStripeSdk.default.isPlatformPaySupported())) { return { error: { code: _types.PlatformPayError.Canceled, message: APPLE_PAY_NOT_SUPPORTED_MESSAGE } }; } try { const { result, error } = await _NativeStripeSdk.default.confirmPlatformPay(clientSecret, params); if (error) { return { error }; } return { result }; } catch (error) { return { error }; } }; exports.confirmPlatformPayPayment = confirmPlatformPayPayment; //# sourceMappingURL=functions.js.map