控制器操作中的条纹支付集成

Stripe payment integration in controller action

如果条带支付正在执行,您会如何执行该操作

我的动作控制器:

def create
    @action = Action.new(action_params)
    @action.user = current_user
    if @action.save
         redirect_to new_charge_path
    else
        render :new
    end
end

我希望我的@action.save只有在付款时才执行 完成了。

(new_charge_path为条纹路线)

如果我没理解错的话,您希望在用户付款时调用特定操作。如果那是你想要的,你需要设置 stripe webhooks.

Stripe 服务器将向您指定的 URL 发出 HTTP 请求,其中包含所有付款详细信息。为您的 create 操作提供条纹。