In Germany there is a payment method called giropay.
Unfortunately, when I integrate them one-to-one according to the PayPal documentation, an error occurs.
The giroypay button is rendered normally. However, after I click on it, it loads briefly, jumps to PayPal, and then logs in the console that the order was canceled. Can anyone explain why this is happening?
<script src="https://www.paypal.com/sdk/js?client-id=<?= $env['paypal_client_id'] ?>&components=buttons,payment-fields,marks,funding-eligibility&enable-funding=giropay¤cy=EUR"></script><div id="giropay-btn"></div><script>paypal.Buttons({ fundingSource: paypal.FUNDING.GIROPAY, style: { label: "pay", }, createOrder() { return fetch("/my-server/create-paypal-order", { method: "POST", headers: {"Content-Type": "application/json", }, }) .then((response) => response.json()) .then((order) => order.id); }, onCancel(data, actions) { console.log(`Order Canceled - ID: ${data.orderID}`); }, onError(err) { console.error(err); }}).render("#giropay-btn");</script>
If I leave out the fundingSource: paypal.FUNDING.GIROPAY,
in my code, the normal PayPal buttons, among other things, are correctly rendered; the payment then works with giropay.