koudoku icon indicating copy to clipboard operation
koudoku copied to clipboard

Unable to create new customer

Open ericgross opened this issue 8 years ago • 2 comments

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 avatar Jun 16 '16 18:06 ericgross

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

ericgross avatar Jun 16 '16 19:06 ericgross

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?

ericgross avatar Jun 16 '16 19:06 ericgross