solution25/store-credit

Store Credit for Shopware 6

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 1

Forks: 6

Open Issues: 0

Type:shopware-platform-plugin

pkg:composer/solution25/store-credit

1.0.4 2026-02-02 14:00 UTC

This package is auto-updated.

Last update: 2026-02-04 09:35:35 UTC


README

1

Store Credit

Introduction

The Store Credit Plugin allows administrators to manage store credits for customers who return products. Instead of issuing refunds, the admin can allocate store credit to the customer's account , which can be used for future purchases. The store credit can be applied over multiple orders until the allocated amount is fully utilized.

Key Features

  • Store Credit Management:Admins can add, remove, and adjust store credit for customers.
  • Partial Usage: Customers can use store credit across multiple orders until exhausted.
  • Smooth Checkout Integration Customers can apply store credit at checkout alongside other payment methods.
  • Transaction History: Customers and admins can view a history of store credit transactions.

Compatibility

  • ✅ Shopware 6.6.x

Get Started

Installation & Activation

  1. Download
  • Clone the Plugin Repository:
  • Open your terminal and run the following command in your Shopware 6 custom plugins directory (usually located at custom/plugins/):
    git clone https://github.com/solution25com/store-credit-shopware-6-solution25.git
    
  1. Install the Plugin in Shopware 6
  • Log in to your Shopware 6 Administration panel.
  • Navigate to Extensions > My Extensions.
  • Locate the newly cloned plugin and click Install.
  1. Activate the Plugin
  • After installation, click Activate to enable the plugin.
  • In your Shopware Admin, go to Settings > System > Plugins.
  • Upload or install the “Store Credit” plugin.
  • Once installed, toggle the plugin to activate it.
  1. Verify Installation
  • After activation, you will see Store Credit in the list of installed plugins.
  • The plugin name, version, and installation date should appear as shown in the screenshot below. 2

Plugin Configuration

  1. Access Plugin Settings
  • Go to Settings > System > Plugins.
  • Locate Store Credit and click the three dots (...) icon or the plugin name to open its settings.
  1. General Settings
    1. Minimal Configuration: After installing the Store Credit Plugin, you need to enable the Store Credit Refund Type in the configuration. Since this plugin is related to Swag Commercial, the toggle should be enabled for the Store Credit Refund Type option to activate store credit refunds.
    3

2. Store Credit Add State: Toggle to enable or disable the feature.
3. Post Purchase Features: Restrict store credit usage to specific products.
4

How it works

After installing and enabling the plugin in the admin panel, customers can view their available balance and transaction history in their profile account settings on the storefront. 5

Admins can manually add or deduct store credit from a customer’s account. 6 7

Refunds & Credit Memo Workflow

  • When processing a return, select the "Refund as Store Credit" option.
  • The refunded amount is added to the customer's store credit balance.
  • Customers can use the store credit for future purchases.
  • All transactions are logged in the store_credit_history table for tracking. 8

Refunds & Store Credit Management

Partial & Full Refunds:

  • When issuing a refund, choose between a partial or full refund to store credit.
  • The refunded amount is automatically added to the customer's store credit balance.
  • The order status updates accordingly.

Project Structure

Storefront - Key Files/Folders

  • Controller Folder: Defines the store credit balance table and store credit history with API.
  • CartSubscriber.php: Checks if the user has used the store credits.
  • OrderRefundSubscriber.php: It handles the refund as store credit option
  • CustomCheckoutController.php: Defines store credit as a payment option.

Core - Key Files/Folders:

  • Entities/StoreCredit.php: Manages store credit data model.
  • Entities/StoreCreditHistory.php: Logs store credit transactions.

Resources - Key Files/Folders:

  • services.xml: Registers services for dependency injection.
  • routes.xml: Declares API routes.

Admin Panel - Key Features:

  • View history, add, and deduct store credit in customer details.
  • Generate reports on credit usage.

API Endpoints

Get Store Credit Balance
- Path: /store-api/store-credit/balance/{customer_id}
- Method: GET
- Purpose: Fetches the current store credit balance of a customer.
- Response: Returns the available credit balance.

Add Store Credit
- Path: /store-api/store-credit/add
- Method: POST
- Request Body:
- customer_id (string, required)
- amount (float, required)
- reason (string, optional) Response: Returns updated store credit details.

Deduct Store Credit
- Path: /store-api/store-credit/deduct
- Method: POST
- Request Body:
- customer_id (string, required)
- amount (decimal, required)
- order_id (string, optional) Response: Returns updated store credit details.


- Refund to Store Credit
- Path: /store-api/store-credit/add
- Method: POST
- Request Body:
- order_id (string, required)
- amount (decimal, required) Response: Refund processed and logged in credit history.
- reason (string, optional).

