将 Chargify(托管)与 Rails 应用程序集成

发布于 2024-12-05 10:32:17 字数 700 浏览 0 评论 0原文

我正在尝试将 Chargify 的托管计费与我的 Rails 应用程序集成,但遇到了一些困难。

我正在关注本教程: http://blog.formedfunction.com/post/4022209767/how-to-integrate-chargify-hosted- payment-pages-with-a

从那时起我是个菜鸟,我在这里遇到了一个问题:

     def self.product_id(plan)
       # your own logic to retrieve the Chargify product ID for
       # the plan in question (hint: I store mine in the DB)
     end

基本上这只是将 URL 连接到正确的 Chargify 托管页面...即每个计划都有一个 6 位数的 ID,具体取决于他们点击的计划定价页面,应该将它们带到 chargify.com/#{self.product_id(plan)}

我确信有一个简单的解决方案,但我现在无法理解它。

提前致谢。

I'm trying to integrated Chargify's hosted billing with my rails app and am running into some difficulties.

I'm following this tutorial: http://blog.formedfunction.com/post/4022209767/how-to-integrate-chargify-hosted-payment-pages-with-a

And since I'm a total noob, I'm running into a problem here:

     def self.product_id(plan)
       # your own logic to retrieve the Chargify product ID for
       # the plan in question (hint: I store mine in the DB)
     end

Basically this is just to connect the URLs to the proper Chargify hosted page... i.e. each plan has a 6 digit ID, and depending on which plan they click on the pricing page, they should be taken to chargify.com/#{self.product_id(plan)}

I'm sure there is a simple solution, I just can't wrap my head around it right now.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

原野 2024-12-12 10:32:17

我相信 Ryan 将他的 Golf Trac 计划存储在他的数据库中,其中有一个类似于“chargify_product_id”的列,他要么手动填写该列(您可以在 Chargify UI 的“产品”选项卡下找到产品 ID),要么通过查询 API 填写。因此,第一步是在您自己的应用程序中创建产品或计划的概念,并手动或通过 API 使您的产品与 Chargify 设置保持同步。注意:如果您选择的话,这实际上可以像应用程序中的常量一样简单,即

SMALL_PLAN=123456
MEDIUM_PLAN=123457

当用户在您的网站上选择一个计划时,您将“查找”Chargify 产品 ID,以便您可以将它们发送到正确的托管页面,通过他的 hosted_signup_page_for 方法。

I believe that Ryan stores his plans for Golf Trac in his database with a column like "chargify_product_id" that he either filled in manually (you can find the Product ID in the Chargify UI under the "Products" tab) or by querying the API. So the first step would be to create the notion of a product or plan in your own app, and keep your offerings in sync with your Chargify setup either manually or via the API. Note: this really could be as simple as a constant in your app, if you choose, i.e.

SMALL_PLAN=123456
MEDIUM_PLAN=123457

When a user selects a plan on your site, you would then "lookup" the Chargify Product ID so that you could send them to the proper hosted page, via his hosted_signup_page_for method.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文