Set Up Stripe
Connect your Stripe account to EverShop, so customers can pay by card at checkout.
Before you start
- You need a Stripe account in a country that Stripe supports.
- Stripe reports each payment to your store with a webhook: a message to a web address of your store. This address must be public and start with
https://. - Start with test keys from a Stripe sandbox. Switch to live keys when your test orders work. See Test Payments Before Going Live.
- Take the API keys and the webhook signing secret from the same place. Use all sandbox values or all live values. Do not mix them.
- The keys show as plain text in Setting › Payment Setting. Anyone who can open this page in your admin panel can read them.
Get your keys and add the webhook in Stripe
Do these steps in your Stripe Dashboard, on Stripe's website. Stripe can rename its menus. If a name below does not match, see Stripe's guides to API keys and webhooks.
Copy your Stripe API keys
API keys (application programming interface keys) are the codes that let EverShop work with your Stripe account.
- Sign in to the Stripe Dashboard. Open your sandbox to test, or live mode to take real payments.
- Open the API keys page.
- Under Standard keys, copy the Publishable key. It starts with
pk_test_(sandbox) orpk_live_(live mode). - Copy the Secret key. It starts with
sk_test_orsk_live_. In live mode, click Reveal live key first. A live secret key that you create yourself shows only once.
Add the Stripe webhook
- In the Stripe Dashboard, open Workbench and select the Webhooks tab.
- Create a new event destination. Choose to receive the events of your own account, not of connected accounts.
- If Stripe asks for the payload format, choose Snapshot. For the API version, you can keep your account's default version.
- Select these five events:
payment_intent.succeeded,payment_intent.amount_capturable_updated,payment_intent.payment_failed,payment_intent.canceledandcharge.refunded. See What the Stripe webhook does. - Choose a webhook endpoint as the destination type. In Endpoint URL, enter your store address followed by
/api/stripe/webhook. For example:https://www.example.com/api/stripe/webhook. - Create the destination. On its page, reveal the signing secret and copy it. It starts with
whsec_.
A sandbox and live mode each need their own webhook destination. Each destination has its own signing secret.
Turn on Stripe in EverShop
-
Go to Setting › Payment Setting.
-
In the Stripe Payment card, set Enable? to Yes.
-
Optional: in Display Name, enter the name customers see at checkout. The default is "Credit Card".
-
In Publishable Key, paste the publishable key.
-
In Secret Key, paste the secret key.
-
In Webhook Secret Key, paste the signing secret of the webhook.
-
In Payment mode, choose Capture or Authorize only. See Choose the payment mode.
-
Click Save at the bottom of the page. The message "Payment setting saved" appears.
Stripe now shows at checkout. Place a test order to make sure the keys work: see Test Payments Before Going Live.
Choose the payment mode
The Payment mode in the Stripe Payment card decides when Stripe takes the customer's money.
- Capture (the default): Stripe takes the money at checkout. The payment status of the order becomes Captured.
- Authorize only: Stripe holds the money on the customer's card, but does not take it. The payment status becomes Authorized. You take the money later with Capture Payment on the order page. See Capture a Payment.
With Authorize only, capture each order before the hold expires. For most online card payments, a hold lasts 7 days. See Stripe's guide to holding a payment. When a hold expires, Stripe cancels the payment, and the webhook makes the order Canceled.
Not every payment method can hold money. With Authorize only, the Stripe payment form shows only the methods that can, such as cards.
A new payment mode applies to orders placed after you save. Orders placed before keep their payment status.
What the Stripe webhook does
A webhook is a message that Stripe sends to your store when something happens to a payment. The Stripe webhook is how EverShop learns that a customer paid.
| Stripe event | What EverShop does |
|---|---|
payment_intent.succeeded | Stripe took the money. The payment status becomes Captured. Activities gets the line "Payment captured by using Stripe. Transaction ID: …". EverShop sends the customer the order confirmation email. |
payment_intent.amount_capturable_updated | Stripe holds the money (Authorize only). The payment status becomes Authorized. Activities gets the line "Payment authorized by using Stripe. Transaction ID: …". EverShop sends the customer the order confirmation email. |
payment_intent.payment_failed | The payment failed. If the order is still Pending, its payment status becomes Failed. Activities shows the reason from Stripe. |
payment_intent.canceled | Stripe canceled the payment, for example because a hold expired. The payment status and the order status become Canceled. |
charge.refunded | Money was refunded. A refund that you make in the Stripe Dashboard also shows on the order. See Refund an Order. |
EverShop checks each message with the Webhook Secret Key. EverShop refuses a message that fails the check, and the order does not change.
Without the Stripe webhook
- A paid order stays Pending, and the customer gets no order confirmation email.
- Every 15 minutes, EverShop asks Stripe about Stripe orders that are more than one hour old and still unpaid. If the customer paid, EverShop records the payment then and sends the confirmation email. So a paid order can wait more than an hour.
- Refunds that you make in the Stripe Dashboard do not show on the order.
Test keys and live keys
The keys decide between test and live payments. Test keys from a Stripe sandbox start with pk_test_ and sk_test_, and no real money moves. Live keys start with pk_live_ and sk_live_, and customers pay real money. With a test Publishable Key, checkout shows a box with a Stripe test card above the payment form. Orders paid with test keys are marked as paid, but you receive no money. To test and then go live, see Test Payments Before Going Live.
What happens when a customer pays with Stripe
- The order comes first. The customer clicks Pay with Stripe, and EverShop creates the order before Stripe takes the money. The order appears in Sale › Orders at once, as Pending. Stock goes down at that moment.
- Extra checks. The customer's bank can ask for 3D Secure (3DS): an extra check, such as a code by text message. Some payment methods send the customer to their bank's website. Stripe then sends the customer back to your store.
- Payment accepted. The customer sees the order confirmation page. The webhook then sets the payment status.
- Slow payment methods. Some methods, such as bank debits, take days. The order stays Pending until Stripe confirms the payment. The customer gets the order confirmation email only then.
- Payment failed. If the card is declined, the customer returns to their cart and sees "Payment failed". The cart still has their items. The failed order stays in your order list with the payment status Failed. Each new try creates a new order.
- Customer left. The customer closed the page during 3D Secure or on the bank's website. The order stays Pending.
EverShop cancels failed and abandoned Stripe orders by itself, about one hour after they were created. Their items go back to stock. See Orders canceled automatically.
Currencies and minimum amounts
Stripe charges the customer in your store currency: the Currency in Setting › Store Setting. Your Stripe account must accept this currency. EverShop sends each amount in the form that Stripe expects. This includes currencies without decimals, such as JPY, and currencies with three decimals, such as KWD. You do not need to set anything.
Stripe has a minimum amount for each payment, for example 0.50 USD, 0.50 EUR or 50 JPY. A customer cannot pay a smaller order total with Stripe, and checkout shows an error: see the checkout error. See Stripe's list of minimum amounts.
What your customers see
- Payment step. Stripe shows with your Display Name and the Visa and Mastercard logos. Stripe does not show when the order total is 0.
- Payment form. When the customer chooses Stripe, a payment form from Stripe opens with the card fields. It also offers the other payment methods you turned on in Stripe that fit the customer's currency and device. See payment methods in the Dashboard.
- Wallets. Apple Pay and Google Pay can show on devices that support them. Register your store's domain in Stripe for them. Apple Pay does not show without it. See Register domains for payment methods.
- Button. The checkout button reads Pay with Stripe, then Processing Payment... while EverShop creates the order.
- After paying. The order confirmation page says "Thank you for your order!" and shows your Display Name as the payment method.
Settings on this page
| Card | Field | What it does | Default |
|---|---|---|---|
| Stripe Payment | Enable? | Yes shows Stripe at checkout. | No |
| Stripe Payment | Display Name | Shows at checkout, on the order confirmation page and in the payment card of the admin order page. Each order keeps the name it was placed with. | Credit Card |
| Stripe Payment | Publishable Key | Loads the Stripe payment form in the customer's browser. Starts with pk_test_ or pk_live_. | Empty |
| Stripe Payment | Secret Key | Lets EverShop create, capture, cancel and refund payments, and check unpaid orders. Starts with sk_test_ or sk_live_. Never shown on your storefront. | Empty |
| Stripe Payment | Webhook Secret Key | Lets EverShop check that each webhook message comes from Stripe. Starts with whsec_. | Empty |
| Stripe Payment | Payment mode | Capture takes the money at checkout. Authorize only holds it until you capture it. See Choose the payment mode. | Capture |
Troubleshooting
Why does a paid Stripe order stay Pending?
The Stripe webhook did not reach your store, or EverShop refused it. In the Stripe Dashboard, open your webhook destination in Workbench and select its Event deliveries tab. Look for a failed delivery with status 400. If its response starts with "Webhook Error: No signatures found matching the expected signature", the Webhook Secret Key is wrong. Then check:
- The endpoint address starts with your store's public
https://address and ends with/api/stripe/webhook. - The Webhook Secret Key in EverShop is the signing secret of this destination.
- The destination and your API keys are in the same sandbox, or both in live mode.
- The five events in Add the Stripe webhook are selected, and the payload format is Snapshot.
Until the webhook works, EverShop still records a paid order, but only after about an hour. See Without the Stripe webhook.
Why does checkout show "Some error occurred. Please try again later."?
EverShop created the order, but Stripe refused to start the payment. The most common cause is a wrong, expired or empty Secret Key. Other causes are an order total below Stripe's minimum, or a currency that your Stripe account does not accept.
Next steps
- Test Payments Before Going LivePlace test orders, then switch to live keys.
- Capture a PaymentTake the money for an authorized Stripe payment.
- Refund an OrderGive a customer all or part of their money back.
- Set Up PayPalOffer PayPal next to Stripe at checkout.
For developers
To see how the Stripe module works, see Integrate with Stripe Payment Gateway. The keys and the Enable? status can also come from the store configuration (system.stripe), which overrides the Stripe Payment card: see Admin settings.