Use from end-users - Checkout Integration

  • Customers can choose to apply store credit as payment during checkout. 9

  • Partial and full store credit application supported.

  • Remaining balance is paid via an alternative payment method.

  • When an admin creates an order he can use the store credits of the customer he chooses, first you add the product in admin order creation, then you add another line item as credit and you use the specific name “Store credit discount“.

Store Credit Plugin - API Documentation

This document describes the API endpoints provided by the Store Credit Plugin for Shopware 6. These endpoints allow authorized users to manage store credits for customers and apply store credits during checkout.

Add Store Credit

Endpoint
POST /api/store-credit/add

Description

Adds a store credit amount to a specific customer’s balance. This can optionally be linked to an order and currency.

Request Headers

Authorization: Bearer <your-access-token>
Content-Type: application/json

Example Request Body

{
  "customerId": "3c2a178f96b7345ad27051c34609e52",
  "amount": 50.0,
  "reason": "Manual admin adjustment"
}

Successful Response

{
  "success": true,
  "historyId": "f84b5a7a4fce4a1db9d693c8be304a1e"
}

Example Error Response

{
  "success": false,
  "message": "Customer ID is missing."
}

Deduct Store Credit

Endpoint
POST /api/store-credit/deduct

Description

Deducts a store credit amount from a customer’s balance. The deduction can include a reason for logging purposes.

Request Headers

Authorization: Bearer <your-access-token>
Content-Type: application/json

Example Request Body

{
  "customerId": "3c2a178f96b7345ad27051c34609e52",
  "amount": 20.0,
  "reason": "Refund adjustment"
}

Successful Response

{
  "success": true,
  "historyId": "a9d2554b0ce847cd82f3ac9bd1c0aa2f"
}

Example Error Response

{
  "success": false,
  "message": "Amount exceeds the maximum allowed credit for order."
}

Get Store Credit Balance

Endpoint
GET /api/store-credit/balance

Description

Retrieves the current store credit balance for a customer.

Request Headers

Authorization: Bearer <your-access-token>

Example Request

GET /api/store-credit/balance?customerId=3c2a178f96b7345ad27051c309e52

Successful Response

{
  "success": true,
  "balance": 80.0,
  "currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca"
}

Example Error Response

{
  "success": false,
  "message": "Customer not found."
}

Authentication Note

These endpoints are protected and require a Bearer token obtained through the Shopware Admin API.

Best Practices

  • Enable Store Credit Refunds

    • Ensure the Store Credit Refund Type option is activated in Settings > System > Plugins.
    • Allows refunds to be issued as store credit instead of cash.
  • Set Per-Order Credit Limits

    • Define a maximum limit for store credit usage per order (e.g., 50 euros).
    • Helps control how much credit can be used during checkout.
  • Monitor Store Credit Transactions

    • Regularly check the store credit transaction logs to track customer usage.
    • This helps to avoid errors and discrepancies.
  • Inform Customers About Their Credit

    • Make sure customers can see their available store credit balance in their account.
    • Send notifications when store credit is added or used.
  • Test Before Going Live

    • Test different scenarios, such as refunds, partial payments, and store credit applications during checkout.
    • Ensure everything functions properly before launching.
  • Use API to Customize for Your Needs

    • Use API endpoints to customize store credit rules and integrate with other store functions.
    • This allows for flexibility in how store credit is applied.
  • Restrict Store Credit for Certain Products

    • If necessary, restrict store credit usage for specific products or sales channels.
    • This ensures store credit is used where appropriate.

Troubleshooting

  • Store credit is not appearing at checkout

    • Ensure the Store Credit Refund Type is activated in the plugin settings.
    • Check if the customer has enough store credit in their account.
  • Refunds not issued as store credit

    • Verify that the refund method is set to Store Credit when processing returns.
    • Check for conflicts with other refund-related plugins.
  • Customer’s store credit balance is not updating

    • Ensure scheduled tasks are running with the following commands:
      bin/console scheduled-task:register
      bin/console scheduled-task:run
      bin/console messenger:consume
    • Verify the store credit history is being logged in the database.
  • Admins cannot modify store credit

    • Ensure the admin has the necessary permissions to edit customer store credit.
    • Double-check that API calls for store credit adjustments are functioning.
  • Orders not using store credit during checkout

    • Ensure there is no restriction on store credit for the selected products.
    • Verify that the credit amount is within the allowed per-order limit.

FAQ

  • Can I restrict store credit usage to specific products?

    • Yes, you can restrict store credit usage for specific products or categories through the Post Purchase Features.
  • How do I add store credit to a customer's account?

    • Admins can add store credit manually through the Customer Details section in the admin panel.
  • Can store credit expire?

    • Currently, the plugin does not support automatic expiration of store credit, but this feature can be customized.
  • Can customers see their store credit balance?

    • Yes, customers can view their available balance and transaction history in their account settings.

Wiki Documentation

Read more about the plugin configuration on our Wiki.