Comments (13)
@dackers86 I believe they turned on merge:true so this is feasible to accomplish now. The general solution for this issue is to create function triggers that watch document writes that the extension initiates. I'm fine to close this
from stripe-firebase-extensions.
Hey @leetworx, yes, the function syntax is different for normal Firebase Cloud Functions: https://firebase.google.com/docs/functions/http-events
from stripe-firebase-extensions.
Ah, so this is a distinction between cloud functions and firebase extensions? Thanks very much for the clarification - got it working!
from stripe-firebase-extensions.
@thorsten-stripe @leetworx I want to customize the create user functions so it also stores the phone number and email of the user inside the Customer document.
Shall I configure the index.js in the src folder or the index.js in the lib folder. and what is the difference between the two.
Thanks very much
from stripe-firebase-extensions.
@mshenawy22 you cannot modify the extension, but you can deploy your own additional Cloud Functions to run alongside the extension. With version 0.1.7 (to be released this week), you can disable the automatic syncing (see https://github.com/stripe/stripe-firebase-extensions/blob/next/firestore-stripe-subscriptions/CHANGELOG.md#version-017---2020-10-15) and instead you write your own function to manage the customer details in Cloud Firestore. The extension will not overwrite your customer data in Cloud Firestore but rather merge in the stripe data when needed.
from stripe-firebase-extensions.
@thorsten-stripe :
Why I can't modify the extension , if I downloaded your extension source code then added a function in the index.js that makes use of local functions and variables in the file ,then deployed that new function only , why won't this work?
Disabling the automatic syncing won't help in my case and I'm sure in many other cases .
for ex : There are two type of users, paying customer and service receiving customer. I want to create a Customer document only for the paying customer who register through a certain page on the web , hence an HTTP triggered google function is needed.if non paying customer has signed up , I don't want a stripe customer document to be created for them.
It would be great if you made the syncing function configurable , specially what triggers it .
from stripe-firebase-extensions.
@mshenawy22 sorry, this slipped through the cracks.
Why I can't modify the extension , if I downloaded your extension source code then added a function in the index.js that makes use of local functions and variables in the file ,then deployed that new function only , why won't this work?
Developing extensions is currently still in closed alpha. While the source code for the extensions is public as a reference, it is not possible for you to deploy an extension from a local code base to your Firebase project.
But you don't need to. You can simply write your own Cloud Functions to run next to the extension.
It would be great if you made the syncing function configurable , specially what triggers it .
By turning off the automatic sync of the extension, you are completely free to write your own function with your own desired trigger to create your customer documents. The extension will then create a Stripe customer object on the fly when you create the first checkout session for a given user and simply merge the Stripe specific data in your user doc. So you have complete control over how you manage your users.
from stripe-firebase-extensions.
@mshenawy22 sorry, this slipped through the cracks.
Why I can't modify the extension , if I downloaded your extension source code then added a function in the index.js that makes use of local functions and variables in the file ,then deployed that new function only , why won't this work?
Developing extensions is currently still in closed alpha. While the source code for the extensions is public as a reference, it is not possible for you to deploy an extension from a local code base to your Firebase project.
But you don't need to. You can simply write your own Cloud Functions to run next to the extension.
It would be great if you made the syncing function configurable , specially what triggers it .
By turning off the automatic sync of the extension, you are completely free to write your own function with your own desired trigger to create your customer documents. The extension will then create a Stripe customer object on the fly when you create the first checkout session for a given user and simply merge the Stripe specific data in your user doc. So you have complete control over how you manage your users.
If you look in Google Cloud Functions Reports you can see the raw files and make changes there or copy them into your IDE and work on them from there. What is great about it is they have already done the heavy lifting, so be sure to appreciate them for providing this to us. It is quite amazing.
from stripe-firebase-extensions.
from stripe-firebase-extensions.
I use a firebase function to create a product using the stripe npm package. This triggers a webhook that creates a product document in firebase.
However, I have additional data that I want to add to the product after I create it with the stripe API. To do this, I can write to a firebase using the product ID that the stripe module returns, and using 'set' with {merge:true}.
This will work fine if the webhook fires and creates the product before this line of my code executes, but if it fires after I think it will overwrite the meta data I want to add. Is it possible to turn on {merge:true} for the product creation that fires on the stripe product.created webhook?
Otherwise, a workaround is I can set these product details with a new function that triggers on firestore product document creations. This will work only if the webhook-driven product doc creation is never faster than the response from calling the Stripe API product creation function plus an unrelated document write for querying the reference later
from stripe-firebase-extensions.
@DCSnip3r I'd recommend that you add your additional data to the metadata on the product object (either when you create it or later on via an updat request), that's automatically synced to the Firestore:
from stripe-firebase-extensions.
@thorsten-stripe Does this work with data types like a firestore geopoint? This should generally work, thank you. One disadvantage is the 'stripe_metadata_' prefix. I personally would not be confused if this were removed
from stripe-firebase-extensions.
HI @DCSnip3r.
Is this issue something that needs to be consider. Or you happy for me to close?
from stripe-firebase-extensions.
Related Issues (20)
- Multiple Prices Causes "The price specified is inactive. This field only accepts active prices" error
- Is it safe to switch over to this extension? HOT 6
- Feature Request: Custom fields in Stripe Checkout HOT 4
- Unable to call createCheckoutSession: FirebaseError: Expected first argument to collection() to be a CollectionReference HOT 6
- Error: missing required param line_items[0][currency].
- Is usage based billing allowed within this extension? (question) HOT 1
- Customers are not being created in Firestore after checkouts/subscription: User not found! Error HOT 4
- Provide embedded subscription checkout form functionality
- Release new version of @invertase/firestore-stripe-payments HOT 3
- The invoice creation for payments is not fully implemented
- current_period_end update problem HOT 2
- Emulator : SyntaxError: await is only valid in async functions and the top level bodies of modules HOT 1
- Update documentation for Mobile subscriptions
- Update to node 18 or 20 -> Node 14 will be deprecated on january 31 HOT 12
- Webhook handler for Stripe event failed: User not found! HOT 6
- createCustomer is not triggered
- createPortalLink success_url HOT 1
- success_url and cancel_url not working in mobile
- CustomClaims "stripeRole" is removed on overdue subscriptions.
- Firebase stripe extension Error creating secrets HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stripe-firebase-extensions.