askit
askit

Reputation: 227

how to add products and prices in stripe through firestore using stripe subscription platform

I have installed Run Subscription Payments with Stripe using this tutorial: https://firebase.google.com/products/extensions/firestore-stripe-subscriptions.

Now, when I add product in stripe it gets added in Firestore:

enter image description here

Now, as you can see the product "apple" above with product-id. "prod_KWe22kb9FUWoxH" price is added in firestore below:

enter image description here

But when in the below figure, manually, I add product "app" below with product-id. "4Y2kEkf5Ks1w2PDRNzYR" prices etc. is added in firestore below, it does not get added to stripe:

enter image description here

I have also updated the rules to both read and write products as you can see in the screenshot below:

enter image description here

So, why does product "app" with product-id. "4Y2kEkf5Ks1w2PDRNzYR" and prices etc does not get added to stripe ?

Upvotes: 0

Views: 1051

Answers (2)

Warren Halderman
Warren Halderman

Reputation: 349

The data is only synced from Stripe to Firestore, not from Firestore to Stripe.

Products must be added to Stripe either through the Stripe Dashboard or the Stripe API and subsequently synced with Firestore (or whatever database is being used as a cache/backup) using webhooks (handled automatically by that Firebase extension).

NOTE: That Firebase extension is no longer maintained by Stripe, but they hired some third party (Invertase) to maintain it as a separate extension.

Upvotes: 0

According to your product that is not showing the details, it was probably added incorrectly, the product does not begin with “prod_” followed by the ID.

Stripe Product Setup: Stripe immediately generates a distinct identification for the new product, which is prefixed with prod_.

Reviewing your case I found documentation that adding the product with the issue could help.

To create a product:

Go to the Product tab in the Dashboard and click +Add product to create a product. Select a One-time or Recurring product type, then fill out the remaining fields in the product details section. When you are done, click Save and continue, or Save product at the top right.

To create prices:

After saving a newly generated product, go to the product's information page and click +Add price. You may also locate +Add price by clicking on any pre-existing product in your list.

To enter the price details in the “Add a new price window” I found the following documentation: Create prices.

The guide that I followed is Products and Prices management.

Additional tutorial using Stripe and Firebase.

Upvotes: 1

Related Questions