gringotts icon indicating copy to clipboard operation
gringotts copied to clipboard

Stripe Gateway: "Must provide source or customer."

Open danieljaouen opened this issue 5 years ago • 2 comments

I am trying to use the Stripe gateway. However, I am seeing an error that I cannot resolve:

no case clause matching: %{"error" => %{"code" => "parameter_missing", "doc_url" => "https://stripe.com/docs/error-codes/parameter-missing", "message" => "Must provide source or customer.", "type" => "invalid_request_error"}}

It seems to revolve around this Must provide source or customer. error.

Any help?

danieljaouen avatar Nov 28 '19 05:11 danieljaouen

I've gotten a bit further with this issue. Apparently Gringotts.store returns a map containing an id for a customer, but it doesn't save the card it was called with (the cards entry in the returned map has %{"count" => 0}.

The error I see now is: Cannot charge a customer that has no active card

As far as I can tell, Gringotts.store is storing neither the credit card nor the address I'm feeding into it. Is this a bug?

danieljaouen avatar Nov 28 '19 14:11 danieljaouen

Ideally, Gringotts.store would store both the credit card (as the customer's default) and the address in a new customer, and Gringotts.unstore would fetch the customer_id, the credit card, and the address (perhaps in a map?), and then subsequently delete the customer via Stripe's API.

Then Gringotts.authorize and Gringotts.capture would just take an additional [customer: customer_id] in the opts list.

danieljaouen avatar Nov 28 '19 15:11 danieljaouen