# Stripe (Tokenized) Module

https://docs.wisecp.com/de/stripe-tokenized-module

Take card payments on your own checkout form through Stripe, and let clients keep a card for later payments and automatic renewals.

## Reaching the Screen

Go to **Settings → Financial → Payment Gateways**, open **All Modules** and click the **Stripe (Tokenized)** card: `{admin}/modules/payment?module=StripeTokenized`

Adding the gateway to the method list clients see is covered in [Payment Modules](https://docs.wisecp.com/en/payment-modules).

## What Is on the Screen

One short settings form: the Stripe key pair, the notification signing secret and the shared gateway settings every module carries.

The client types the card into your own checkout form. Stripe charges it, and a card that needs 3-D verification moves the client to the bank and returns to your site. Card numbers are turned into a Stripe token, so your install never keeps the number or the security code.

The module also stores cards for later use and charges a stored card automatically. From the invoice screen it refunds only a charge that closed several invoices; see Tasks. It does not open subscriptions and does not offer installments.

## Before You Configure It

- A Stripe account with its key pair. Test keys and live keys are two separate pairs.
- The currencies you sell in enabled on the Stripe account.
- For stored cards and automatic renewal payments, this module selected under **Card Storage Module** in **Initial Settings**.

## Fields

- **API Key**: The publishable key of the pair. Required.
- **Secret Key**: The secret key of the same pair. Every charge, refund and stored-card action uses it. Required.
- **Signing Secret**: The signing secret of a Stripe webhook. This module does not use webhooks at all: leave it empty and add no notification endpoint at Stripe. The result comes from the card form and the 3-D return.
- **Test Mode**: Makes the card lookup on the payment form answer with fixed test values instead of the real issuer. It does not decide which Stripe environment answers a charge: that depends only on the key pair you enter. On by default.

**Status**, **Commission Rate (%)**, **Converting Currency**, **Accepted Amount Range** and the country lists work the same way in every gateway. See [Payment Modules](https://docs.wisecp.com/en/payment-modules). **Callback URL**, **Success URL** and **Failed URL** cannot be edited: copy them with the icon at the end of the field.

## Tasks

### Take the keys from Stripe

1. Sign in to the Stripe dashboard. For test keys switch to a sandbox from the account picker; for real payments stay in live mode.
2. Open the **Developers** menu, click **Workbench** and go to **API keys**.
3. Copy the publishable key and the secret key from **Standard keys**. Sandbox keys start with `pk_test_` and `sk_test_`, live keys with `pk_live_` and `sk_live_`.
4. In live mode a secret key you created is shown once. When it is lost, roll it from the same page and copy the new value.

### Enter the credentials

1. Open the module card and tick **Status**. The other fields stay locked until you do.
2. Fill in **API Key** and **Secret Key**, and set **Test Mode** to match the pair you used.
3. Click **Save Changes**. The card form is now available to clients who pick this method.

### Let clients keep their card

1. Go back to **Settings → Financial → Payment Gateways** and open **Initial Settings**.
2. Choose **Stripe (Tokenized)** under **Card Storage Module** and click **Save Changes**.
3. Clients can now add a card from their account, pick a stored card at checkout and turn on automatic payment.

### What the client goes through

1. The client selects the card method at checkout, on an invoice or when adding funds.
2. The client types the card details, or picks a card kept earlier.
3. If the bank asks for 3-D verification, the client confirms it and comes back to your site.
4. The charge closes the invoice and the service is activated.

### Charge renewals from a stored card

1. The client turns on automatic payment for a stored card in their account.
2. On a due renewal invoice the system uses account balance first, then the stored cards in the client's order of preference.
3. A successful charge closes the invoice. When every card fails, the client receives the failed-payment notification and the invoice stays open.

### Refund a payment

1. Open the paid invoice: `{admin}/invoices/detail?id={invoice}`
2. When one charge closed several invoices, change the status to **Refunded**, choose **Refund via payment gateway** and confirm. Each invoice returns its own share.
3. A charge that closed a single invoice cannot be refunded through the module in the current version. The request fails and the status does not change. Refund it from the Stripe dashboard, then mark the invoice **Refunded** with **Add as expense**.

## Things to Watch

> **A saved card starts with a charge that is not refunded**
> 
> Storing a card runs a charge of 1 US dollar through Stripe to prove the card works and return the token. It is always in US dollars, whatever the client is billed in, unless you selected a **Converting Currency**. Nothing refunds it: the amount stays collected until you refund it yourself from the Stripe dashboard. Clients see it on their statement, so tell them about it where you invite them to store a card.

> **Deleting a card removes it at Stripe**
> 
> The card row keeps only the token and the last four digits. Removing the card detaches the token at Stripe, so any automatic payment that relied on it stops working.

> **Test Mode only changes the card lookup on the form**
> 
> While it is ticked, the bank and brand shown next to the card number come back as fixed test values instead of the real issuer. The charge itself and the card details written to the vault come from Stripe, so neither carries those test values. Untick it with live keys so your operators read real issuer information.

## Required Privileges

**Payment Module Settings** (`MODULES_PAYMENT_SETTINGS`) is required.

## Related Articles

- [Payment Modules](https://docs.wisecp.com/en/payment-modules)
- [Invoice Detail Overview](https://docs.wisecp.com/en/invoice-detail-overview)
- [Module Management](https://docs.wisecp.com/en/module-management)
