Stripe
Connect Stripe with a read-only restricted key, so your agent sees each payment and refund next to the visit and campaign it came from.
Updated
What we read
- Charges and refunds of the last 30 days, then every hour, in their own currency
- The visit a payment came from, when your site passes it in the charge's metadata
How it connects
Open Connections > Stripe in your project, paste your restricted key, and click Connect.
We check the restricted key with the vendor at once. It is kept encrypted for this project, never shown again, and deleted when you disconnect.
Requirements
- A Stripe account, and a Stripe user who can create API keys in it.
- An owner or admin of the nextanalytica project, to connect it.
How do you create the restricted key?
A restricted key can do only what you allow. Ours needs one permission, read-only.
- In the Stripe Dashboard, open Developers > API keys and click Create restricted key.
- Name it
nextanalytica. - Find Charges and Refunds and set it to Read. Leave every other permission at None.
- Click Create key, and confirm with the code Stripe sends you.
- Click the key to copy it. It starts with
rk_live_.
Then paste it in Connections > Stripe and click Connect.
What does it sync, and how often?
- Payments: each charge's amount, currency, status and description.
- Refunds that went through, each with its amount and currency.
We sync every hour and read the last 30 days again each time, since a payment can still be refunded or disputed. Amounts stay in their own currency; your agent converts them when it reads. We keep the copy for 13 months, like your visits. We never create, change or refund a payment.
How do you tie a payment to its visit?
Pass the visitor's id in the payment's metadata. Where your site creates a payment, add na_distinct_id with the same user id it passes to nextanalytica.identify(). For Checkout, set it in payment_intent_data.metadata. Add these too, if your site keeps them:
| Metadata key | What it holds |
|---|---|
na_distinct_id | The user id the site passes to identify() |
na_landing_route | The page the visit landed on |
na_utm_source | The visit's utm_source |
na_utm_campaign | The visit's utm_campaign |
A payment without na_distinct_id still counts as revenue, but your agent can't credit it to a channel. Your agent can set this up with you: open Connections > Stripe > Not set up yet? and copy the message.
Troubleshooting
"That's a secret key with full access to your Stripe account. Make a restricted key with Charges and Refunds: Read instead, and paste that."
You pasted the secret key. Create a restricted key as above and paste that.
"Stripe didn't accept this key. Copy it again, or make a new restricted key."
The key was mistyped, deleted or expired. Copy it again, or create a new one.
"This key can't read payments. Edit it in Stripe and set Charges and Refunds: Read."
In Developers > API keys, open the key's menu, click Edit key, set Charges and Refunds to Read and save. Then paste the key again.
"Stripe refused our access: connect it again"
The key was deleted or rolled in Stripe after it was connected. Create a new restricted key and paste it.