
Keys and IDs that you’ll need
- Your Stripe Publishable Key - grab this from the API Keys section of your Stripe Dashboard.
-
A Restricted Key generated in Stripe (also from the API Keys page in Stripe), with the following scopes/permissions:
Restricted Key - required scopes:
Customers
:Write
Payment Intents
:Write
Setup Intents
:Write
Checkout Session
:Write
Credit notes
:Read
Subscriptions
:Write
- Any Price IDs for specific products you want to offer - grab these from the Products page in Stripe.
Setting up Stripe
The following are the minimum steps required to add a Stripe component to your Embeddable:Add your Stripe credentials
- Go to Settings → Credentials & Endpoints in your Embeddables dashboard.
- In the Stripe Credentials section, click + New Stripe Credential.
- Choose the Key Type (Publishable Key or Restricted Key).
- Select the Live Environment.
- Add a Label to help identify the credential (e.g., “Stripe Live Publishable Key”).
- Enter your Value (the actual Stripe key). (See above for details on the keys to grab/generate).
- Click Create to save the credential.
Test
environment if you want to - if so, these will be used when in test mode instead of the default Embeddables-provided test keys.Add a Stripe component to your Embeddable
- In the Builder, switch to the checkout page that should contain the Stripe component.
- Select a Container to insert the Stripe component into, or a copmonent that it should be added next to.
- Open the
+
left-hand sidebar, and selectStripe
from the list of components.
Choose the type of payment you want to accept
- Under Checkout mode, select one of the following options:
- Payment: If you’re accepting only one-time payments, or want to place a hold on a user’s card.
- Setup: For setting up a user’s payment method to take payments in the future.
- Subscription: If your line items will include at least one recurring payment.
Choose which payment methods you want to accept
- Under Payment methods, select the payment methods you want to accept, from the following options:
- Credit card
- Link (Stripe’s own quick purchase login system)
- US Bank Account
- Buy now, pay later services: Afterpay/Clearpay, Klarna, Affirm
Add line items to the checkout
-
There are two different types of line item that you can add:
- Price ID: This corresponds to a product and price that you’ve already created in Stripe.
Make sure to grab the Price ID from Stripe, rather than the Product ID.How to find the Price ID
- Go to the Product Catalog section of your Stripe Dashboard.
- Select the product you want to use.
- Click on the more options (three dots) icon button in the Price that you want to use.
- Select
Copy price ID
.
- Custom line item: This lets you manually enter an amount, currency and name for the line item in Embeddables.
- Both types of line item require you to enter a quantity.
Include the customer email address (and, optionally, phone number)
- To insert the user’s given email address into the Stripe checkout, add the key name of the component you use to collect the user’s email, using Templating (e.g.
{{email}}
). - You can optionally collect a user’s phone number, using the same method.
Optional: Additional Stripe configurations
These features are not required in order to successfully accept payments, but they can be useful in different scenarios.Collect shipping information
Collect shipping information
- Address Line 1
- Address Line 2
- City
- State
- Zipcode / Postal Code
- Country
{{address_line_1}}
.Add dynamic line items
Add dynamic line items
- Use a Computed Field` to generate the JSON for the line items.
- Refernce the key of that Computed Field in the Line Items section of the Stripe component.
Set values based on dynamic data
Set values based on dynamic data
- Add an input component (like Email Input, Phone Input, etc.) to your Embeddable where you want to collect the user’s information.
- In the Stripe component settings, locate the field you want to set dynamically.
-
Use templating syntax to reference the input component’s key, e.g.
{{email}}
or{{phone}}
.
- Customer email
- Customer phone
- Shipping address fields
- Success message
Control Stripe prices from the Embeddables CMS
Control Stripe prices from the Embeddables CMS
Apply coupons and promo codes
Apply coupons and promo codes
Place a hold on the customer's card
Place a hold on the customer's card
Automatically set default payment methods in Stripe
Automatically set default payment methods in Stripe
Make sure a Customer is created in Stripe
Make sure a Customer is created in Stripe
- If Required (Default): A customer is only created if Stripe requires it for the specific payment method or transaction type.
- Always: A customer is always created in Stripe, regardless of whether it’s required for the transaction.
Add a custom success message
Add a custom success message
Choose a layout for the Stripe component
Choose a layout for the Stripe component
- Tabs (default): This displays different payment methods in separate tabs, in a horizontal row across the top of the component.
- Accordion: This displays different payment methods in an accordion of expanded and collapsed sections, with one payment method option open at a time.
Set up Apple Pay and Google Pay
Set up Apple Pay and Google Pay
Google Pay
- Enable Google Pay in your Stripe Dashboard under Payment Methods
- Once enabled, Google Pay will automatically appear as a payment option for users who:
- Are using Chrome browser
- Are logged into a Google account
- Have Google Pay set up on their account
- No additional configuration is required in Embeddables
Apple Pay
- Enable Apple Pay in your Stripe Dashboard under Payment Methods
- You must verify your domain with Apple through the Stripe Dashboard:
- Go to the Apple Pay Settings in your Stripe Dashboard
- Add and verify your domain(s) where you’ll be accepting Apple Pay
- Follow Stripe’s verification process to complete domain verification
- Once enabled and verified, Apple Pay will automatically appear as a payment option for users who:
- Are using Safari browser
- Are logged into an Apple account
- Have Apple Pay set up on their device
- No additional configuration is required in Embeddables
Set up Stripe Link
Set up Stripe Link
- Enable Stripe Link in your Stripe Dashboard under Payment Methods.
- Enable Stripe Link in Embeddables: In the Stripe component Options sidebar, select “Link” under the list of available Payment method types.
- Once enabled in both places, Stripe Link will automatically appear as a payment option for users who:
- Have a Link account (or choose to create one at checkout)
- Are using a supported browser and device
Control which payment method tabs are shown
Control which payment method tabs are shown
- Embeddables Builder: the settings your choose in the Stripe component Options sidebar.
- Stripe Dashboard Settings: the settings you choose when logged into your Stripe Dashboard.
- Credit/debit cards
- Apple Pay
- Google Pay
- Bank Account
- Link
- Afterpay/Clearpay
- Klarna
- PayPal (please note PayPal is NOT supported by Stripe in the US - for US PayPal payments, please use our dedicated PayPal component)
- When Stripe Link is enabled in your Stripe Dashboard, the Bank Account payment method will automatically appear.
- This happens even if you haven’t enabled bank transfers in Stripe’s payment methods settings.
- To completely remove the Bank Account tab, you must disable Stripe Link entirely in your Stripe Dashboard.
Trigger actions on payment events
Trigger actions on payment events
Event | Triggered when |
---|---|
Payment attempted | The user clicks the Pay button (regardless of success or failure) |
Payment successful | The payment is completed |
Payment failed | The payment is declined |
- Create a new Action and type the JavaScript code you want to run.
- Add a Trigger to the Action that fires on one of the above payment events.
Collect Stripe IDs to send to your backend
Collect Stripe IDs to send to your backend
Stripe ID | Provided for |
---|---|
Customer ID | All payment types (for Payment and Setup modes, Customer Creation must be set up Always ) |
Invoice ID | All payments except on-hold payments and collecting card details |
Payment Intent ID | One-time payments only |
Subscription ID | Recurring payments only |
To collect these IDs:
- Specify a User Data key to store the ID in, in the relevant field in the Stripe component options.
- Add that key to the Registered Keys in the Embeddable-wide settings.
To send them to your backend:
- Set up an Action that’s triggered when the payment is completed, as specified above in Trigger actions on payment events.
- Use the relevant keys in
userData
, provided in the Action function’s first argument.
Store the selected plan/product and payment status in User Data
Store the selected plan/product and payment status in User Data
Storing the plan or product
If you’re offering multiple plans or products to the user, then that probably means you’re either:- Using an Option Selector component to let the user select the plan or product they want to purchase, or
- Using a Computed Field to calculate the appropriate plan or product based on the user’s answers.
Storing the payment status
The payment status is automatically stored in User Data, using the key of the Stripe component.For this reason, we recommend choosing a straightforward key name for the Stripe component, e.g.stripe_payment
.The status will then appear in the User Data as one of the following:stripe_payment: 'fresh'
- The Stripe checkout has been reset and is ready for another attemptstripe_payment: 'pending'
- The payment has just been attempted, and is awaiting a success or failure response from Stripestripe_payment: 'error'
- The payment failedstripe_payment: 'completed'
- The payment was successful
Send custom metadata to Stripe
Send custom metadata to Stripe
- Enter a key (e.g.,
user_id
,order_source
, etc.) and a value. - You can use templating in the value field, such as
{{user_id}}
or{{email}}
, to dynamically insert user data. You can even compute a new value in a Computed Field and use that in the metadata. - Click the
+
button to add more metadata fields.
Troubleshooting
I'm getting an error about a missing publishable key
I'm getting an error about a missing publishable key
- Go to Settings → Credentials & Endpoints in your Embeddables dashboard.
- In the Stripe Credentials section, click + New Stripe Credential.
- Choose Publishable Key as the Key Type.
- Select the appropriate Environment (Test or Live).
- Add a descriptive Label and enter your Stripe publishable key.
- Click Create to save the credential.
?savvy_test=true
to your URL.I'm getting an error about a missing restricted key
I'm getting an error about a missing restricted key
- Go to Settings → Credentials & Endpoints in your Embeddables dashboard.
- In the Stripe Credentials section, click + New Stripe Credential.
- Choose Restricted Key as the Key Type.
- Select the appropriate Environment (Test or Live).
- Add a descriptive Label and enter your Stripe restricted key.
- Make sure the key has the correct permissions, listed above.
- Click Create to save the credential.
Error: You must provide one of `price` or `price_data` for each line item when using prices.
Error: You must provide one of `price` or `price_data` for each line item when using prices.
Error: No such price: 'price_xxxxxx'; a similar object exists in test mode, but a live mode key was used to make this request.
Error: No such price: 'price_xxxxxx'; a similar object exists in test mode, but a live mode key was used to make this request.
- You’re using a test mode Price ID in your Computed Field, but have not set the Embeddable to test mode.
- You’re testing on a link with
?savvy_test=true
in the URL, OR - You’re testing on a
preview.embeddables.com
link
- You’ve set the Embeddable to test mode, but the Public and Restricted keys that you gave to the Embeddables Team to use for Test Mode were actually live mode keys.
- Open the Developer Tools in your browser and go to the Elements tab.
- Use
Cmd+F
/Ctrl+F
to search fordata-flow-stripe-publishable-key-value
. - Check whether the value starts with
pk_live_
orpk_test_
.
Error: No such price: 'price_xxxxxx'
Error: No such price: 'price_xxxxxx'
I'm seeing test mode errors on a live link
I'm seeing test mode errors on a live link
- Check your project’s Stripe credentials in Settings → Credentials & Endpoints.
- If you want to test in live mode, you must add live mode keys to your project.
- If both keys are test keys, you can only test in test mode (
?savvy_test=true
).
I'm seeing live mode errors on a test link
I'm seeing live mode errors on a test link
?savvy_test=true
), it usually means that the keys you’ve added to your project are for live mode only.Fixes to try:- Check your project’s Stripe credentials in Settings → Credentials & Endpoints.
- If you want to test in test mode, you must add test mode keys to your project.
- If both keys are live keys, you can only test in live mode (remove
?savvy_test=true
from the URL).