Checkoutで初めての決済を処理する
Stripe Checkoutを使ったシンプルな決済フローを実装し、カード情報の収集から取引完了までの流れを確認します。
「Checkoutで初めての決済を処理する」はCoddyKit上の無料Stripe Payments & SaaS Billing Systemsレッスンです。 これはレッスン3/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはStripe Payments & SaaS Billing Systems学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Stripe Payments & SaaS Billing Systemsコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
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.
よくある質問
「Checkoutで初めての決済を処理する」レッスンは無料ですか?
はい。「Checkoutで初めての決済を処理する」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Stripe Payments & SaaS Billing Systemsコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Stripe Payments & SaaS Billing Systemsコースには全4レッスンが含まれています。
「Checkoutで初めての決済を処理する」で何を学びますか?
Stripe Checkoutを使ったシンプルな決済フローを実装し、カード情報の収集から取引完了までの流れを確認します。 ブラウザで直接実行するハンズオンコードでStripe Payments & SaaS Billing Systemsを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Stripe Payments & SaaS Billing Systemsを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのStripe Payments & SaaS Billing Systemsは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン3/4です。
「Checkoutで初めての決済を処理する」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このStripe Payments & SaaS Billing Systemsレッスンでコードを書いて実行できますか?
はい。すべてのStripe Payments & SaaS Billing Systemsレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- オンライン決済エコシステムの理解
- Stripeアカウントの設定とダッシュボードツアー
- Checkoutで初めての決済を処理する
- Stripeのテストモードとテストカードを理解する