Skip to content
BETAHostCore is in beta — features may change. Follow along on Discord.
Logo
Dashboard
Payment gateways Stripe

Stripe

Accept cards, Apple Pay and Google Pay through Stripe, with automatic renewals and refunds.

Last updated /guides/gateways/stripe

HostCore charges your clients through your own Stripe account. You create an API key in Stripe and add it to your store, and payments go straight to your Stripe balance. HostCore never holds your money, and card numbers never reach HostCore, because clients pay on Stripe's hosted checkout page.

Once connected, HostCore uses your key to:

  • Send clients to Stripe Checkout to pay invoices and save a card.
  • Create a Stripe customer for each client and save their card for renewals.
  • Charge saved cards automatically when renewals are due.
  • Issue refunds you make from your store.
  • Create and maintain the webhook Stripe uses to tell your store a payment succeeded.

Which key to use

HostCore accepts three kinds of Stripe key:

KeyStarts withUse it for
Restricted keyrk_live_Taking real payments. Recommended.
Standard secret keysk_live_Taking real payments, if you can't use a restricted key.
Sandbox keysk_test_ or rk_test_Testing without moving real money.
Tip —

Use a restricted key. It only grants the access HostCore needs. A standard secret key gives full control of your Stripe account, including payouts and your balance, so if it's ever exposed, the damage isn't limited to billing.

Create a restricted key

  1. Open your API keys

    In your Stripe Dashboard, go to Developers › API keys and click Create restricted key.

  2. Choose how the key will be used

    Select Providing this key to a third-party application, then enter HostCore's details. [OLLIE: list the fields and values Stripe asks for here]

  3. Name the key

    Give it a name you'll recognise later, such as HostCore.
  4. Set the permissions

    Leave every permission at its default or set it to None, then set only these to Write:

    ResourceAccess
    CustomersWrite
    Payment MethodsWrite
    Payment IntentsWrite
    Charges and RefundsWrite
    Checkout SessionsWrite
    Webhook EndpointsWrite
  5. Create and copy the key

    Click Create key and copy it. Stripe only shows the full key once.

Connect Stripe to your store

  1. Open the Stripe gateway

    In your store's admin dashboard, go to Store Settings › Payment Gateways › Stripe.

  2. Add your key

    Paste your key and save. HostCore checks the key and creates a webhook in your Stripe account that points at your store. The page shows Live Mode for a live key or Test Mode for a sandbox key.

  3. Turn on payments

    When you're ready to take payments, turn on Accept Payments.

You can see the webhook HostCore created under Developers › Webhooks in Stripe.

Warning —

Don't edit or delete the webhook HostCore creates. It's how Stripe tells your store a payment succeeded. Without it, clients can pay and their invoices stay unpaid. If the webhook is deleted or wasn't created, click Verify at the top of the Stripe gateway page to recreate it.

Test with a sandbox

Before you take real payments, connect a sandbox key and run a purchase from start to finish.

  1. In Stripe, switch to a sandbox using the account switcher.
  2. Create a restricted key there with the same permissions. It starts with rk_test_.
  3. Connect it to your store the same way.
  4. Place an order on your storefront and pay with a test card, using any future expiry date and any CVC.
  5. Check that the invoice is marked paid in your store and the payment appears in your Stripe sandbox.
Test cardResult
4242 4242 4242 4242Payment succeeds
4000 0000 0000 0002Card is declined
4000 0025 0000 3155Requires 3D Secure

When everything works, replace the sandbox key with your live key.

Danger —

Customers and saved cards created in a sandbox don't exist in live mode. Don't let real clients pay while your store is connected to a sandbox key, or their saved cards won't work once you switch to your live key.

Migrating from another billing software

Connect the same Stripe account your other billing software uses. Saved cards come across as Stripe payment methods, and those only work in the account that created them. If you connect a different account, every migrated card fails at renewal. See Migrating payment methods.

Rotate your key

To replace your key, for example because it was exposed or someone who had it has left:

  1. In Stripe, rotate the key from Developers › API keys.
  2. Paste the new key into Store Settings › Payment Gateways › Stripe and save.

When Stripe asks when the old key should expire, give yourself enough time to update your store first, unless the key was exposed. If it was, expire it straight away. Your clients, saved cards and renewals carry on as normal.

Troubleshooting

HostCore rejects the key when I save it. Check that you copied the whole key and that it's a secret or restricted key. Publishable keys, starting with pk_, won't work. For a restricted key, check that all six permissions are set to Write.

Clients pay in Stripe but invoices stay unpaid. The webhook is missing or disabled. Check Developers › Webhooks in Stripe, then click Verify on the Stripe gateway page to recreate it.

Renewals fail with "No such customer" or "No such payment method". The connected key belongs to a different Stripe account or mode from the one the card was saved in. This usually means a sandbox key was swapped for a live one, or a WHMCS migration was connected to a different Stripe account.

Refunds fail but payments work. The key is missing Charges and Refunds: Write. Edit the key's permissions in Stripe. You don't need to reconnect it.

Still stuck?

Open a support ticket from your HostCore account and we'll help you get connected.