Configurations
The following settings are relevant for configuring the Stripe payment method:Modules
The following modules are relevant for integrating the Stripe payment method in the checkout process:- $wsStripe - Stripe payment methods module
- $wsCheckout - Checkout state, addresses, shipping, payment, problems, totals
- $wsActions - Generate and evaluate actions
- $wsAccount - Login status, email, addresses, loadAddress()
- $wsViews - Current URL, destination pages, view URLs
- $wsBasket - Basket and order overview
- $wsConfig - Configuration values, for example salutations and currency
Actions
The following actions are relevant for the integration of the Stripe payment method:Additionally relevant information
The following additional content must be integrated for the payment method.Frontend integration
Stripe provides its own JavaScript SDK that must be embedded in the template. It handles the display of the payment fields and the communication with Stripe. HTML structureThe following HTML block must be placed in the template:
#wsStripePaymentElementis the container in which Stripe automatically embeds the payment fields (e.g., credit card number, PayPal button, etc.)- The form submits the payment process when “Pay with Stripe” is clicked
The following script block must be inserted directly after the HTML block. It must be enclosed in
{{ autoescape "js" }} so that template variables in the JavaScript context are processed correctly.
The flow in the script is as follows:
- Initialize Stripe - The SDK is started with the credentials from $wsStripe.configuration
- Display payment fields - Stripe renders the payment selection (credit card, PayPal, etc.) into the
#wsStripePaymentElementcontainer. The Stripe address input fields are disabled because the customer’s address is already known in the shop and is passed automatically. - Trigger payment - When the form is submitted, the entered payment data is sent to Stripe together with the billing address from $wsAccount. Stripe returns a confirmation token for this.
- Send token to the shop - The token is transmitted to the shop, which uses it to start the actual payment process with Stripe.
- Process result - If the payment fails, an error message is displayed. If an additional confirmation is required (e.g., 3D Secure), Stripe handles this automatically.
- Redirect - After a successful payment, the customer is redirected to the order confirmation page.
Further links
- General documentation for the Stripe frontend: https://docs.stripe.com/js
