SwagPaypal und Headless

Hallo,

wir haben shopware 6 + nextjs als headless Frontend laufen. Wir nutzen das SwagPaypal Plugin, neueste Version, und versuchen, bislang ohne Erfolg, Kreditkartenzahlungen darüber abzuwickeln.
Dass das Plugin mehrere Inputfelder für KK erwartet fanden wir heraus indem wir in einer lokalen Instanz den Demostore angeschaut haben. Die Felder haben wir in unseren Checkout übernommen.

Es ist unklar welche der Daten aus den Feldern übergeben werden müssen.
Momentan sieht unsere Funktion, die das Payment startet, so aus:

const response = await fetch("/api/handle-payment", {
            method: "POST",
            headers: { "Content-Type": "application/json" },
            body: JSON.stringify({
                orderId,
                finishUrl: `${ApiConfig.frontendBasePath}/account/order/${orderDeepLink}`,
                errorUrl: `${ApiConfig.frontendBasePath}/account/order/${orderDeepLink}?paymentFailed`,
            }),
        });
        return { ...(await response.json()), type: "redirect" };

Die URL zum Starten des Zahlungsprozesses lautet:

myexampleshop.com/account/order/ORDERID?initiatePayment

und daraus wird sofort:
myexampleshop.com/aaccout/order/ORDERID?paymentFailed&error-code=CHECKOUT__SYNC_PAYMENT_PROCESS_INTERRUPTED

Die Zahlung über normales PayPal funktioniert einwandfrei.
Was fehlt um die KK-Zahlung über Paypal abwickeln zu können?

Auch in der lokalen shopware Instanz die nicht headless läuft geht die KK Zahlung nicht und Symfony schmeisst folgenden Error:

„Illegal transition „fail“ from state „98ab15432900418e8866fb38ba4be5f8“. Possible transitions are: cancel, chargeback, refund, refund_partially, reopen“

Die API-Daten sind korrekt hinterlegt, normale PP-Zahlung geht ja. Die Einstellungen im PP-Plugin zur Wahl der Redirect-Seite steht auf „Keine Präferenz“.

Vielen Dank im Voraus,

Dan

2 „Gefällt mir“

Were you able to find solution for this?

Nope. Also the docs didn’t have a hint on how to do it. One could use the PayPal SDK to integrate the checkout buttons from PayPal but that seemed too much hassle as there is the SwagPapal plugin that should already handle this.

I find it hard to believe, that we are the only ones looking to integrate credit card payment in a headless shopware system and I am stunned by the lack of answers/tips here.
I am now convincend that not many people are using shopware with a headless solution.

1 „Gefällt mir“