Installation

Basic setup


1. Install the plugin from NPM

npm i -S capacitor-stripe


2. Import from @capacitor/core

import { Plugins } from '@capacitor/core';

const { Stripe } = Plugins;

3. Provide your publishable key

Stripe.setPublishableKey({ key: 'Your key here' });



Android Setup


Requirements

This plugin requires @capacitor/android@2.0.0 or higher as it relies on Android X support.


Basic setup

Include the plugin in your app’s MainActivity.java file:

//
// other imports
// ...

// 1. Import Stripe plugin
import ca.zyra.capacitor.stripe.Stripe;

public class MainActivity extends BridgeActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Initializes the Bridge
        this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
            //
            // other plugins
            // ...

            // 2. Add Stripe plugin here
            add(Stripe.class);
        }});
    }
}


Google Pay

To enable payments using Google Pay you must add the following <meta-data> tag to AndroidManifest.xml inside the
main <application /> tag:

<application
  ...
  <meta-data
    android:name="com.google.android.gms.wallet.api.enabled"
    android:value="true" />
</application>

There is no need to add any Gradle dependencies as they are already included with this plugin.

Please review the steps outlined here for more details on Going live with Google Pay.



iOS Setup

To enable payments using Apple Pay you must follow the first 3 steps in this guide: