andrewculver / koudoku

Robust subscription support for Rails with Stripe.
MIT License
1.16k stars 187 forks source link

Unable to create new customer #164

Open ericgross opened 8 years ago

ericgross commented 8 years ago

I am submitting the payment-form which is being sent to Stripe, then this is being returned to SubscriptionsController#update:

{                "utf8" => "✓",
    "authenticity_token" => "E5akFRcgxk/rU1AMKdmZXzVavtuBC48nIWHomLdYoeJrh6i8A21LKrTm81QRkhxXMOoVExUJ5/D7BljHp1E62w==",
          "subscription" => {
                  "plan_id" => "3",
        "credit_card_token" => "tok_18N5V2DVs23CpRtBZoolhbpZ",
                "last_four" => "2021",
                "card_type" => "American Express"
    },
            "controller" => "koudoku/subscriptions",
                "action" => "create",
              "owner_id" => "3d726ddc-bb43-4cd3-8b83-b4f9745a6a9e"
}

I am getting this error:

Could not determine which URL to request: Stripe::Customer instance has invalid ID: nil

from Stripe::Customer#resource_url, and I see that stripe_id is nil. Any ideas what I am doing wrong?

ericgross commented 8 years ago

I guess I don't understand how we get from a token to a customer in koudoku.

ericgross commented 8 years ago

I have determined that the failing line is this: customer = Stripe::Customer.retrieve(self.stripe_id) in the subscription concern (line 125).

How is the stripe_id supposed to get set?