Anleitung
Verwenden Sie Pay in Capacitor
Verwendung von @capgo/capacitor-pay
Das Capacitor-Plugin zum Auslösen von nativen Zahlungen für iOS (Apple Pay) und Android (Google Pay).
Installieren
bun add @capgo/capacitor-pay
bunx cap sync
bunx cap sync kopiert das native code-Plugin in Ihre native Projekte. Führen Sie es erneut aus, nachdem jede Plugin-Upgrade durchgeführt wurde.
Importieren
import { Pay } from '@capgo/capacitor-pay';
API im Überblick
| Methode | Beschreibung |
|---|---|
isPayAvailable |
Überprüft, ob native Pay auf der aktuellen Plattform verfügbar ist. Auf iOS wird Apple Pay und auf Android Google Pay bewertet. |
requestPayment |
Präsentiert das native Pay-Blatt für die aktuelle Plattform. Bereitstellen Sie die Apple Pay-Konfiguration auf iOS und die Google Pay-Konfiguration auf Android. |
Beispiele
isPayAvailable()
Überprüft, ob native Pay auf der aktuellen Plattform verfügbar ist. Auf iOS wird Apple Pay und auf Android Google Pay bewertet.
import { Pay } from '@capgo/capacitor-pay';
const result = await Pay.isPayAvailable();
console.log(result);
requestPayment()
Präsentiert das native Pay-Blatt für die aktuelle Plattform. Bereitstellen Sie die Apple Pay-Konfiguration auf iOS und die Google Pay-Konfiguration auf 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.
Vollständige Referenz
Weitermachen von Using @capgo/capacitor-pay
Wenn Sie native Pay verwenden Mit @capgo/capacitor-pay um Zahlungen und Kaufabschlüsse zu planen und es mit @capgo/capacitor-pay zur Implementierungsdetail in @capgo/capacitor-pay, Anleitung zum Starten zur Implementierungsdetail in Anleitung zum Starten, Capgo Preisgestaltung zur Produktworkflow in Capgo Preisgestaltung, Zahlungssystem zur Implementierungsdetail in Zahlungssystem, und @capgo/native-purchases zur Implementierungsdetail in @capgo/native-purchases.