Storing completed payment information from the new 'Pay link or button' PayPal integration

21 views Asked by At

In my PayPal (merchant) sandbox site, I've generated the code to integrate PayPal buttons on my website:

<script src="https://www.paypal.com/sdk/js?client-id=myClientId&components=hosted-buttons&disable-funding=venmo&currency=EUR"></script>
<div id="paypal-container-foobar"></div>
<script>
  paypal.HostedButtons({
    hostedButtonId: "MYHOSTEDBUTTONSID",
  }).render("#paypal-container-foobar")
</script>

When I click "PayPal" the popup is shown. I can pay the amount with my customer sandbox account. A transaction is created, but I cannot find any resource or documentation on how to check that the payment was completed to communicate with my server and store data about the transaction.

1

There are 1 answers

0
Preston PHX On

The "Pay link or button" solution from www.paypal.com/buttons is intended for simple HTML pages—not servers with a backend that will store data.

To record completed (captured) payments with a backend, integrate standard checkout instead and use the immediate API response of success/failure before propagating the result to the client side JS (which then shows a thank you or error message)