HEX
Server: LiteSpeed
System: Linux s917.lon1.mysecurecloudhost.com 4.18.0-477.21.1.lve.1.el8.x86_64 #1 SMP Tue Sep 5 23:08:35 UTC 2023 x86_64
User: assibfaf (3034)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/assibfaf/public_html/prox-modules/paypal/views/paypal.paper.tpl
<div class="form-container">
    <div id="payment-form">
        <div class="form-header">
            <h1 class="Header-companyName">{$siteName}</h1>
            <h2 class="Header-purchaseDescription">{$title}</h2>
        </div>
        <div class="form-body">
            <div class="js_loader flat-spinner" style="display:none;"></div>
            <div id="paypal-button-container"></div>
            <a class="back_to_order" href="/dashboard/paper/{$paper.id}/pay">Back to Order</a>
        </div>
    </div> 
</div> 

<script
    src="https://www.paypal.com/sdk/js?client-id={$paypal_client}&currency={$currency}">
</script>

<script type="text/javascript">
    paypal.Buttons({
        createOrder: function(data, actions) {
            return actions.order.create({
                purchase_units: [{
                    amount: {
                        value: '{$amount}' 
                    },
                }],
                application_context: {
                    shipping_preference: 'NO_SHIPPING',
                }
            });
        },
        onApprove: function(data, actions) {
            return actions.order.capture().then(function(payment) {
                $('#paypal-button-container').hide();
                $('.js_loader').show();
                $.ajax({
                    method: "POST",
                    url: '{$callback_url}',
                    data: { 
                        handle: 'paper',
                        nodeId: '{$paper.id}',
                        customer_id: '{$user.id}',
                        currency: '{$currency}',
                        payment_method: '{$payment_method}',
                        paymentId: payment.id,
                        payerId: payment.payer.payer_id
                    }
                })
                .done(function(response) {
                    if(response.success) {
                        window.location = '{$success_url nofilter}';
                    } else {
                        window.location = '{$decline_url nofilter}';
                    }
                });
            });
        }
    }).render('#paypal-button-container');
</script>