0Pricing
Stripe Payments & SaaS Billing Systems · 课时

优惠券、折扣与促销代码

使用 Stripe 优惠券、面向客户的促销代码以及应用于订阅和发票的折扣,提高转化率和客户留存率。

优惠券、折扣与促销代码 是 CoddyKit 上的免费 Stripe Payments & SaaS Billing Systems 课时。 这是第 4 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 Stripe Payments & SaaS Billing Systems 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 Stripe Payments & SaaS Billing Systems 课程共包含 4 节课。

本课时的部分内容尚未翻译,以英文显示。

Why Discounts Matter

Discounts drive sign-ups, win-back, and loyalty. Stripe has first-class support for coupons and promotion codes on subscriptions.

Coupons vs Promotion Codes

A coupon defines the discount logic. A promotion code is a customer-facing string that points to a coupon.

  • Coupon: 20% off
  • Promo code: SAVE20

Percentage vs Amount Off

A coupon discounts either a percentage or a fixed amount in a currency.

const coupon = { percent_off: 20 };
const price = 5000;
const discounted = price * (1 - coupon.percent_off / 100);
console.log(discounted);

Duration of a Coupon

Coupons have a duration: once (one invoice), repeating (a set number of months), or forever.

Creating a Coupon

You create coupons in the dashboard or via API.

const coupon = await stripe.coupons.create({
  percent_off: 25,
  duration: 'repeating',
  duration_in_months: 3
});

Adding a Promotion Code

Wrap a coupon in a promo code so customers can type it at checkout.

const promo = await stripe.promotionCodes.create({
  coupon: coupon.id,
  code: 'SAVE25'
});

Restrictions on Promo Codes

Promotion codes can be limited: first-time customers only, a minimum order amount, a max redemption count, or an expiry date.

Applying at Checkout

Enable the promo code field in Checkout so customers can self-apply codes without code changes.

const session = await stripe.checkout.sessions.create({
  mode: 'subscription',
  allow_promotion_codes: true,
  line_items: [{ price: 'price_123', quantity: 1 }]
});

Applying to an Existing Subscription

You can attach a discount to a running subscription, useful for retention offers when someone tries to cancel.

await stripe.subscriptions.update('sub_123', {
  discounts: [{ coupon: 'coupon_abc' }]
});

Discounts and Proration

Discounts interact with proration when plans change mid-cycle. Always test the resulting invoice preview to confirm the final charge.

Tracking Redemptions

Monitor how often each promo code is used and its impact on conversion, so you can retire underperforming offers.

Quick Check

What is the difference between a coupon and a promotion code?

Recap

You learned to offer discounts in Stripe:

  • Coupons define the discount; promo codes expose it to customers
  • Percentage or amount off, with once/repeating/forever duration
  • Restrictions like first-time-only and expiry
  • Apply at checkout or to existing subscriptions for retention

常见问题解答

「优惠券、折扣与促销代码」课时是免费的吗?

是的 — 「优惠券、折扣与促销代码」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 Stripe Payments & SaaS Billing Systems 课程的其余内容,请升级到 CoddyKit PRO。 Stripe Payments & SaaS Billing Systems 课程共包含 4 节课。

「优惠券、折扣与促销代码」这节课中我会学到什么?

使用 Stripe 优惠券、面向客户的促销代码以及应用于订阅和发票的折扣,提高转化率和客户留存率。 你通过在浏览器中直接运行的动手代码来练习 Stripe Payments & SaaS Billing Systems,全天候 AI 导师会在你学习这节课的过程中回答你的问题。

学习 Stripe Payments & SaaS Billing Systems 需要有经验吗?

无需任何先前经验。CoddyKit 上的 Stripe Payments & SaaS Billing Systems 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 4 节课,共 4 节。

「优惠券、折扣与促销代码」课时需要多长时间?

大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。

我能在这节 Stripe Payments & SaaS Billing Systems 课中编写并运行代码吗?

能。每节 Stripe Payments & SaaS Billing Systems 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。

此课程中的所有课时

  1. 处理试用期与方案升级
  2. 实现按比例计费与计量计费
  3. 订阅生命周期管理与事件
  4. 优惠券、折扣与促销代码
← 返回 Stripe Payments & SaaS Billing Systems