Payment
OneDay.Build integrates Stripe as the payment tool for your SaaS platform. Therefore, you need to register a Stripe account and thoroughly test it in Test mode before starting formal payments.
Registering a Stripe Accountβ
The first step is to register an account on the Stripe platform. You can register as an individual or as a company.
Please note that Stripe does not operate globally, so you can only register and provide the required information in specific locations. If you plan to register a Stripe account in the US as a company, you will need to provide the company's EIN (Employer Identification Number) to complete the payment setup.
During the application process, you can still use Test mode to debug the platform. The official registration is only required before the official launch.
Creating Productsβ
Create and configure products in the Stripe Dashboard. Refer to this guide for more information. you can also edit product details, upload a brand logo, set colors, etc.
Get API Keysβ
You can get the API keys and then fill in the Publishable Key
and Secret Key
in the .env
file under STRIPE_PUBLIC_KEY
and STRIPE_SECRET_KEY
respectively. In this section, there is also STRIPE_WEBHOOK_SECRET
, which is related to the functionality of webhooks.
Product Showβ
We provide a show for your products and their corresponding prices. The source file is FrontPrice.jsx
located in the Components
folder. The corresponding API file is /api/stripe/getproducts/
.
This section will display up to three product prices created in the Stripe backend.
If you want to display only one product's price and purchase button, please fill in the Price ID of that product in config.stripe.plans[0].priceId
.
Product Purchaseβ
When a user clicks the purchase button, it triggers the /api/stripe/payment/
endpoint. Here, you need to configure the success_url
and cancel_url
.
Purchase Success/Failureβ
After a successful purchase, the user will be redirected to the success page located at /checkout/success
. Here, based on the session ID
, a series of user purchase information will be retrieved, displayed, and saved in the database.