?? GreyFile — Mystic File Browser

Current path: home/webdevt/cryptoimpot.fr/module/Application/view/application/partial/paypal/



?? Go up: /home/webdevt/cryptoimpot.fr/module/Application/view/application/partial

?? Viewing: payment.phtml

<script src="https://www.paypal.com/sdk/js?currency=EUR&client-id=AW-AQ-qWgAsXPocQRVF8tRloDQ9eaJhujobAxaBuCC4Q3dWnjDFJ2DzJncPnl67C31cU7nj9dm5UPspO"></script>


  <div id="paypal-button-container"></div>

  <script>
      
   paypal.Buttons({
    createOrder: function(data, actions) {
      return actions.order.create({
        purchase_units: [{
          amount: {
            value: '300'
          }
        }]
      });
    },
    onApprove: function(data, actions) {
      return actions.order.capture().then(function(details) {
        //alert('Transaction completed by ' + details.payer.name.given_name);
        Swal.fire({
                        type: 'success',
                        title: 'confirmation paiement',
                        text: 'Paiement validé',
                        footer: 'Téléchargez votre déclaration fiscale'
                    }).then(function () {
                        location.reload();
                    });
        var urlRedirect = '<?= $this->url(\Application\Controller\RapportController::ROUTE_VALIDATION_COMMANDE, array('orderId' => 'ORDER_ID', 'year' => $this->year)) ?>';
        urlRedirect = urlRedirect.replace('ORDER_ID', data.orderID);
//    console.log(urlRedirect + data.orderID);
        
    window.location.replace(urlRedirect);
        
        // Call your server to save the transaction
        return fetch('/paypal-transaction-complete', {
          method: 'post',
          headers: {
            'content-type': 'application/json'
          },
          body: JSON.stringify({
            orderID: data.orderID
          })
        });
      });
    }
  }).render('#paypal-button-container');
  </script>
<!--sb-cl2j0290501@business.example.com

AW-AQ-qWgAsXPocQRVF8tRloDQ9eaJhujobAxaBuCC4Q3dWnjDFJ2DzJncPnl67C31cU7nj9dm5UPspO
EEN0hJRqFU51vcAoyTuTOI75xLsgURRj41hlnREnA9NxpFVvXCiM6NMEB6O0YHxb7LCimhO1P5JI42hT-->
<!--<script src="https://www.paypalobjects.com/api/checkout.js"></script>
<script>
  paypal.Button.render({
    // Configure environment
    env: 'sandbox',
    client: {
      sandbox: 'sb-cl2j0290501_api1.business.example.com',
      production: 'demo_production_client_id'
    },
    // Customize button (optional)
    locale: 'fr_FR',
    style: {
      size: 'small',
      color: 'gold',
      shape: 'pill',
    },

    // Enable Pay Now checkout flow (optional)
    commit: true,

    // Set up a payment
    payment: function(data, actions) {
      return actions.payment.create({
        transactions: [{
          amount: {
            total: '300',
            currency: 'EUR'
          }
        }]
      });
    },
    // Execute the payment
    onAuthorize: function(data, actions) {
      return actions.payment.execute().then(function() {
        // Show a confirmation message to the buyer
        window.alert('Thank you for your purchase!');
      });
    }
  }, '#paypal-button');

</script>-->


??

??