Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.lang.javascript > #8382
| X-Received | by 2002:a05:6214:1643:b0:42c:2865:d1e7 with SMTP id f3-20020a056214164300b0042c2865d1e7mr28554103qvw.52.1646403895889; Fri, 04 Mar 2022 06:24:55 -0800 (PST) |
|---|---|
| X-Received | by 2002:a0d:ec50:0:b0:2dc:1984:5eec with SMTP id r16-20020a0dec50000000b002dc19845eecmr11876906ywn.511.1646403895603; Fri, 04 Mar 2022 06:24:55 -0800 (PST) |
| Path | csiph.com!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail |
| Newsgroups | it.comp.lang.javascript |
| Date | Fri, 4 Mar 2022 06:24:55 -0800 (PST) |
| Injection-Info | google-groups.googlegroups.com; posting-host=87.5.255.128; posting-account=NVj8SAoAAABoBtIGGM_xDp1m0edQH1iG |
| NNTP-Posting-Host | 87.5.255.128 |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <6b8ee839-835d-487e-ba0f-116f2f3f0f79n@googlegroups.com> (permalink) |
| Subject | inserimento variabili su codice javascript bottone PayPal |
| From | Daniele Ferrarese <daniele.rescogitans@gmail.com> |
| Injection-Date | Fri, 04 Mar 2022 14:24:55 +0000 |
| Content-Type | text/plain; charset="UTF-8" |
| Content-Transfer-Encoding | quoted-printable |
| Xref | csiph.com it.comp.lang.javascript:8382 |
Show key headers only | View raw
Un saluto ai partecipanti al NG.
Sto tentando di inserire il codice HTML che mi fornisce PayPal, per l'inserimento del bottone nel sito ecommerce, (vedi codice)
<div id="smart-button-container">
<div style="text-align: center;">
<div id="paypal-button-container"></div>
</div>
</div>
<script src="https://www.paypal.com/sdk/js?client-id=mio_id&enable-funding=venmo¤cy=EUR" data-sdk-integration-source="button-factory"></script>
<script>
function initPayPalButton() {
paypal.Buttons({
style: {
shape: 'rect',
color: 'gold',
layout: 'vertical',
label: 'paypal',
},
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{"description":"Ordine N.","amount":{"currency_code":"EUR","value":10}}]
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(orderData) {
// Full available details
console.log('Capture result', orderData, JSON.stringify(orderData, null, 2));
// Show a success message within this page, e.g.
const element = document.getElementById('paypal-button-container');
element.innerHTML = '';
element.innerHTML = '<h3>Thank you for your payment!</h3>';
// Or go to another URL: actions.redirect('thank_you.html');
});
},
onError: function(err) {
console.log(err);
}
}).render('#paypal-button-container');
}
initPayPalButton();
</script>
tentando di sostituire la "description:Ordine N. con una variabile $_SESSION['cliente_id'], e il totale EUR 10 con una variabile $_SESSION['totale_ordine'] che si trova nella pagina di checkout. Non riesco a trovare la sintassi giusta.
Inoltre vorrei, qualora il pagamento andasse a buon fine, attivare la function "validateForm()" che invia tutti i dati dell'ordine al database per l'elaborazione.
Grazie per l'aiuto.
Cordialità
Daniele
Back to it.comp.lang.javascript | Previous | Next | Find similar
inserimento variabili su codice javascript bottone PayPal Daniele Ferrarese <daniele.rescogitans@gmail.com> - 2022-03-04 06:24 -0800
csiph-web