簡體   English   中英

帶下拉欄的條紋更改訂閱

[英]Stripe change subscription with dropdown rails

我正在嘗試實現條紋更改訂閱的方法。 我對我的代碼有些困惑。 目前我有以下內容:

Subscription_controller

def changeSubscription
    @user = User.find(params[:id])
    @plan = params[:type]
    c = Stripe::Customer.retrieve(@user.stripeCustomerId)
    c.update_subscription(:plan => @plan, :prorate => true)
  end

routes.rb

post 'subscribe/change/:type' => 'subscribe#changeSubscription'

在我的編輯視圖中,我有這個偽代碼,我需要幫助以開始工作

  <div class="form-group">
    <%= collection_select(drop_down_of_subscription_types) %>
    <%= link_to "post request to 'subscribe#changeSubscription' with type sent" %>
  </div>

使用submit_tag呈現表單的提交按鈕。

link_tobutton_to不起作用

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM