npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

expo-apple-pay

v0.6.6

Published

My new module

Readme

expo-apple-pay

An Expo module for integrating Apple Pay into your React Native applications.

Installation

npm install expo-apple-pay
# or
yarn add expo-apple-pay

For bare React Native projects, run npx pod-install after installing.

Usage

import { ApplePayButton } from 'expo-apple-pay';

function PaymentScreen() {
  const handleTokenReceived = (event) => {
    const { transactionIdentifier, paymentData, paymentNetwork } = event.nativeEvent;
    // Send token to your server for processing
  };

  return (
    <ApplePayButton
      merchantIdentifier="merchant.com.yourapp"
      countryCode="US"
      currencyCode="USD"
      amount={99.99}
      paymentSummaryItems={[
        { label: 'Product', amount: 89.99 },
        { label: 'Shipping', amount: 10.00 },
        { label: 'Your Company', amount: 99.99 },
      ]}
      height={50}
      width={250}
      type="buy"
      buttonStyle="black"
      cornerRadius={8}
      supportedNetworks={['visa', 'masterCard', 'amex']}
      merchantCapabilities={['3ds']}
      onTokenReceived={handleTokenReceived}
    />
  );
}

Props

Required Props

| Prop | Type | Description | |------|------|-------------| | merchantIdentifier | string | Your Apple Pay merchant identifier (e.g., "merchant.com.yourapp") | | countryCode | string | ISO 3166-1 alpha-2 country code (e.g., "US", "FR") | | currencyCode | string | ISO 4217 currency code (e.g., "USD", "EUR") | | amount | number | Total payment amount | | paymentSummaryItems | PaymentSummaryItem[] | List of items displayed in the payment sheet | | height | number | Button height in points | | width | number | Button width in points |

Optional Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | type | ApplePayButtonType | "plain" | Button type - determines the text displayed | | buttonStyle | ApplePayButtonStyle | "black" | Button style - determines the appearance | | cornerRadius | number | 4 | Corner radius of the button | | supportedNetworks | PaymentNetwork[] | ["visa", "masterCard"] | Supported payment networks | | merchantCapabilities | MerchantCapability[] | ["3ds"] | Merchant capabilities | | onTokenReceived | function | - | Callback when payment is authorized |

Types

ApplePayButtonType

Available button types:

| Value | Description | iOS Version | |-------|-------------|-------------| | "plain" | Apple Pay logo only | All | | "buy" | "Buy with Apple Pay" | All | | "setUp" | "Set Up Apple Pay" | All | | "inStore" | "Apple Pay" (for in-store) | All | | "donate" | "Donate with Apple Pay" | All | | "checkout" | "Check out with Apple Pay" | All | | "book" | "Book with Apple Pay" | All | | "subscribe" | "Subscribe with Apple Pay" | All | | "continue" | "Continue with Apple Pay" | All | | "reload" | "Reload with Apple Pay" | iOS 14+ | | "addMoney" | "Add Money with Apple Pay" | iOS 14+ | | "topUp" | "Top Up with Apple Pay" | iOS 14+ | | "order" | "Order with Apple Pay" | iOS 14+ | | "rent" | "Rent with Apple Pay" | iOS 14+ | | "support" | "Support with Apple Pay" | iOS 14+ | | "contribute" | "Contribute with Apple Pay" | iOS 14+ | | "tip" | "Tip with Apple Pay" | iOS 14+ |

ApplePayButtonStyle

| Value | Description | iOS Version | |-------|-------------|-------------| | "black" | Black background, white text | All | | "white" | White background, black text | All | | "whiteOutline" | White with black outline | All | | "automatic" | Adapts to dark/light mode | iOS 14+ |

PaymentNetwork

Supported payment networks:

| Value | iOS Version | |-------|-------------| | "visa" | All | | "masterCard" | All | | "amex" | All | | "discover" | All | | "chinaUnionPay" | All | | "interac" | All | | "jcb" | All | | "maestro" | iOS 12+ | | "electron" | iOS 12+ | | "cartesBancaires" | iOS 11.2+ | | "eftpos" | iOS 12+ | | "elo" | iOS 12.1.1+ | | "girocard" | iOS 14+ | | "mada" | iOS 12.1.1+ | | "mir" | iOS 14.5+ | | "bancomat" | iOS 16+ | | "bancontact" | iOS 16+ |

MerchantCapability

| Value | Description | |-------|-------------| | "3ds" | 3D Secure protocol | | "emv" | EMV protocol | | "credit" | Credit cards | | "debit" | Debit cards |

PaymentSummaryItem

type PaymentSummaryItem = {
  label: string;      // Item name displayed to user
  amount: number;     // Price of the item
  type?: "final" | "pending";  // Default: "final"
};

OnTokenReceived

The callback receives an event with:

type OnTokenReceived = {
  transactionIdentifier: string;
  paymentData: string | null;
  paymentNetwork: string | null;
  paymentMethodDisplayName: string | null;
  paymentMethodType: "debit" | "credit" | "prepaid" | "store" | "eMoney" | "unknown";
};

Handling Payment Results

After receiving the token via onTokenReceived, you need to process it on your server and then call either onTokenSuccess() or onTokenFailed() using a ref:

import { useRef } from 'react';
import { ApplePayButton, ApplePayButtonRef } from 'expo-apple-pay';

function PaymentScreen() {
  const applePayRef = useRef<ApplePayButtonRef>(null);

  const handleTokenReceived = async (event) => {
    const { paymentData, transactionIdentifier } = event.nativeEvent;
    
    try {
      // Process payment on your server
      await processPaymentOnServer(paymentData);
      
      // Notify success
      applePayRef.current?.onTokenSuccess();
    } catch (error) {
      // Notify failure
      applePayRef.current?.onTokenFailed();
    }
  };

  return (
    <ApplePayButton
      ref={applePayRef}
      // ... other props
      onTokenReceived={handleTokenReceived}
    />
  );
}

License

MIT