This guide will walk you through the steps to configure Stripe as a payment method in your web store. A prerequisite is that you already have a Stripe account.
Obtain Your API Keys
Log into your Stripe account and navigate to https://dashboard.stripe.com/apikeys. First decide if you want your account in "Test Mode" (for testing purposes). If so, be sure to toggle on that option.
Next click on the "Publishable Key" to copy it to your clipboard. Save that key to a safe place. Next press "Reveal Secret Key" if one already exists and copy that to your clipboard. If you do not yet have a secret key, press the button to create one.
Configure Stripe in the Web Store
Next log into your commercebuild store and navigate to System → Payment Settings → Payment Method (/admin/mpayment/payment). Locate the payment method you want to modify (B2B, B2C, Open Invoices). Within that payment method, locate "Stripe" and press the "Edit" button found to the right of the option. Then press "Edit" again.
Fill in the details on the page. Ensuring that "Environment" is set to either "Production" or "Sandbox", depending on whether your Stripe account is in test mode or not. Set the "Transaction Type" to either "Pre Authorization" or "Payment". The Publishable and Secret Keys on this page can be pasted in from what you copied earlier. Press the Apply button to save those changes.
Note that some settings on this screen may appear differently depending upon the ERP you are using.
Webhooks
In the screenshot above, the Webhook Signing Secret should be configured. If it is not, there could be cases of a successful payment being processed, but an order not being created.
To configure this setting, you will need to:
- Go to https://dashboard.stripe.com/webhooks
- Click Add an endpoint
- In the Endpoint URL setting in Stripe, input the URL you can see in the Webhook Endpoint URL from the commercebuild Payment settings. This will generally be something along the lines of
https://yourwebstore.com/webhook/orders
. - Next, enter a Description that tells you where the webhook is used, e.g. "This webhook is to ensure orders are processed successfully on commercebuild."
- After that, ensure that Events on your account is toggled on and the Version can remain the default.
- Next, click + Select Events
- Ensure that
payment_intent.succeeded
is selected. - Click Add endpoint.
- Next, you will be redirected to a page that says "Waiting for events..." On this page, under the Signing secret heading, click the link Reveal, which will show the signing secret key, prefixed with
whsec_
. Copy the key. - Finally, paste the key into the Webhook Signing Secret in the Stripe payment settings and be sure to click Apply to save your changes.
When all said and done, your Stripe settings and commercebuild settings will look something like this:
Steps 1-8:
Step 9:
Step 10:
Activating Stripe
Next navigate back to System → Payment Settings → Payment Method (/admin/mpayment/payment). Ensure that the radio button is selected next to Stripe for that payment method.
Test
Finally, perform a test order through the site using Stripe. If you enabled "Pre Authorization" in the Stripe settings, check that the preauth is appearing in Stripe's dashboard.
Stripe has a guide on how to test their services here: https://stripe.com/docs/testing