Nexus and FastSpring embedded checkout integration
Connect Nexus creator codes to FastSpring's embedded checkout for automatic discount and attribution handling.
Use FastSpring with Nexus to support creator-code attribution at checkout. Buyers enter a creator's code during purchase, FastSpring optionally applies a discount, and your server records the attribution in Nexus so the creator gets credit. FastSpring acts as the merchant of record for all transactions.
This page covers a working reference implementation from the FSBuilds GitHub repository, found in the fsbuilds-nexus-integration folder of the FastSpring fsBuilds examples repo. You can download it, configure your credentials, and have a functioning integration running locally in minutes.
This is a reference example, not an actively maintained SDK or library. It reflects the FastSpring and Nexus APIs as of its publish date and may not account for later changes to either platform. Check the linked documentation on this page for current behavior before building on it.
How it works
Your server acts as the bridge between FastSpring and Nexus — the two platforms never communicate directly. This keeps your Nexus private key off the browser and gives you full control over the flow.
sequenceDiagram
participant B as Buyer
participant F as Frontend
participant S as Your Server
participant N as Nexus API
participant FS as FastSpring
rect rgb(240, 253, 244)
note over B,N: 1 — Code validation
B->>F: Enters creator code
F->>S: POST /validate-code
S->>N: Validate (public key)
N-->>S: Creator name or error
S-->>F: Validation result
F-->>B: Creator message or error
end
rect rgb(255, 251, 235)
note over F,FS: 2 — Discount application (optional)
F->>FS: Apply coupon code
FS-->>F: Discount applied
end
rect rgb(245, 243, 255)
note over B,FS: 3 — Purchase & attribution
B->>FS: Completes purchase
FS-->>B: Order confirmation
FS->>S: Webhook: order.completed
S->>N: POST attribution (private key)
N-->>S: Creator credited ✓
end
The three phases in plain language: validate the code before purchase using your public key, apply a discount if the code matches a FastSpring coupon, and record the attribution after purchase using your private key.
Creator code states
A code entered at checkout can match Nexus, FastSpring, both, or neither. The following table shows what happens in each case.
| Code type | Result |
|---|---|
| Valid Nexus creator code + matching FastSpring coupon | Discount applied + "Thanks for supporting [Creator]!" message |
| Valid Nexus creator code only (no coupon) | Creator message shown, no discount |
| Valid FastSpring coupon only (not a Nexus creator) | Discount applied, no creator message |
| Matches neither Nexus nor FastSpring | Error message shown to buyer |
Prerequisites
Before you begin, make sure you have the following.
An account with an embedded checkout configured and at least one product in your catalog. Create an embedded checkout →
A publisher account with a creator program and at least one active creator code. You will need your Public Key, Private Key, and Group ID from the Developer section of your program — the Group ID also appears in Nexus API responses.
The reference server runs on Node.js. Download Node.js → or check your version with node --version.
FastSpring needs a reachable URL to send order events. Use ngrok for local testing — note your URL changes on each restart with the free plan.
Set up the integration
Project structure
The reference implementation has a minimal footprint — a frontend file, a backend file, and configuration.
fsbuilds-nexus-integration/
├── index.html # Frontend — embedded checkout, creator code input, product display
├── server.js # Backend — webhook handler, Nexus API calls
├── style.css # Styles
├── .env # Your credentials (never committed to Git)
├── .env.example # Template showing which environment variables are required
└── package.json # Node dependencies
The two files you will spend time in:
Everything the buyer sees. Uses the FastSpring SBL to render the embedded checkout and display product info. Calls your server to validate creator codes.
Everything that stays private. Receives FastSpring webhooks, validates creator codes against Nexus, and posts attributions after purchase. Your private key never leaves this file.
Test the integration
Before going live, verify your setup using FastSpring's sandbox environment.
Run a test transaction using FastSpring's sandbox environment.
-
Open your checkout at
http://localhost:3000. -
Enter a creator code and proceed to payment.
-
Complete the purchase using the following test card:
Field Value Card number 4242 4242 4242 4242Expiry Any future date CVV Found on your product page in the FastSpring dashboard -
Confirm the attribution appears in your Nexus dashboard.
To cover the full matrix, set up one code for each scenario and verify the expected result. See Creator code states for what each combination should produce.
| Code setup | Expected result |
|---|---|
| Exists in both Nexus and FastSpring (matching coupon) | Discount applied + creator message |
| Exists in Nexus only (no matching coupon) | Creator message, no discount |
| Exists in FastSpring only (not a Nexus creator) | Discount applied, no creator message |
| Matches neither | Error message shown to buyer |
Security
Public vs. private key usage
Your Nexus public key is used at code validation time (before purchase). Your private key is used at attribution time (after purchase). Both live in .env and are only ever called from your server — never from the browser.
Webhook signature verification
In production, you should verify that incoming webhooks are genuinely from FastSpring by validating the HMAC signature on each request. The reference implementation does not include this by default. See FastSpring webhook security for implementation details.
Environment variable hygiene
Never commit your .env file. The .gitignore in this repo already excludes it, but if you fork or copy this project, confirm the exclusion is in place before your first push.
Related resources
Updated about 4 hours ago
