Skip to content
OpenCart · User manual

Stripe Payments PRO

Version 1.2.1 Product page
Chapter 5

Stripe connection

How to get your Stripe secret keys, register the webhook that notifies your store of each payment, and save the four credentials in the extension.

The four credentials

The Stripe connection tab has four fields. Each mode has its own pair, and the two pairs never mix.

SettingWhat it holds
Test secret keyThe secret API key of your Stripe account in test mode. Begins with sk_test_. A restricted key beginning with rk_test_ is also accepted.
Live secret keyThe secret API key in live mode. Begins with sk_live_, or rk_live_ for a restricted key.
Test signing secretThe signing secret of the webhook destination you create in test mode. Begins with whsec_.
Live signing secretThe signing secret of the webhook destination you create in live mode. Begins with whsec_.

How the fields behave:

  • For security, saved values are never shown again. A saved field shows "Configured; leave blank to keep"; an empty one shows "Not configured".
  • Leave a field blank to keep its saved value. Type a new value only to replace it.
  • A key of the wrong mode is refused: a sk_live_ key cannot be saved as the test key, and the other way round.
  • The keys are stored in your store and are used only to talk to Stripe. They are never sent to DevmanExtensions.
  • Credentials are separate for each store. Check the Store selector before saving.

Click Save settings after typing them.

Getting the secret keys

  1. Sign in to your Stripe Dashboard.
  2. Choose the mode you are setting up. Start with test mode (Stripe also calls it a sandbox); switch to live mode later.
  3. Open the developers area and go to the API keys page.
  4. Reveal and copy the secret key. Do not use the publishable key, which begins with pk_: the extension does not need it.
  5. Paste the key into Test secret key or Live secret key according to its prefix.

If you prefer a restricted key, it must be allowed to create and read Checkout Sessions, which are the only Stripe operations the extension performs.

Registering the webhook

The webhook is how Stripe tells your store that a payment finished, even when the customer never returns. Without it the method cannot be enabled.

The Payment notifications tab is a step-by-step guide. It shows the two addresses of the selected store, one under Test and one under Live, each with a Copy URL button. An address looks like this on OpenCart 2.3 and 3.x:

https://www.example.com/index.php?route=extension/payment/stripe_payments_pro/webhook&store_id=0&mode=test

The route part differs between OpenCart families, store_id is the number of the selected store and mode is test or live. Always copy the address from the tab rather than typing it.

Then, in Stripe:

  1. In the Stripe Dashboard, in the same mode, open Developers (or Workbench), then Webhooks, and choose to add a destination. The guide has a link that opens this page.
  2. Choose events from your own account, not from connected accounts.
  3. Select exactly these four events:
checkout.session.completed
checkout.session.async_payment_succeeded
checkout.session.async_payment_failed
checkout.session.expired
  1. Choose a webhook endpoint as the destination type and paste the address you copied, without adding or removing any character.
  2. Save the destination, open it and reveal its Signing secret. Copy the value beginning with whsec_.
  3. Paste it into Test signing secret (or Live signing secret) in the Stripe connection tab and click Save settings.

How your store handles notifications

  • Every notification is checked against the signing secret. A notification with a wrong or missing signature, or older than five minutes, is refused.
  • A test notification sent to the live address, or the opposite, is refused.
  • The store does not trust the content of the notification: it asks Stripe for the payment again and compares order, store, amount and currency before confirming.
  • Events other than the four above are acknowledged and ignored, so selecting extra events does no harm but is not needed.
  • Stripe sees one of these answers in its delivery history: status 200 when the notification was accepted, 400 when the address, mode or signature is wrong, and 503 when your store could not finish the check at that moment. Stripe sends the notification again after a 503.

Changing keys later

  • If you roll your secret key in Stripe, paste the new key in the matching field and save.
  • If you delete and recreate a webhook destination, its signing secret changes. Save the new one.
  • Do not switch a store to a different Stripe account while it has payments that are still pending or in review. They can only be verified in the account that created them.

Still need help?

Open a support ticket from your account and our team will look at your store with you.