Embedded payment management
Allow customers to manage subscription payment methods directly on your website.
Embedded Payment Management components enable your customers to manage their payment methods (add, update, and delete) without leaving your website. By keeping the entire experience on-page, you reduce friction, maintain brand consistency, and prevent the drop-off often associated with external redirects.
When a customer clicks an Update payment method link on your site, the component initializes securely. After the customer makes changes, FastSpring automatically updates the records associated with their subscription.
Step 1: Create and customize
Use the FastSpring app to generate, configure, and style your payment components.
To create an embedded payment management component, follow the steps below.
-
In the FastSpring app, go to Developer Tools > Payment Component.
Note: If you haven’t created a Payment Management Component before, you will see a welcome page.
-
Click Create (top right).
-
At the top of the page, enter a payment-component-unique-id. This ID will be used in your code implementation.
-
Click Create. Your new component card will appear on the dashboard.
How is payment data stored?
FastSpring does not store raw credit card, PayPal, or SEPA information. Instead, we tokenize the information and store the token with the account.
Tokenization only occurs if:
- The order contains one or more automatic or managed subscriptions.
- The customer selected the Securely save payment details checkbox for a manual-renewal subscription.
Note: FastSpring does not share stored payment tokens. Customers can view the last four digits of their credit card in their portal, but only they can see it.
Customize styling
Click anywhere on a component card to open the styling editor. The editor provides a side-by-side preview of your changes. The preview is a static example and may not match the exact interactive behavior of the live component on your site.
Modal Theme
- Modal Background Color: Select the background color for the main popup window.
- Corner Radius: Define the roundness of the modal's corners (in pixels).
Text
- Font: Select the font family for all text in the component (e.g., Helvetica Neue, Arial).
- Title Text Color: Set the color for all headings.
- Body Text Color: Set the color for standard text.
- Error Message Text Color: Set the color for error alerts (e.g., expired card warnings).
Payment Method Display
- Payment Method Background Color: Background color for active payment method items.
- Payment Method Border Color: Border color for non-default payment methods.
- Payment Method Corner Radius: Roundness of the payment method list items.
- Payment Method Logos Light/Dark Mode: Toggle between Light Mode or Dark Mode for card brand logos.
- Expired Payment Method Background Color: Background color for expired payment methods.
- "Default" Payment Method Border Color: Highlight border color for the primary subscription payment method.
CTA buttons
Primary Buttons (Save/Confirm)
- Primary Button Color: Default background color.
- Primary Button Color on Hover: Background color when hovering.
- Primary Button Text Color: Text color.
- Primary Button Text Color on Hover: Text color when hovering.
Secondary Buttons (Cancel)
-
Secondary Button Color: Default background color.
-
Secondary Button Color on Hover: Background color when hovering.
-
Secondary Button Text Color: Text color.
-
Secondary Button Text Color on Hover: Text color when hovering.
-
Button Corner Radius: Roundness of the buttons (in pixels).
Links
- Link Color: Color for all clickable links.
- Link Color on Hover: Color when hovering over a link.
Input Fields
- Input Field Background Color: Background color for text entry fields.
- Input Field Border Color: Default border color.
- Input Field Border Color on Focus: Border color when the user clicks into the field.
Step 2: Implementation
Once customized, you must integrate the component into your website. This process involves whitelisting your domain for security, adding the EPML library script, and initializing the session with the customer's authenticated data.
2.1 Whitelist your domain
For security, the component will only load on domains you have explicitly approved.
- In the FastSpring app, go to Developer Tools > Payment Component. Locate the component card you want to whitelist.
- Click Implement on your component card. The Implementation page opens.
- In the Whitelist your domain text area, enter your domain(s) (e.g.,
https://www.example.com). Make sure to includehttps://at the beginning. - Click Save.
2.2 Embed the script
Copy the EPML script from the Implementation page and paste it into the header or footer of your website.
<script src="https://epml.onfastspring.com/epml/epml.min.js"
data-payment-component-id="your-unique-component-id"
id="fsc-epml">
</script>With the above script included, two methods (init and paymentManagementComponent) will be exposed in the fastspring.epml namespace.
2.3 Initialize the library
After the script loads, the fastspring.epml namespace exposes the init method. Call this method to authenticate the session.
// The parameter is the Authenticated Account Management URL
fastspring.epml.init('https://yourstore.onfastspring.com/account/{account_id}/authenticate');How to get the URL: Use the Retrieve authenticated account management URL endpoint (
/accounts/{account_id}/authenticate) to generate this link server-side.
2.4 Trigger the component
Add a subscription management link or button at an appropriate location on your site. Call the paymentManagementComponent method when the button is clicked. This method will open the embedded payment management component in a pop-up.
// Parameter 1: Subscription ID (Required)
// Parameter 2: ISO Language Code (Optional, defaults to 'en')
fastspring.epml.paymentManagementComponent('subscription-id-123', 'en');2.5 Test the component
To test the component without processing real payments, initialize the library using a test-mode URL.
- Generate the authenticated URL as described in Step 2.3.
- Modify the URL by appending
.testto your checkout subdomain.- Live:
https://yourstore.onfastspring.com/... - Test:
https://yourstore.test.onfastspring.com/...
- Live:
- Pass this test URL to the
fastspring.epml.init()method.
This loads the component in test mode, allowing you to use FastSpring test card numbers to add and update payment methods.
Customer experience
The component allows customers to view a list of all saved payment methods. The method associated with the current subscription is marked as Default and appears at the top.
-
Manage Existing: Customers can view and manage credit cards, PayPal, Amazon Pay, ACH, and SEPA accounts saved on file.
-
Add New: Customers can add new Credit Cards (global), PayPal, and Amazon Pay accounts.
Note: ACH and SEPA cannot be added as new methods here.
-
Update Default: Customers can switch their default payment method. The new default will be charged at the next rebill.
Note: ACH and SEPA cannot be set as default.
-
Edit: Update details for Credit Cards and PayPal (ACH/SEPA/Amazon Pay cannot be edited).
-
Delete: Remove unused methods. The current Default method cannot be deleted until a new default is selected.
FAQs
Why isn't the component loading on my website?
- Check the Implement tab in the Dashboard.
- Ensure your domain is whitelisted and includes
https://.
Why does the component work for some subscriptions but not others?
- The component requires an automatic or managed subscription (one with a saved payment method).
- If a customer has a manual subscription, they must first complete a renewal order and opt-in to saving their payment details.
I have a saved payment method, why won't it load?
- Verify that the
subscriptionIDpassed to thepaymentManagementComponentfunction matches the active subscription for that customer.
Updated 16 days ago