A complete example demonstrating how to build a Shopware 6 app backend using the Shopware App Server library.
- App Registration - Automatic registration with Shopware shops
- Webhook Handling - Process events from Shopware (order.written, product.written)
- Action Buttons - Handle custom actions from Shopware Administration
- Admin API Integration - Send notifications to Shopware Administration
basic-app/
├── src/main/java/com/example/shopwareapp/
│ ├── Application.java # Spring Boot main class
│ └── MyShopwareApp.java # ShopwareApp implementation
├── src/main/resources/
│ └── application.yml # Configuration
├── manifest.xml # Shopware app manifest
└── build.gradle
cd examples/basic-app
./gradlew bootRunThe server starts on http://localhost:8080.
- Zip the
MyShopwareAppdirectory - Upload zip via Shopware Administration → Extensions → My Extensions → Upload Extension
The app will automatically:
- Register with your app server
- Exchange credentials
- Be ready to receive webhooks and handle actions
See application.yml for the development configuration.
The application.yml is configured for local development:
app-server:
ssl-only: false # Allow HTTP
map-localhost-ip-to-localhost-domain-name: true # Enable localhost routingFor production, set ssl-only: true and update MyShopwareApp/manifest.xml URLs to use HTTPS.
See MyShopwareApp.java for the complete implementation showing:
Important configuration:
@Override
public String getAppKey() {
return "my-app"; // Must match subdomain
}
@Override
public String getAppSecret() {
return "my-app-secret"; // Matches <secret> from manifest.xml
}
@Override
public String getAppName() {
return "MyShopwareApp"; // Matches <name> from manifest.xml
}Webhook Handling:
See the onEvent method.
Action Button Handling:
See the onAction method.
Trigger webhooks: Create or modify an order/product in Shopware Administration.
Test action buttons:
- Go to Orders → Select an order → Detail view
- Click "Process Order" in the action menu ("...")
- Check for the success notification
| Problem | Solution |
|---|---|
| Registration fails | Check app server is running, verify /etc/hosts entry for my-app.localhost |
| Webhooks not received | Verify webhook URLs in manifest.xml, check Shopware logs in var/log/ |
| Action buttons missing | Ensure app is activated, clear Shopware cache: bin/console cache:clear |