stripe-samples / firebase-subscription-payments

Example web client for the `firestore-stripe-subscriptions` Firebase Extension using Stripe Checkout and the Stripe Customer Portal.
https://stripe-subs-ext.web.app/
MIT License
289 stars 78 forks source link

Invalid API Code #7

Closed emaggy closed 4 years ago

emaggy commented 4 years ago

Been stuck on an issue for the last couple of days. Unable to complete the payment process. Gives an invalid API error for my restricted key: image

Also, 401 error produced in the console. As shown below:

image

{ error: { message: "You did not provide an API key. You need to provide your API key in the Authorization header, using Bearer auth (e.g. 'Authorization: Bearer YOUR_SECRET_KEY'). See https://stripe.com/docs/api#authentication for details, or we can help at https://support.stripe.com/.", type: "invalid_request_error" } }

Have also tried to use my publishable key instead of the restricted key but an error is produced on the index.html page when trying to select subscription: image

Expected Behaviour

Complete subscription process and access the my-subscriptions/customer portal pages. No error is shown when I use the demo publishable key used in the example.

thorsten-stripe commented 4 years ago

Can you provide more context on where these screenshots where taken from?

The restricted key is not to be used in the code, only in the Firebase extension. In the client code the publishable key needs to be used: https://github.com/stripe-samples/firebase-subscription-payments#configure-the-example-web-client

thorsten-stripe commented 4 years ago

Closing this due to inactivity, feel free to reopen if you can append more information.