@MeikoTech/capacitor-square-inapp-payments
Integrate with Square Payments SDK
Package Version | Capacitor Version |
---|---|
5.X | 5.X |
Install
Version 5.X is compatible with Capacitor 5.X
npm install capacitor-square-inapp-payments
npx cap sync
IOS You'll need to add your Square Application ID to your AppDelegate Square Documentation.
ANDROID Open the plugins AndroidManifest.xml and update the Square Application ID
Usage
Card details response flow - React.js example
import { CapacitorSquareInappPayments } from '@MeikoTech/capacitor-square-inapp-payments';
const Home = () => {
const startCardEntry = async () => {
await CapacitorSquareInappPayments.startCardPayment();
};
const startGooglePay = async () => {
await CapacitorSquareInappPayments.startGooglePay({
chargeAmount: '5.12',
currencyCode: 'CAD',
});
};
const startApplePay = async () => {
await CapacitorSquareInappPayments.startApplePay({
chargeAmount: '5.12',
countryCode: 'CA',
currencyCode: 'CAD',
merchantId: 'YOUR APPLE MERCHANT ID',
});
};
};
API
startCardEntry(...)
startCardEntry() => any
Returns: any
startGooglePay(...)
startGooglePay({ chargeAmount, currencyCode }) => any
Param | Type |
---|---|
options |
{ chargeAmount: string; currencyCode: string; } |
Returns: any
startApplePay(...)
startApplePay({ chargeAmount, currencyCode, countryCode, merchantId }) => any
Param | Type |
---|---|
options |
{ chargeAmount: string; currencyCode: string; countryCode: string; merchantId: string; } |
Returns: any
addListener(...)
addListener(eventName: 'cardDetailsSuccess', (cardDetails) => Promise
Param | Type |
---|---|
eventName |
"cardDetailsSuccess" |
listenerFunc |
({ paymentMethod, cardNonce, cardBrand, cardLastFour }) => void |
Returns: any
Interfaces
PluginListenerHandle
Prop | Type |
---|---|
remove |
() => any |