0
votes

It's not clear from the documentation but, from what I've gleaned anecdotally from others' comments and examples, the newSubscription function is supposed to:

a. take the token as created in createToken()

b. create customer in Stripe

c. associate a new subscription with that new customer

d. update Laravel databases accordingly

Is this correct? In my testing, I always get the same message:

"message": "No such customer: tok_********************",
"exception": "Stripe\Error\InvalidRequest",

because Cashier has not in fact created a Stripe user using my token.

Apologies if I'm missing something obvious. Are we supposed to use the Stripe PHP to create Customer and THEN use Cashier to associate a subscription to that customer?

1

1 Answers

0
votes

Turns out that the term "stripe_id" in the documentation, Laravel means the Stripe Customer ID (cus_1234), although I don't see that that's explicitly defined anywhere. So I was mistakenly saving the Stripe token as stripe_id (tok_1234), and then trying to add the subscription to the user later, which doesn't work. Maybe this is intuitive to people who've used Laravel extensively.