การสร้างผลิตภัณฑ์และราคาสำหรับแผนบริการ
เรียนรู้การกำหนดและจัดการผลิตภัณฑ์กับรูปแบบราคาที่เกี่ยวข้อง เช่น รายเดือนและรายปีใน Stripe
การสร้างผลิตภัณฑ์และราคาสำหรับแผนบริการ เป็นบทเรียน Stripe Payments & SaaS Billing Systems ฟรีบน CoddyKit นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Stripe Payments & SaaS Billing Systems และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Stripe Payments & SaaS Billing Systems มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
Intro to Products & Prices
Welcome to creating your subscription service! A key step is defining what you sell and how much it costs.
In Stripe, you'll use two main concepts for this: Products and Prices.
Think of them as the building blocks for any item or service you want to charge for, especially for recurring subscriptions.
What is a Stripe Product?
A Product in Stripe represents the core item or service you're offering. It's the 'what' you're selling.
- It holds general information like the product's name (e.g., 'Pro Plan', 'Premium Support').
- It can also include a description and optional images.
- A product itself doesn't have a price; it's just the definition of the offering.
For subscriptions, a product often represents a specific tier or plan.
What is a Stripe Price?
A Price in Stripe defines how much a product costs and how it's billed. This is the 'how much' and 'how often' of your offering.
- It specifies the amount (e.g., $10.00).
- It defines the currency (e.g., USD, EUR).
- Crucially for subscriptions, it sets the billing interval (e.g., monthly, yearly).
A single product can have multiple prices (e.g., monthly vs. yearly options for the same 'Pro Plan').
Product-Price Relationship
Products and Prices work together. A product is like a blueprint, and prices are the specific ways you can sell that blueprint.
For example:
- Product: 'Premium Software Plan'
- Price 1: $29.99 USD per month
- Price 2: $299.99 USD per year
Both prices are linked to the same 'Premium Software Plan' product, offering different billing frequencies to your customers.
Creating a Product via API
While you can create products in the Stripe Dashboard, using the API gives you programmatic control. Let's create a simple product using Python:
Note: This code demonstrates the API call structure. It requires a real Stripe API key to actually create resources.
import stripe
# Set your secret API key (replace with your actual key)
# stripe.api_key = 'sk_test_YOUR_STRIPE_SECRET_KEY'
def main():
print("--- Creating a Stripe Product ---")
print("This code shows how to define a product.")
print("It requires a valid API key to run successfully.")
try:
# Simulate the API call
print("\nCalling stripe.Product.create(...)")
# product = stripe.Product.create(
# name='Basic SaaS Plan',
# description='Our entry-level software subscription.',
# type='service'
# )
# print(f"Product created with ID: {product.id}")
print(" name='Basic SaaS Plan',")
print(" description='Our entry-level software subscription.',")
print(" type='service'")
print("(If successful, Stripe would return a product ID like 'prod_ABCXYZ')")
except Exception as e:
print(f"\nError: {e}")
print("Please ensure your API key is correctly set.")
if __name__ == "__main__":
main()Creating a Recurring Price (API)
Now that we have a product, let's create a recurring price for it. This price will define the monthly cost.
You'll need the id of the product you just created (or an existing one). Let's assume 'prod_ABCXYZ' for our example.
import stripe
# Set your secret API key (replace with your actual key)
# stripe.api_key = 'sk_test_YOUR_STRIPE_SECRET_KEY'
def main():
print("--- Creating a Recurring Price ---")
print("This code shows how to define a monthly price for a product.")
print("It requires a valid API key to run successfully.")
product_id = 'prod_ABCXYZ' # Use your actual product ID here
try:
# Simulate the API call
print(f"\nCalling stripe.Price.create(...) for product {product_id}")
# price = stripe.Price.create(
# unit_amount=1000, # $10.00 (in cents)
# currency='usd',
# recurring={'interval': 'month'},
# product=product_id
# )
# print(f"Price created with ID: {price.id}")
print(" unit_amount=1000, # $10.00 (in cents)")
print(" currency='usd',")
print(" recurring={'interval': 'month'},")
print(f" product='{product_id}'")
print("(If successful, Stripe would return a price ID like 'price_123DEF')")
except Exception as e:
print(f"\nError: {e}")
print("Ensure your API key and product ID are correct.")
if __name__ == "__main__":
main()Different Billing Intervals
Stripe's pricing allows for flexible billing intervals to suit various subscription models:
month: Billed every month.year: Billed every year.week: Billed every week.day: Billed every day (less common for SaaS, but available).
You specify the interval within the recurring object when creating a price.
Dashboard vs. API Management
You have two primary ways to manage your products and prices:
- Stripe Dashboard: Great for initial setup, viewing existing items, and making manual changes. Go to 'Products' in your dashboard.
- Stripe API: Essential for automation, integrating with your application, and dynamic price creation (e.g., for different customer segments).
For a scalable subscription service, the API will be your primary tool for management.
Best Practices & IDs
When defining products and prices:
- Clear Naming: Use descriptive names for your products and prices.
- Product Type: For subscriptions, usually set
type='service'. - Price IDs: Stripe assigns unique IDs (e.g.,
prod_ABCXYZ,price_123DEF). Store these IDs in your application's database to reference them when creating subscriptions.
These IDs are crucial for linking your customers to the correct subscription plans.
Check Your Knowledge
Let's test your understanding of Stripe products and prices.
Recap: Products & Prices
Great job! In this lesson, you learned the foundational concepts of Stripe Products and Prices:
- Products define the items or services you sell (e.g., 'Basic Plan').
- Prices define the cost, currency, and billing frequency for a product (e.g., '$10/month USD').
- You can create and manage both using the Stripe API for programmatic control.
Understanding these concepts is crucial for building any subscription-based business with Stripe. Next, you'll learn how to let customers manage these subscriptions!
เรียนรู้ Stripe Payments & SaaS Billing Systems ด้วย AI tutor — ฟรี
เขียนและเรียกใช้โค้ดจริงในเบราว์เซอร์ของคุณ รับความช่วยเหลือทันทีจาก AI tutor 24/7 และเรียนรู้ต่อจากที่คุณหยุดบนเว็บหรือในแอป
- คอร์ส
- 12
- บทเรียน
- 48
คำถามที่พบบ่อย
บทเรียน “การสร้างผลิตภัณฑ์และราคาสำหรับแผนบริการ” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “การสร้างผลิตภัณฑ์และราคาสำหรับแผนบริการ” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Stripe Payments & SaaS Billing Systems ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Stripe Payments & SaaS Billing Systems มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “การสร้างผลิตภัณฑ์และราคาสำหรับแผนบริการ”
เรียนรู้การกำหนดและจัดการผลิตภัณฑ์กับรูปแบบราคาที่เกี่ยวข้อง เช่น รายเดือนและรายปีใน Stripe คุณปฏิบัติ Stripe Payments & SaaS Billing Systems ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Stripe Payments & SaaS Billing Systems หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน Stripe Payments & SaaS Billing Systems บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน
บทเรียน “การสร้างผลิตภัณฑ์และราคาสำหรับแผนบริการ” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Stripe Payments & SaaS Billing Systems นี้ได้ไหม
ได้ บทเรียน Stripe Payments & SaaS Billing Systems ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- บทนำสู่ Stripe Subscriptions API
- การสร้างผลิตภัณฑ์และราคาสำหรับแผนบริการ
- พอร์ทัลลูกค้าและการจัดการการเรียกเก็บเงินเบื้องต้น
- การจัดการการชำระเงินล้มเหลวและการติดตามหนี้