Elaborare il primo pagamento con Checkout
Implementi un semplice flusso di pagamento usando Stripe Checkout, mostrando come raccogliere i dati della carta e completare una transazione.
Elaborare il primo pagamento con Checkout è una lezione Stripe Payments & SaaS Billing Systems gratuita su CoddyKit. Questa è la lezione 3 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Stripe Payments & SaaS Billing Systems, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Stripe Payments & SaaS Billing Systems include 4 lezioni in totale.
Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.
Welcome to Stripe Checkout!
Stripe Checkout is a pre-built, hosted payment page. Stripe handles the hard parts — security and compliance — so you never touch raw card details.
How Stripe Checkout Works
How Checkout works: your server creates a session, the customer is redirected to Stripe's secure page to pay, then sent back to your site afterward.
The Checkout Session Object
The Checkout Session object describes the payment: the line_items being bought, the mode, and the success and cancel redirect URLs.
Setting Up Your Server
To create a session you need a small server (Node, Python, Ruby, PHP, etc). Install the Stripe library and init it with your secret key — never expose it client-side.
Creating a Checkout Session
Here's how to create a one-time Checkout Session on your server. Swap in your real secret key; it prints the session ID and URL.
const stripe = require('stripe')('sk_test_YOUR_SECRET_KEY');
async function createCheckoutSession() {
try {
const session = await stripe.checkout.sessions.create({
line_items: [
{
price_data: {
currency: 'usd',
product_data: {
name: 'CoddyKit Course',
},
unit_amount: 1999, // $19.99
},
quantity: 1,
},
],
mode: 'payment',
success_url: 'https://example.com/success?session_id={CHECKOUT_SESSION_ID}',
cancel_url: 'https://example.com/cancel',
});
console.log('Checkout Session created:');
console.log(' ID:', session.id);
console.log(' URL:', session.url);
} catch (error) {
console.error('Error creating Checkout Session:', error.message);
}
}
createCheckoutSession();Redirecting to Checkout
The server returns a session.url; your client then redirects the user there with window.location.href = session.url to reach Stripe's secure page.
Handling Success & Cancel
After paying or cancelling, the customer returns to your success_url or cancel_url. The success URL can carry the session ID for confirmation.
Retrieving Session Details
On the success page, use the session_id to retrieve the full session on your server. That confirms payment status before you fulfill the order.
Security & PCI Compliance
Checkout's big win is security: Stripe handles all card data, your server never sees card numbers, and your PCI compliance burden drops dramatically.
Quick Check
Which of the following are key benefits or features of using Stripe Checkout for processing payments?
Recap: Your First Payment
Recap: Stripe Checkout is a hosted page driven by a session object you create server-side, then a redirect, post-payment handling, and big security wins.
Impara Stripe Payments & SaaS Billing Systems con un tutor IA — gratis
Scrivi ed esegui vero codice nel tuo browser, ricevi aiuto istantaneo da un tutor IA disponibile 24/7, e riprendi da dove hai lasciato sul web o nell'app.
- Corsi
- 12
- Lezioni
- 48
Domande Frequenti
La lezione «Elaborare il primo pagamento con Checkout» è gratuita?
Sì — il testo completo di «Elaborare il primo pagamento con Checkout» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Stripe Payments & SaaS Billing Systems, passa a CoddyKit PRO. Il corso Stripe Payments & SaaS Billing Systems include 4 lezioni in totale.
Cosa imparerò in «Elaborare il primo pagamento con Checkout»?
Implementi un semplice flusso di pagamento usando Stripe Checkout, mostrando come raccogliere i dati della carta e completare una transazione. Eserciti Stripe Payments & SaaS Billing Systems con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.
Ho bisogno di esperienza per iniziare Stripe Payments & SaaS Billing Systems?
Non è richiesta alcuna esperienza precedente. Stripe Payments & SaaS Billing Systems su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 3 di 4.
Quanto tempo richiede la lezione «Elaborare il primo pagamento con Checkout»?
La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.
Posso scrivere ed eseguire codice in questa lezione Stripe Payments & SaaS Billing Systems?
Sì. Ogni lezione Stripe Payments & SaaS Billing Systems include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.
Tutte le lezioni di questo corso
- Comprendere gli ecosistemi dei pagamenti online
- Configurazione dell'account Stripe e panoramica della dashboard
- Elaborare il primo pagamento con Checkout
- Comprendere la modalità di test e le carte di test di Stripe