패키지, 저장소 및 앱 카테고리 검색

패키지 상세v1.0.2

yandex_kassa

Android 및 iOS 플랫폼용 Yandex.Kassa(Yandex.Checkout) 플러그인

30일 다운로드
13
좋아요
15
Pub 점수
40

패키지 설치

flutter pub add yandex_kassa

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

yandex_kassa 패키지는 Android 및 iOS 플랫폼에서 결제 처리를 위해 Yandex.Kassa(Yandex.Checkout)와의 통합을 가능하게 하는 Flutter 플러그인입니다. 결제 흐름 시작, 결제 상태 처리, 거래 안전 관리에 대한 간편한 인터페이스를 제공합니다. 앱 내 결제 기능이 필요한 개발자를 위한 것으로, Yandex의 신뢰할 수 있는 인프라를 통해 원활한 결제 처리를 지원합니다. 플러그인은 결제 워크플로우 구현을 단순화하면서도 모바일 플랫폼 간 호환성을 보장합니다.

사용 사례

  • 앱 내 구매
  • 전자상거래 통합
  • 구독 결제
  • 디지털 상품 판매

주요 기능

  • 크로스 플랫폼 지원
  • 안전한 결제 처리
  • 간편한 체크아웃 통합
  • 거래 상태 추적
  • 야н데크스 캐사 백엔드 연결

적합한 대상

  • 결제가 필요한 모바일 앱
  • Yandex.Checkout를 사용하는 개발자
  • 플러터에서의 전자상거래 솔루션
  • 러시아 또는 CIS 시장 대상 앱

고려 사항

  • Yandex.Kassa 상인 계정이 필요합니다
  • 플랫폼별 설정이 필요합니다
  • 요던카사 결제 수단에 한정
  • 외부 API 사용 가능 여부에 의존
  • 결제 실패에 대한 적절한 오류 처리가 필요합니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

yandex_kassa

Yandex.Kassa (Yandex.Checkout) plugin for both Android and iOS platforms. Implements Yandex Checkout SDK for Flutter. Official documentation can be found here:

Please, follow the official documentation for quick start. Note, that you need to get .framework files from Yandex Money support to use plugin for iOS. Don't forget to set them as Embed & Sign or Embed Without Signing at Runner -> General -> Frameworks, Libraries and Embedded Content

Example

Demonstrated how use the plugin.

import 'dart:convert';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:yandex_kassa/yandex_kassa.dart';
import 'package:http_client/console.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

final idempotenceKey = 'some_unique_idempotence_key' +
    DateTime.now().microsecondsSinceEpoch.toString();
const shopId = 'some_shop_id';
const clientAppKey = 'live_MTkzODU2VY5GiyQq2GMPsCQ0PW7f_RSLtJYOT-mp_CA';
const secretKey = 'your secret key';

class _MyAppState extends State<MyApp> {
  final paymentParameters = PaymentParameters(
      amount: Amount(5),
      purchaseName: 'Product name',
      purchaseDescription: 'Some detailed description of current purchase',
      clientApplicationKey: clientAppKey,
      iosColorScheme: IosColorScheme.redOrange,
      paymentMethods: [PaymentMethod.bankCard, PaymentMethod.sberbank],
      applePayMerchantIdentifier: "merchant.ru.yandex.mobile.msdk.debug",
      androidColorScheme: IosColorScheme.redOrange,
      iosTestModeSettings: IosTestModeSettings(charge: Amount(3.1415926)),
      googlePayParameters: GooglePayCardNetwork.values,
      shopId: shopId,
      returnUrl: 'https://your.return/url',
      androidTestModeSettings: AndroidTestModeSettings(
          mockConfiguration: AndroidMockConfiguration(
              serviceFee: Amount(3.1415926),
              paymentAuthPassed: true,
              completeWithError: false,
              linkedCardsCount: 3)));

  TokenizationResult tokenizationResult;
  Map paymentResult;
  bool loading = false;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      localizationsDelegates: [
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
      ],
      supportedLocales: [
        const Locale('en', 'US'),
        const Locale('ru', 'RU'),
      ],
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Stack(children: [
          Center(
              child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: [
                Spacer(),
                Container(
                    child: OutlineButton(
                        child: const Text('Open payment screen'),
                        onPressed: () async {
                          final result = await YandexKassa.startCheckout(
                              paymentParameters);
                          setState(() {
                            tokenizationResult = result;
                          });
                        })),
                if (tokenizationResult != null) ...[
                  (tokenizationResult.success
                      ? Text(
                          'Token has been successfully received\nToken: ${tokenizationResult?.paymentData?.token ?? ""}\nPayment method: ${tokenizationResult?.paymentData?.paymentMethod ?? ""}',
                          style: TextStyle(
                              color: Colors.green,
                              fontSize: 16,
                              fontWeight: FontWeight.bold),
                          textAlign: TextAlign.center,
                        )
                      : Text(
                          'An error occured\n${tokenizationResult.error}',
                          style: TextStyle(
                              color: Colors.redAccent,
                              fontSize: 16,
                              fontWeight: FontWeight.bold),
                          textAlign: TextAlign.center,
                        )),
                  if (tokenizationResult?.success == true)
                    OutlineButton(
                      child: Text('Send Token'),
                      onPressed: () async {
                        final httpClient = ConsoleClient();
                        setState(() => loading = true);
                        Request request = Request(
                            'POST',
                            Uri.parse(
                                'https://payment.yandex.net/api/v3/payments'),
                            headers: Headers(),
                            body: json.encode({
                              "payment_token":
                                  tokenizationResult.paymentData.token,
                              "amount": paymentParameters.amount.jsonIso4217,
                              "confirmation": {
                                "type": "redirect",
                                "return_url":
                                    "https://4081d9747ee2.ngrok.io/v1.3/verifications/yandex_checkout"
                              },
                              "metadata": {"my_key": "my_val"},
                              "description":
                                  paymentParameters.purchaseDescription
                            }));
                        request.headers.add("Idempotence-Key", idempotenceKey);
                        request.headers.add(
                            'Authorization',
                            "Basic " +
                                base64Encode(
                                    utf8.encode("$shopId:$secretKey")));
                        request.headers.add('Content-Type', 'application/json');
                        Response response = await httpClient.send(request);
                        paymentResult =
                            json.decode(await response.readAsString());
                        setState(() => loading = false);
                      },
                    ),
                  if (paymentResult != null)
                    Text(
                      paymentResult.toString(),
                      style: TextStyle(
                          color: Colors.green,
                          fontSize: 16,
                          fontWeight: FontWeight.bold),
                      textAlign: TextAlign.center,
                    )
                ],
                Spacer(),
              ])),
          if (loading)
            Container(
                width: double.infinity,
                height: double.infinity,
                color: Colors.black26,
                child: Center(child: CircularProgressIndicator()))
        ]),
      ),
    );
  }
}
TODO
  • add card scanning

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.