Stripe
Stripe One-Time Invoice
For one-time jobs (like contract development), you can create an invoice and mail to the client. They have several payment options and this seems to work well for international clients specifically. Just be aware of the transaction fee.
- Sample Data: October 26, 2022 - Invoice $1000; Fee: $43.30 (4.33%)
Stripe Test Credit Card
4242 4242 4242 4242
- https://stripe.com/docs/testing
Firebase Stripe Extension
- Create a Restricted Key (Instructions are on the extension)
- Write Access: Customers, Checkout Sessions, Customer Portal
- Read Access: Subscriptions
- Install The Extension in Firebase (
Run Payments with Stripe
)- Products and Pricing Plans Collection:
products
- Customer Details and Subscription Collection:
users
- Stripe Configuration Collection:
stripe_configuration
- Sync
- Do not delete
- Put restricted key. Click "Create Secret"
- Products and Pricing Plans Collection:
- Update Security Rules
- Extension will give you some suggested rules
- Make sure to use
/users
instead of/customers
- Don't just overwrite your existing rules. Integrate these into your existing ones
- For example, I just added this at the bottom (I removed one of the lines from /users):
/** Stripe Integration Rules **/
match /users/{uid} {
match /checkout_sessions/{id} {
allow read, write: if request.auth.uid == uid;
}
match /subscriptions/{id} {
allow read: if request.auth.uid == uid;
}
match /payments/{id} {
allow read: if request.auth.uid == uid;
}
}
/** Stripe Integration Rules **/
match /products/{id} {
allow read: if true;
match /prices/{id} {
allow read: if true;
}
match /tax_rates/{id} {
allow read: if true;
}
}
- For example, I just added this at the bottom (I removed one of the lines from /users):
- Configure Webhook
- In Stripe, "Add Endpoint"
- Use the URL from the extension
- Add all events from the extension documentation
- Get the "Signing Secret"
- Reconfigure extension and paste Signing Secret into Firebase
- Create Stripe Product
- Make sure extension is reconfigured and completed first
- In Stripe, "Add Product"
- Make a note of the Price ID for later
- You should see a new
/products
node in your Firestore - Need to make a version in both
live
andtest
environemnts
- Update Customer Portal
- Settings > Billing > Portal
- Allow customers to cancel subscriptions at end of billing period
- Allow customers to update their payment methods
- Allow customers to switch to a different pricing plan
- Add links to TOS and Privacy Policy
- Update Branding
- Settings > Branding
- Set colors, etc.
- UI
npm install --save @stripe/react-stripe-js @stripe/stripe-js