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 Payment-Optionen auf der aktuellen Plattform verfügbar sind. Auf iOS wird Apple Pay, auf Android Google Pay geprüft. |
requestPayment |
Öffnet das native Payment-Sheet der aktuellen Plattform. Erfordert die Apple Pay Konfiguration für iOS bzw. die Google Pay Konfiguration für Android. |
Beispiele
isPayAvailable()
Prüft, ob native Payment-Optionen auf der aktuellen Plattform verfügbar sind. Auf iOS wird Apple Pay, auf Android Google Pay geprüft.
import { Pay } from '@capgo/capacitor-pay';
const result = await Pay.isPayAvailable();
console.log(result);
requestPayment()
Öffnet das native Payment-Sheet der aktuellen Plattform. Erfordert die Apple Pay Konfiguration für iOS bzw. 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 Nutzung 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 Details zur Implementierung in @capgo/capacitor-pay, Erste Schritte für die Implementierungsdetails in Erste Schritte, Capgo Preise für den Produkt-Workflow in Capgo Preise, Zahlungssystem für die Implementierungsdetails im Zahlungssystem, und @capgo/native-purchases für die Implementierungsdetails in @capgo/native-purchases.