Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

lat4732's avatar
Level 12

Confused about server-side SDK of PayPal

Hello everyone! Currently I'm integrating PayPal payment into my project, but I'm confused about something. Everything works fine and I'm glad to see it is working, but somehow my sixth sense tells me to create a server-side SDK request instead of the current client-side. Here's what I've done so far:

paypal.Buttons({
    style: {
    layout:  'vertical',
    color:   'blue',
    shape:   'rect',
    label:   'pay',
}, createOrder: function(data, actions) {

        return actions.order.create({

            purchase_units: [{

            amount: {
                description: '{{ $setup->plan->name }}',
                value: '{{ $setup->plan->price }}'

            }

            }],
            application_context: {
                shipping_preference: 'NO_SHIPPING'
            }

        });

}, onApprove: function(data, actions) {

    return actions.order.capture().then(function(orderData) {

        alert('successfull payment');

}).render('#paypal-button-container');

and everything works great, but I want to create a server-side intent because I somehow feel it more secure. Can someone explain me how can I easily either check the transaction within this javascript code if it is completed successfully and the user paid the exact price for the goods or create a server-side intent for the payment so I can prevent users from manually edit the price? The documentation is way too difficult to understand for me that's why I asked my question here.

0 likes
2 replies
jlrdw's avatar

Been some time since I used paypal, but I suggest play (test) what you need in their sandbox. And I suggest following paypals documentation on setting up things. Accepting payments use their guides, don't try to "customize".

furqanDev's avatar

I would recommend you to go fully backend as it is payment related stuff. You don't know what type of user will be visiting the site.

You can use package to do all the stuff heavy stuff. Just read the documentation and implement it. It is simple and easy and you don' have to look up for most of the stuff. First one is the article if you want a thorough explanation then read the article which is using the same package from github as I pasted in the second link.

https://www.positronx.io/how-to-integrate-paypal-payment-gateway-in-laravel/

https://github.com/srmklive/laravel-paypal

Please or to participate in this conversation.