Skip to main content
@capgo/capacitor-pay Commerce Open source

Pay Capacitor plugin

Accept payments with Apple Pay and Google Pay for seamless checkout experience

Install

bun add @capgo/capacitor-pay bunx cap sync
npm, pnpm or yarn
  • npm install @capgo/capacitor-pay
  • pnpm add @capgo/capacitor-pay
  • yarn add @capgo/capacitor-pay

Guide

How to use Pay in Capacitor

Using @capgo/capacitor-pay

Capacitor plugin to trigger native payment for iOS(Apple pay) and Android(Google Pay).

Install

bun add @capgo/capacitor-pay
bunx cap sync

bunx cap sync copies the plugin's native code into your native projects. Run it again after every plugin upgrade.

Import

import { Pay } from '@capgo/capacitor-pay';

API at a glance

Method Description
isPayAvailable Checks whether native pay is available on the current platform. On iOS this evaluates Apple Pay, on Android it evaluates Google Pay.
requestPayment Presents the native pay sheet for the current platform. Provide the Apple Pay configuration on iOS and the Google Pay configuration on Android.

Examples

isPayAvailable()

Checks whether native pay is available on the current platform. On iOS this evaluates Apple Pay, on Android it evaluates Google Pay.

import { Pay } from '@capgo/capacitor-pay';

const result = await Pay.isPayAvailable();
console.log(result);

requestPayment()

Presents the native pay sheet for the current platform. Provide the Apple Pay configuration on iOS and the Google Pay configuration on Android.

import { Pay } from '@capgo/capacitor-pay';

const result = await Pay.requestPayment({
  apple: {
    merchantIdentifier: 'merchant-identifier-123',
    countryCode: 'US',
    currencyCode: 'USD',
    paymentSummaryItems: [
      {
        label: 'Hello from Capacitor',
        amount: 'amount',
      },
    ],
    supportedNetworks: ['AmEx'],
  },
});
// The result holds sensitive values: use it without logging it.

Full reference

Keep going from Using @capgo/capacitor-pay

If you are using Using @capgo/capacitor-pay to plan payments and purchases, connect it with @capgo/capacitor-pay for the implementation detail in @capgo/capacitor-pay, Getting Started for the implementation detail in Getting Started, Capgo Pricing for the product workflow in Capgo Pricing, Payment system for the implementation detail in Payment system, and @capgo/native-purchases for the implementation detail in @capgo/native-purchases.

FAQ

Pay plugin FAQ

How do I install the Pay plugin in a Capacitor app?

Run "bun add @capgo/capacitor-pay" (or "npm install @capgo/capacitor-pay"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-pay" in your app code.

Does @capgo/capacitor-pay work with React, Vue and Angular?

Yes. Pay is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

Which Capacitor version does @capgo/capacitor-pay support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

Is @capgo/capacitor-pay free and open source?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-pay/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Can I update code that uses Pay without an App Store review?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

Ship Pay changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo