Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripe::Customer Stripe::Subscription doesn't have Card details #157

Open
n1shantshrivastava opened this issue Mar 22, 2016 · 4 comments
Open

Comments

@n1shantshrivastava
Copy link

Hi,

I have implemented the Subscription(after over-riding couple of methods). I have implemented a Basic Plan, which is free, and every User on SignUp gets subscribed to it. After that, according to the need User can upgrade to Enterprise plan (monthly/yearly).
After I completed the subscription, I tried to check the Subscription details, with their official gem. I found out, that along with the Customer, I can see the Subscription Object, but the Card object is empty in Stripe's response for the customer.

Now my question is, if it is a recurring subscription; how does koudoku handle it as there is no Card details present with the Customer Object. How it can be done without asking the User for CC details(again); and do it directly with the CreditCardToken provided by Stripe on the first go.

Thanks in advance.

@yas4891
Copy link
Collaborator

yas4891 commented Mar 22, 2016

Hi.

Can you please provide all the code you have changed?

@n1shantshrivastava
Copy link
Author

Hi @yas4891,
This is the only thing I over-wrode, as I wanted to have a basic (free) plan subscribed to User, and while canceling; they should get subscribed to PlanId equals to Basic Plan; rather than nil.

module Koudoku
class SubscriptionsController < ApplicationController
def cancel
if @subscription.plan_id != Plan.basic.id
flash[:notice] = I18n.t('koudoku.confirmations.subscription_cancelled')
@subscription.plan_id = Plan.basic.id
@subscription.save
else
flash[:notice] = 'You have to subscribe to a plan before cancelling subscription.'
end
redirect_to owner_subscription_path(@owner, @subscription)
end
end
end

@yas4891
Copy link
Collaborator

yas4891 commented Mar 23, 2016

Have you taken a look at https://github.com/andrewculver/koudoku#implementing-logging-notifications-etc ?

This is the recommended way to do it

@bsodmike
Copy link

bsodmike commented Jun 5, 2016

Hi @Nishant-Shrivastava, you can use finalize_cancelation! instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants