Skip to content

In-App Purchase Gateway

In-App Purchase Gateway

Context

Starting with Shopware version 6.6.9.0, the In-App Purchase Gateway was introduced to enhance flexibility in managing In-App Purchases.

The gateway enables app servers to restrict specific In-App Purchases based on advanced decision-making processes handled on the app server side.

INFO

Current Limitations:
At present, the In-App Purchase Gateway supports only restricting the checkout process for new In-App Purchases.
Plans:
We aim to expand its functionality to include filtering entire lists of In-App Purchases before they are displayed to users.

Prerequisites

You should be familiar with the concept of Apps, their registration flow as well as signing and verifying requests and responses between Shopware and the App backend server.

App base guide

Your app server must be also accessible for the Shopware server. You can use a tunneling service like ngrok for development.

Manifest Configuration

To indicate that your app leverages the In-App Purchase Gateway, include the inAppPurchase property within the gateways property in your app's manifest.xml.

Below is an example of a properly configured manifest snippet for enabling the checkout gateway:

xml
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
    <!-- ... -->

    <gateways>
        <inAppPurchases>https://my-app.server.com/inAppPurchases/gateway</inAppPurchases>
    </gateways>
</manifest>

After successful installation of your app, the In-App Purchases gateway will already be used.

In-App Purchases gateway endpoint

During checkout of an In-App Purchase, Shopware checks for any active In-App Purchases gateways and will call the inAppPurchases url. The app server will receive a list containing the single only In-App Purchase the user wants to buy as part of the payload.

WARNING

Connection timeouts

The Shopware shop will wait for a response for 5 seconds. Be sure that your In-App Purchases gateway implementation on your app server responds in time, otherwise Shopware will time out and drop the connection.

Event

Plugins can listen to the Shopware\Core\Framework\App\InAppPurchases\Event\InAppPurchasesGatewayEvent. This event is dispatched after the In-App Purchases Gateway has received the app server response. It allows plugins to manipulate the available In-App Purchases, based on the same payload the app servers retrieved.