第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

Stripe:在向現(xiàn)有訂閱添加 subscriptionItem 時(shí)立即向客戶收費(fèi)/開(kāi)具賬單?

Stripe:在向現(xiàn)有訂閱添加 subscriptionItem 時(shí)立即向客戶收費(fèi)/開(kāi)具賬單?

慕森王 2023-02-17 10:21:31
我在一家在線課程提供商工作。這是客戶流程:student subscribe to teacherA | this creates a monthly Stripe subscription       | student is billedstudent subscribe to teacherB | this adds a subscriptionItem to the subscription | student is not billed問(wèn)題是,當(dāng)我創(chuàng)建 subscriptionItem 時(shí),不會(huì)立即向客戶收費(fèi),而是開(kāi)始免費(fèi)訪問(wèn)高級(jí)內(nèi)容。根據(jù)我在文檔中的紅色內(nèi)容,創(chuàng)建有很多訂閱讓學(xué)生訂閱教師是一個(gè)糟糕的設(shè)計(jì)(無(wú)論如何,他們將單個(gè)客戶的訂閱限制為 25 個(gè))。然后我認(rèn)為創(chuàng)建有很多 subscriptionItems 是個(gè)好主意,如果我錯(cuò)了請(qǐng)糾正我。我正在尋找一種方法來(lái)實(shí)現(xiàn)這樣的流程:每位教師的訂閱價(jià)格為 5 美元01/01 | studentA subscribe to teacherA at | billed $501/15 | studentA subscribe to teacherB at | billed $2.5 # half of remaining month02/01 | subscription auto invoice         | billed $10您知道如何實(shí)現(xiàn)這一目標(biāo)嗎?
查看完整描述

1 回答

?
慕斯王

TA貢獻(xiàn)1864條經(jīng)驗(yàn) 獲得超2個(gè)贊

為學(xué)生想要訂閱的其他教師創(chuàng)建額外的 subscriptionItems 是正確的做法。但是,正如您注意到的那樣,當(dāng)您在訂閱上創(chuàng)建訂閱項(xiàng)目時(shí),不會(huì)立即向?qū)W生收費(fèi)。默認(rèn)情況下,Stripe 會(huì)為新添加的訂閱項(xiàng)目按比例分配的金額創(chuàng)建待處理發(fā)票項(xiàng)目(例如,在您的示例中為 2.5 美元)。如果您單獨(dú)留下按比例分配的發(fā)票項(xiàng)目,它們將被捆綁到學(xué)生的下一張發(fā)票中,總計(jì)為 12.5 美元:


 - teacherB $2.5 (proration charges from last month)

 - teacherA $5

 - teacherB $5

 - total next month: $12.5

如果您不想等到下個(gè)月才向?qū)W生收費(fèi),那么您可以在添加新訂閱項(xiàng)目后立即創(chuàng)建并支付發(fā)票,從而立即向?qū)W生收費(fèi)。


在節(jié)點(diǎn)中,這看起來(lái)像:


  // Add the new subscription item for Teacher B


  await stripe.subscriptionItems.create({

    subscription: 'sub_xyz', // The subscription ID

    price: 'price_teacher_b_price', // The price for teacher B

  });


  // At this point, Stripe would have created pending invoice items.

  // Pending invoice items would by default be included in the next month's

  // invoice, but you can pull them into a new invoice immediately:


  const invoice = await stripe.invoices.create({ 

    customer: 'cus_xyz', // The customer/student

  });


  // At this point, the invoice items have been pulled into a new invoice.

  // To charge the student you need to finalize and pay the invoice. You

  // can do this in one step:


  await stripe.invoices.pay(invoice.id);


查看完整回答
反對(duì) 回復(fù) 2023-02-17
  • 1 回答
  • 0 關(guān)注
  • 183 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)