# Connect Stripe

Take card and wallet payments through Stripe: copy your keys and webhook from the Stripe Dashboard, add the account in Commerce and attach it to a payment service.

Source: https://support.rework.com/article/commerce-connect-stripe

> **In plain words:** **Stripe** is an online payment provider that takes cards and digital wallets in many currencies. Once connected, your customers pay quotes and invoices on a Stripe page, and Commerce marks them paid automatically. You need two things from Stripe: a **secret key** (proves the request comes from you) and a **webhook signing secret** (proves Stripe's payment messages are genuine). New to the payment words used here? See [Payment accounts](https://support.rework.com/article/commerce-payment-accounts) and [Commerce basics](https://support.rework.com/article/commerce-basics).

**Where to find it:** Commerce > left icon rail > **Settings** > **Accounts & integrations** > **Payment accounts**. **Who can use it:** workspace admins.

## Before you start

- A Stripe account with access to the Stripe Dashboard.
  
- A payment service in Commerce. See [Services](https://support.rework.com/article/commerce-services).
  

## Get your keys from Stripe

1. Sign in to the [Stripe Dashboard](https://dashboard.stripe.com).
   
2. Open **Developers** > **API keys**.
   
3. Copy the **Secret key** (it starts with `sk_`). You can use a **Restricted key** instead, with these permissions set to Write: Charges, Checkout, Payment Intents, Setup Intents, Customers, Payment Methods and Refunds, plus Balance set to Read.
   
4. Optionally copy the **Publishable key** too.
   

Stripe explains its keys in [API keys](https://docs.stripe.com/keys).

## Add the webhook in Stripe

A **webhook** is a message Stripe sends to Commerce when a payment succeeds or fails. Without it, payments are taken but never marked paid.

1. In Commerce, open **New account** > **Stripe** (see the next section) and click **View guideline**. Copy the **Webhook URL** with the copy button.
   
2. In the Stripe Dashboard, open **Developers** > **Webhooks** and add a destination with that URL.
   
3. Select these events: `payment_intent.succeeded`, `payment_intent.payment_failed`, `payment_intent.processing`, `payment_intent.canceled`, `checkout.session.completed`, `checkout.session.expired`, `charge.dispute.created`, `charge.dispute.closed`, `payment_method.attached`, `payment_method.detached` and `payment_method.automatically_updated`. The two dispute events tell Commerce when a customer disputes a card charge with their bank, so the dispute shows on the invoice and the owners are told. The three `payment_method` events keep the saved card current when it changes in Stripe: a new default card is used for the next charges, a removed card with no other card on the customer makes the invoices wait for a new one, and a card the bank renewed keeps its new expiry date.
   
4. Save, then reveal the **Signing secret** (it starts with `whsec_`) and copy it.
   

Stripe describes webhooks in [Webhooks](https://docs.stripe.com/webhooks).

## Add the account in Commerce

1. In Commerce, click **Settings** at the bottom of the left icon rail. Under **Accounts & integrations**, click **Payment accounts**.
   
2. Click **New account**. The **New payment account** dialog opens.
   
3. Under **Payment gateways**, click **Stripe**. The form **New Stripe account** opens.
   
4. Type a **Name** your team will recognise, for example "Stripe main".
   
5. Fill in the fields from the steps above. For Stripe these are **Secret key (sk\_…)** and **Webhook signing secret (whsec\_…)**, both required, and **Publishable key**, which is optional.
   
6. Optionally add **Owners**: people who are not admins but may manage this account.
   
7. Click **Create account**. The account appears in the table with the status **Enabled**.
   

![The New Stripe account form](https://storage.googleapis.com/reworkv3-public/success/261011/6fi1GN9Zumzw6omUa45BzJYIcuiGKBXVb9tcbMpSUCI4FNQJGmm0B146rfbg4Aam/img.VGfkUKMcMbx7b0vbLq7onYhBYFcqjeJG9qCRnHzQMhRRImiR4fhbKzvsP3pX4czS.png)

Secret fields are hidden after saving. The table shows only their last four characters. To change one later, open the account with **Edit** and type the new value. Leave a secret blank to keep the stored one.

> **Note:** The subtitle at the top of **Payment accounts** says **Live environment** or **Sandbox environment**. Use the provider's live keys in a live workspace and its test keys in a sandbox workspace.

## Let customers pay with it

An account does nothing until a **Payment service** uses it. A payment service is the folder of payments that your quotes, orders and invoices collect through. See [Payment accounts](https://support.rework.com/article/commerce-payment-accounts) for how the pieces fit.

1. Click **Payment** in the left icon rail, then the payment service in the sidebar.
   
2. Click **Service settings** at the bottom of the sidebar.
   
3. Under **Operations**, click **Payment accounts**.
   
4. Turn on **Online gateways** if it is off, then tick your **Stripe** account.
   
5. Click **Save payment accounts**.
   

## What your customer sees

When a customer clicks **Pay** on a quote, invoice or payment link, they see **Pay with Stripe** and a **Pay** button with the amount. A note explains that they are taken to Stripe's own secure page, so their card or wallet details never reach your workspace.

After paying they return to a page that says "Waiting for the payment result" and then **Payment received**. Stripe confirms the payment to Commerce in the background, and the invoice or quote shows as paid. Each attempt is listed under **Payment** > **Checkouts**. See [Online checkouts](https://support.rework.com/article/commerce-checkouts).

## Save a card for autopay

Stripe can also keep a customer's card for a subscription, so each invoice is charged automatically on its due date. Nothing extra needs connecting: the same Stripe account you attached to the payment service is used. When the customer pays a quote, order or invoice set to **Charge automatically**, the card is saved with that payment. If your restricted key is limited, it needs Customers, Setup Intents, Payment Methods and Payment Intents set to Write, which the key list above already includes. See [Autopay](https://support.rework.com/article/commerce-autopay).

## Limits to know

- Stripe accepts 34 currencies in Commerce, including USD, EUR, GBP, SGD, AUD and VND. A record in another currency cannot be paid through Stripe.
  
- Test keys and live keys are separate in Stripe. Keys from test mode only work in a sandbox workspace.
  

## Troubleshooting

| 
Problem

 | 

Why it happens

 | 

What to do

 |
| --- | --- | --- |
| 

Customers pay but the invoice stays unpaid

 | 

The webhook is missing, or the signing secret does not match

 | 

Check the webhook URL and events in Stripe, then paste the current **Signing secret** into **Webhook signing secret**

 |
| 

Stripe is not offered for a record

 | 

The record's currency is not one Stripe accepts

 | 

Use another provider or a bank transfer for that currency

 |
| 

The provider is not offered at checkout

 | 

The account is not attached to the payment service, or it is **Disabled**

 | 

Tick it under **Online gateways** in the service's **Payment accounts** settings, and check its status is **Enabled**

 |
| 

A field shows "Stored ••1234, leave blank to keep."

 | 

The secret is saved and hidden on purpose

 | 

Leave it blank to keep it, or type a new value to replace it

 |
