trusted_shops_flutter

pub package pub points likes popularity

Unofficial Flutter plugin that embeds the official Trusted Shops Android SDK and Trusted Shops iOS SDK so you can show the Trustbadge and offer buyer protection from Dart.

This package is not affiliated with Trusted Shops AG. The native SDKs stay proprietary; you still need a Trusted Shops mobile-app contract and per-market integration IDs.

Trusted Shops documents native Android/iOS only. This plugin is a community bridge via Flutter platform views.

Requirements

Platform Minimum
Flutter 3.24 (Swift Package Manager on by default in 3.44+)
Android API 29 (Android 10). Host Activity should be a FlutterFragmentActivity.
iOS 17.0, Swift Package Manager enabled

Install

dependencies:
  trusted_shops_flutter: ^0.1.0
flutter pub add trusted_shops_flutter

Android

No extra Gradle repositories are required (mavenCentral() is enough). Use FlutterFragmentActivity so the Compose Trustbadge can attach a lifecycle:

import io.flutter.embedding.android.FlutterFragmentActivity

class MainActivity : FlutterFragmentActivity()

Set minSdk to at least 29.

iOS

Raise the deployment target to 17.0. Keep Flutter Swift Package Manager enabled so the plugin can pull trustedshops-public/ios-sdk.

Apps that disable SwiftPM (CocoaPods only) cannot resolve the official iOS SDK.

Usage

import 'package:trusted_shops_flutter/trusted_shops_flutter.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await TrustedShops.start(
    defaultMarket: TrustedShopsMarket.deu,
    integrationIds: {
      TrustedShopsMarket.deu: const String.fromEnvironment(
        'TRUSTED_SHOPS_INTEGRATION_ID_DE',
      ),
    },
    loggingEnabled: kDebugMode,
  );
  runApp(const MyApp());
}

Show the badge anywhere:

const TrustbadgeView(
  layout: TrustbadgeLayout.horizontal,
  height: 72,
)

Buyer protection after checkout (show a TrustbadgeView first so shop data can load):

await TrustedShops.initiateCheckout(
  TrustedShopsOrder(
    shopOrderId: 'ORDER-123',
    email: 'buyer@example.com',
    amount: 59.99,
    currency: TrustedShopsCurrency.eur,
    products: const [
      TrustedShopsProduct(name: 'Wireless Headphones', sku: 'WH-001'),
    ],
  ),
);

Integration IDs

The mobile SDKs do not use the classic website TSID. Trusted Shops issues a separate integration ID per market after the mobile-app addendum / risk assessment. See How do I use Trusted Shops in my mobile app?.

Native SDK versions

  • Android: com.trustedshops.android.sdk:trustedshops-sdk:1.2.6
  • iOS: Swift package trustedshops_ios_sdk from 1.2.6

License

BSD-3-Clause for this wrapper. The official Trusted Shops SDKs have their own proprietary licenses.