instacrate / instacrate-api

1 stars 0 forks source link

Stripe Id before Subscribing to Box #66

Closed jasgan closed 7 years ago

jasgan commented 7 years ago

I created a new user and the user subscribed to boxes for the first-time. This was the error:

{"error":true,"message":"User must have stripe id to subscribe to box."}

How could we fix this problem?

hhanesand commented 7 years ago

That error means that stripe doesn't know about the user's payment information yet. You need to make a call to

http://api.instacrate.co/stripe/customer/create/{token_id}

while logged in as the user who is subscribing.

jasgan commented 7 years ago

The stripe token is only created after a customer enters their credit card information and checks out. So when they checkout for the first time ever, I need to run http://api.instacrate.co/stripe/customer/create/{token_id} right before I run http://api.instacrate.me/stripe/customer/sources/{$token} correct?

But how would I know if the customer is a "first-time customer"?

hhanesand commented 7 years ago

Fixed this, so you'll only ever have to run customer/sources/{$token}