Stripe
Accept cards, Apple Pay and Google Pay through Stripe, with automatic renewals and refunds.
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:
| Key | Starts with | Use it for |
|---|---|---|
| Restricted key | rk_live_ | Taking real payments. Recommended. |
| Standard secret key | sk_live_ | Taking real payments, if you can't use a restricted key. |
| Sandbox key | sk_test_ or rk_test_ | Testing without moving real money. |
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
Open your API keys
In your Stripe Dashboard, go to Developers › API keys and click Create restricted key.
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]
Name the key
Give it a name you'll recognise later, such asHostCore.Set the permissions
Leave every permission at its default or set it to None, then set only these to Write:
Resource Access Customers Write Payment Methods Write Payment Intents Write Charges and Refunds Write Checkout Sessions Write Webhook Endpoints Write Create and copy the key
Click Create key and copy it. Stripe only shows the full key once.
Connect Stripe to your store
Open the Stripe gateway
In your store's admin dashboard, go to Store Settings › Payment Gateways › Stripe.
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.
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.
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.
- In Stripe, switch to a sandbox using the account switcher.
- Create a restricted key there with the same permissions. It starts with
rk_test_. - Connect it to your store the same way.
- Place an order on your storefront and pay with a test card, using any future expiry date and any CVC.
- Check that the invoice is marked paid in your store and the payment appears in your Stripe sandbox.
| Test card | Result |
|---|---|
4242 4242 4242 4242 | Payment succeeds |
4000 0000 0000 0002 | Card is declined |
4000 0025 0000 3155 | Requires 3D Secure |
When everything works, replace the sandbox key with your live key.
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:
- In Stripe, rotate the key from Developers › API keys.
- 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.