Anleitung
So nutzt du Pay in Capacitor
Verwendung von @capgo/capacitor-pay
Capacitor-Plugin, um native Zahlungen für iOS (Apple Pay) und Android (Google Pay) auszulösen.
Installieren
bun add @capgo/capacitor-pay
bunx cap sync
bunx cap sync kopiert den nativen code des Plugins in deine nativen Projekte. Nach jedem Plugin-Upgrade erneut ausführen.
Importieren
import { Pay } from '@capgo/capacitor-pay';
API auf einen Blick
| Methode | Beschreibung |
|---|---|
isPayAvailable |
Prüft, ob Native Pay auf der aktuellen Plattform verfügbar ist. Auf iOS wird Apple Pay geprüft, auf Android Google Pay. |
requestPayment |
Zeigt das native Pay-Sheet der aktuellen Plattform an. Übergib die Apple Pay Konfiguration für iOS und die Google Pay Konfiguration für Android. |
Beispiele
isPayAvailable()
Prüft, ob Native Pay auf der aktuellen Plattform verfügbar ist. Auf iOS wird Apple Pay geprüft, auf Android Google Pay.
import { Pay } from '@capgo/capacitor-pay';
const result = await Pay.isPayAvailable();
console.log(result);
requestPayment()
Zeigt das native Pay-Sheet der aktuellen Plattform an. Übergib die Apple Pay Konfiguration für iOS und die Google Pay Konfiguration für 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
Weiter mit der Verwendung von @capgo/capacitor-pay
Wenn du es nutzt Verwendung von @capgo/capacitor-pay um Zahlungen und Käufe zu planen, verbinde es mit @capgo/capacitor-pay für die Implementierungsdetails in @capgo/capacitor-pay, Erste Schritte für die Implementierungsdetails in Erste Schritte, Capgo Preise für den Produkt-Workflow auf der Preisseite von Capgo, Zahlungssystem für das Implementierungsdetail im Zahlungssystem und @capgo/native-purchases für die Implementierungsdetails in @capgo/native-purchases.