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 🙏

© 2025 – Pkg Stats / Ryan Hefner

expo-samsung-pay

v0.1.16

Published

Samsung pay using expo modules api

Readme

expo-samsung-pay

A React Native Expo module that enables Samsung Pay integration for Android applications.

Features

  • Check Samsung Pay availability
  • Initiate Samsung Pay payments
  • Customizable payment button component
  • Support for multiple payment brands (VISA, MASTERCARD, AMEX, DISCOVER, MADA)
  • TypeScript support

Installation

1. Install the package

npm install expo-samsung-pay

2. Download Samsung Pay SDK

Important: This module requires the Samsung Pay Android SDK to function properly.

  1. Visit the Samsung Pay Developer Portal
  2. Download the Samsung Pay Android SDK
  3. Extract the SDK and locate the samsungpay.jar file
  4. Place the JAR file in your project (recommended: ./libs/samsungpay.jar)

3. Configure your app

Add the plugin to your app.json or app.config.js:

{
  "expo": {
    "plugins": [
      [
        "expo-samsung-pay",
        {
          "aarPath": "./libs/samsungpay.jar"
        }
      ]
    ]
  }
}

Note: Update the aarPath to match where you placed the Samsung Pay SDK JAR file.

4. Rebuild your app

Since this involves native code changes, you'll need to rebuild your app:

npx expo run:android

API Reference

Functions

canMakePayments(serviceId: string): Promise<boolean>

Checks if Samsung Pay is available and can make payments on the device.

import { canMakePayments } from 'expo-samsung-pay';

const checkAvailability = async () => {
  const isAvailable = await canMakePayments('YOUR_SERVICE_ID');
  console.log('Samsung Pay available:', isAvailable);
};

initiatePayment(options: SamsungPayOptions): Promise<void>

Initiates a Samsung Pay payment with the specified options.

import { initiatePayment } from 'expo-samsung-pay';

const makePayment = async () => {
  try {
    await initiatePayment({
      serviceId: 'YOUR_SERVICE_ID',
      merchantName: 'Your Store',
      orderNumber: 'ORDER123',
      merchantCountryCode: 'US',
      amount: 1000, // Amount in cents
      items: [
        {
          id: 'item1',
          name: 'Product Name',
          amount: 1000,
          description: 'Product description'
        }
      ],
      supportedBrands: ['VISA', 'MASTERCARD']
    });
  } catch (error) {
    console.error('Payment failed:', error);
  }
};

Components

SamsungPayButton

A pre-built button component that handles Samsung Pay integration.

import { SamsungPayButton } from 'expo-samsung-pay';

<SamsungPayButton
  serviceId="YOUR_SERVICE_ID"
  merchantName="Your Store"
  orderNumber="ORDER123"
  merchantCountryCode="US"
  amount={1000}
  items={[
    {
      id: 'item1',
      name: 'Product Name',
      amount: 1000,
      description: 'Product description'
    }
  ]}
  type="pay" // 'pay', 'buy', or 'checkout'
  style="black" // 'black', 'white', or 'color'
  onPaymentCompleted={(result) => {
    console.log('Payment completed:', result);
  }}
  onPaymentFailed={(error) => {
    console.log('Payment failed:', error);
  }}
/>

Types

SamsungPayOptions

type SamsungPayOptions = {
  serviceId: string;
  merchantName: string;
  orderNumber: string;
  merchantCountryCode: string;
  amount: number;
  supportedBrands?: SupportedBrand[];
  items: Array<{
    id: string;
    name: string;
    amount: number;
    description?: string;
  }>;
};

SupportedBrand

type SupportedBrand = 'VISA' | 'MASTERCARD' | 'AMEX' | 'DISCOVER' | 'MADA';

PaymentStatus

type PaymentStatus = {
  status: 'success' | 'error';
  credential?: string;
  errorCode?: number;
  errorDescription?: string;
};

ButtonOptions

type ButtonOptions = {
  type?: 'pay' | 'buy' | 'checkout';
  style?: 'black' | 'white' | 'color';
  radius?: number;
  isDisabled?: boolean;
  isLoading?: boolean;
};

Complete Example

import React, { useEffect, useState } from 'react';
import { View, Text, Alert } from 'react-native';
import { canMakePayments, SamsungPayButton } from 'expo-samsung-pay';

const SERVICE_ID = 'YOUR_SERVICE_ID';
const MERCHANT_NAME = 'Your Store Name';
const MERCHANT_COUNTRY_CODE = 'US';

export default function PaymentScreen() {
  const [canUseSamsungPay, setCanUseSamsungPay] = useState(false);

  useEffect(() => {
    checkSamsungPayAvailability();
  }, []);

  const checkSamsungPayAvailability = async () => {
    try {
      const isAvailable = await canMakePayments(SERVICE_ID);
      setCanUseSamsungPay(isAvailable);
    } catch (error) {
      console.error('Error checking Samsung Pay availability:', error);
    }
  };

  const handlePaymentCompleted = (result) => {
    Alert.alert('Success', 'Payment completed successfully!');
    console.log('Payment result:', result);
  };

  const handlePaymentFailed = (error) => {
    Alert.alert('Error', `Payment failed: ${error.errorDescription}`);
    console.error('Payment error:', error);
  };

  return (
    <View style={{ padding: 20 }}>
      <Text>Samsung Pay Status: {canUseSamsungPay ? 'Available' : 'Not Available'}</Text>
      
      {canUseSamsungPay && (
        <SamsungPayButton
          serviceId={SERVICE_ID}
          merchantName={MERCHANT_NAME}
          orderNumber={`ORDER-${Date.now()}`}
          merchantCountryCode={MERCHANT_COUNTRY_CODE}
          amount={2500} // $25.00
          items={[
            {
              id: 'product1',
              name: 'Sample Product',
              amount: 2500,
              description: 'A sample product for testing'
            }
          ]}
          supportedBrands={['VISA', 'MASTERCARD', 'AMEX']}
          type="buy"
          style="black"
          onPaymentCompleted={handlePaymentCompleted}
          onPaymentFailed={handlePaymentFailed}
        />
      )}
    </View>
  );
}

Platform Support

  • ✅ Android
  • ❌ iOS (Samsung Pay is Android-only)

The module automatically returns false for canMakePayments() on iOS and renders nothing for the SamsungPayButton component.

Requirements

  • Expo SDK 49+
  • Android API level 23+ (Android 6.0)
  • Samsung device with Samsung Pay installed
  • Valid Samsung Pay service ID from Samsung Developer Portal

Getting a Service ID

  1. Register at Samsung Pay Developer Portal
  2. Create a new service
  3. Complete the service configuration
  4. Obtain your Service ID for production use

Troubleshooting

"Samsung Pay AAR file not found" Error

Make sure you've downloaded the Samsung Pay SDK and placed the JAR file in the correct location specified in your app.json configuration.

Samsung Pay Not Available

  • Ensure the device is a Samsung device
  • Verify Samsung Pay is installed and set up
  • Check that the device meets minimum requirements
  • Confirm your Service ID is valid

Build Errors

  • Make sure you've run npx expo run:android after adding the plugin
  • Clean your build cache: npx expo run:android --clear
  • Verify the Samsung Pay SDK JAR file is accessible

Contributing

Contributions are welcome! Please read the contributing guidelines before submitting pull requests.

License

MIT

Support

For issues related to: