OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

PayPal GIROPAY is cancelling automaticly the orders

  • Thread starter Thread starter ABJ
  • Start date Start date
A

ABJ

Guest
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.

any ideas?

My Code:

Code:
<script src="https://www.paypal.com/sdk/js?client-id=<?= $env['paypal_client_id'] ?>&components=buttons,payment-fields,marks,funding-eligibility&enable-funding=giropay&currency=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 and, among other things, giropay are rendered. Then payment works with giropay.

<p>In Germany there is a payment method called giropay.</p>
<p>Unfortunately, when I integrate them one-to-one according to the Paypal documentation, an error occurs.</p>
<p>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.</p>
<p>any ideas?</p>
<p>My Code:</p>
<pre><code><script src="https://www.paypal.com/sdk/js?client-id=<?= $env['paypal_client_id'] ?>&components=buttons,payment-fields,marks,funding-eligibility&enable-funding=giropay&currency=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>
</code></pre>
<p>If I leave out the <code>fundingSource: paypal.FUNDING.GIROPAY,</code> in my code, the normal paypal buttons and, among other things, giropay are rendered. Then payment works with giropay.</p>
 
Top