Apple Pay implementation for React Native (Only IOS)
yarn add react-native-apple-payment
cd ios && pod install
type Network = 'Visa' | 'MasterCard' | 'AmEx';
export type SupportedNetworks = Network[];
export interface MethodData {
countryCode: string;
currencyCode: string;
supportedNetworks: SupportedNetworks;
merchantIdentifier: string;
}
export interface Detail {
label: string;
amount: number;
}
export interface DetailsData {
items?: Detail[];
total: Detail;
}
export type ApplePayResponse = {
paymentData: string;
paymentMethod: {
displayName: string;
network: string;
type: string;
};
};
import ApplePay, { MethodData, DetailsData, ApplePayResponse } from "react-native-apple-payment";
const payment = new ApplePay(method as MethodData, details as DetailsData);
const canMakePayment: boolean = await payment.canMakePayments()
const paymentResponse: ApplePayResponse = await payment.initApplePay()
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT