0Pricing
Stripe Payments & SaaS Billing Systems · 강의

Stripe Subscriptions API 입문

반복 결제의 핵심 개념과 Stripe의 Subscriptions API를 활용한 견고한 SaaS 구독 관리 방법을 살펴봅니다.

Stripe Subscriptions API 입문은(는) CoddyKit의 무료 Stripe Payments & SaaS Billing Systems 강의입니다. 이것은 4개 중 1번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Stripe Payments & SaaS Billing Systems 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Stripe Payments & SaaS Billing Systems 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

Welcome to Subscriptions!

Ever wondered how Netflix, Spotify, or your favorite SaaS app charges you regularly? That's recurring billing, powered by subscriptions!

In this lesson, we'll dive into how Stripe helps you build robust subscription services for your business.

Why Recurring Payments?

Subscriptions are key for many businesses, especially for Software as a Service (SaaS) models. They provide:

  • Predictable Revenue: Stable income streams.
  • Customer Loyalty: Encourages long-term relationships.
  • Simplified Billing: Automates regular charges.

Stripe's Subscriptions API makes setting this up straightforward.

Stripe's Core Subscription Building Blocks

Stripe uses a few key concepts to manage subscriptions:

  • Products: What you sell (e.g., 'Basic Plan', 'Premium Tier').
  • Prices: How much and how often you charge for a Product (e.g., '$10/month', '$100/year').
  • Customers: The individuals or businesses subscribing.
  • Subscriptions: The ongoing agreement between a Customer and a Price.

Understanding Products

A Product in Stripe represents something you sell. Think of it as the core offering.

For example, if you offer a 'Standard' and 'Pro' tier for your app, these would be two separate Products.

Products hold general information like a name and description, but not the actual price.

Defining Prices for Products

A Price defines how you charge for a Product. A single Product can have multiple Prices.

For example, your 'Pro' Product might have:

  • A 'Monthly' Price of $29.
  • An 'Annual' Price of $299.

Prices specify the currency, amount, and billing interval (e.g., day, week, month, year).

The Subscription Flow: High-Level

To create a subscription, you generally follow these steps:

  1. Create a Customer: Represent the user in Stripe.
  2. Collect Payment Method: Securely get card details (covered in other lessons).
  3. Create a Subscription: Link the Customer to a Price.

Stripe handles the recurring billing automatically after that!

API Example: Creating a Customer

Before a customer can subscribe, they need to exist in Stripe. Here's a basic Java example to create a Customer object:

Run this code to see a new customer ID generated!

import com.stripe.Stripe;
import com.stripe.model.Customer;
import com.stripe.param.CustomerCreateParams;

public class Main {
  public static void main(String[] args) {
    Stripe.apiKey = "sk_test_YOUR_SECRET_KEY"; // Replace

    try {
      CustomerCreateParams params =
        CustomerCreateParams.builder()
          .setEmail("testuser@example.com")
          .setName("Test User")
          .build();
      Customer customer = Customer.create(params);
      System.out.println(
        "New Customer ID: " + customer.getId()
      );
    } catch (Exception e) {
      System.out.println("Error: " + e.getMessage());
    }
  }
}

API Example: Creating a Subscription

Once you have a Customer and a Price (which you'd create via the dashboard or API, covered in Lesson 2), you can create a Subscription.

Note: Replace cus_... and price_... with actual IDs from your Stripe account.

import com.stripe.Stripe;
import com.stripe.model.Subscription;
import com.stripe.param.SubscriptionCreateParams;

public class Main {
  public static void main(String[] args) {
    Stripe.apiKey = "sk_test_YOUR_SECRET_KEY"; // Replace

    try {
      SubscriptionCreateParams params =
        SubscriptionCreateParams.builder()
          .setCustomer("cus_YOUR_CUSTOMER_ID") // From step 1
          .addItem(
            SubscriptionCreateParams.Item.builder()
              .setPrice("price_YOUR_PRICE_ID") // Your plan's price
              .build()
          )
          .build();
      Subscription subscription =
        Subscription.create(params);
      System.out.println(
        "Subscription ID: " + subscription.getId()
      );
    } catch (Exception e) {
      System.out.println("Error: " + e.getMessage());
    }
  }
}

Subscription Statuses

Subscriptions have different statuses reflecting their state:

  • active: The customer is currently subscribed and being billed.
  • past_due: A payment failed, and the subscription is awaiting a new payment.
  • canceled: The subscription has ended.
  • trialing: The customer is in a trial period (no charge yet).

Understanding these helps manage customer access.

Quick Check: Subscription Basics

Which of the following is responsible for defining how much and how often a customer is charged for a subscription?

Recap: Intro to Subscriptions

Great job! You've learned the fundamental concepts of Stripe Subscriptions:

  • The value of recurring payments for SaaS.
  • Stripe's core building blocks: Products, Prices, Customers, and Subscriptions.
  • The basic API flow for creating a customer and a subscription.
  • Key subscription statuses.

Next, we'll learn how to create and manage Products and Prices in detail!

자주 묻는 질문

“Stripe Subscriptions API 입문” 강의는 무료인가요?

네 — “Stripe Subscriptions API 입문” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Stripe Payments & SaaS Billing Systems 강의 전체를 잠금 해제할 수 있습니다. Stripe Payments & SaaS Billing Systems 강의에는 총 4개의 강의가 포함되어 있습니다.

“Stripe Subscriptions API 입문”에서 뭘 배우나요?

반복 결제의 핵심 개념과 Stripe의 Subscriptions API를 활용한 견고한 SaaS 구독 관리 방법을 살펴봅니다. 브라우저에서 직접 실행하는 실습 코드로 Stripe Payments & SaaS Billing Systems을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

Stripe Payments & SaaS Billing Systems을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 Stripe Payments & SaaS Billing Systems은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 1번째 강의입니다.

“Stripe Subscriptions API 입문” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 Stripe Payments & SaaS Billing Systems 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 Stripe Payments & SaaS Billing Systems 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. Stripe Subscriptions API 입문
  2. 요금제용 상품과 가격 만들기
  3. 고객 포털과 기본 청구 관리
  4. 실패한 결제와 추심 처리
← Stripe Payments & SaaS Billing Systems(으)로 돌아가기