본문 바로가기
개발/Flutter

In App 결제 기능 구축(1)

by dev_caleb 2023. 5. 30.
728x90

인앱결제 기능을 구현하려고 한다~

 

 

https://velog.io/@soonmuu/Flutter-flutter-인앱결제-구현-1-앱빌드

 

[Flutter] flutter 인앱결제 구현 (1) - 앱빌드

인앱 결제 위한 abb 파일 등록

velog.io

 

위의 블로그를 켜보면 keystore를 등록하는 부분이 나오는데 나는 keystore는 이미 등록되어있기 때문에 해당부분은 건너 뛰었다.

 

 

안드로이드 같은 경우에는

이 부분만 해주면 될 것 같다.

 

https://developer.android.com/google/play/billing?hl=ko 

 

Google Play 결제 시스템  |  Android Developers

알림: 2023년 8월 2일부터 모든 신규 앱은 결제 라이브러리 버전 5 이상을 사용해야 합니다. 2023년 11월 1일부터는 기존 앱의 모든 업데이트에도 결제 라이브러리 버전 5 이상이 요구됩니다. 자세히

developer.android.com

안드로이드 결제시스템에 대한 부분도 확인을 해보자,,

 

 

pub.dev에 library도 확인해보자

 

 

 

https://pub.dev/packages/in_app_purchase

 

in_app_purchase | Flutter Package

A Flutter plugin for in-app purchases. Exposes APIs for making in-app purchases through the App Store and Google Play.

pub.dev

 

pub.dev - in_app_purchase 에 있는 codelab 자료도 확인해보자~

https://codelabs.developers.google.com/codelabs/flutter-in-app-purchases#0

 

Adding in-app purchases to your Flutter app  |  Google Codelabs

In this codelab, you’ll add in-app purchases to a Flutter app that are verified and managed using a Dart backend service.

codelabs.developers.google.com

 

 

https://velog.io/@soonmuu/Flutter-flutter-인앱결제-구현-2

 

[Flutter] flutter 인앱결제 구현 (2) - 코드구현

in_app_purchase 패키지를 사용한 인앱결제 코드 예시

velog.io

 

일단 공식 codelab을 활용하는 게 좀 좋아보여서 그렇게 해보기로 했다. 

 

 

 

Adding in-app purchases to a Flutter app requires correctly setting up the App and Play stores, verifying the purchase, and granting the necessary permissions, such as subscription perks.

플러터 앱에 인앱 결제를 추가하려면 앱 스토어와 플레이 스토어를 올바르게 설정하고 구매를 검증하며, 구독 혜택과 같은 필요한 권한을 부여해야 합니다.

 

In this codelab you'll add three types of in-app purchases to an app (provided for you), and verify these purchases using a Dart backend with Firebase. The provided app, Dash Clicker, contains a game that uses the Dash mascot as currency. You will add the following purchase options:

이 코드랩에서는 제공된 앱을 사용하여 앱에 세 가지 유형의 인앱 결제를 추가하고, Firebase의 Dart 백엔드를 사용하여 이러한 구매를 검증합니다. 제공된 앱인 "Dash Clicker"에는 Dash 마스코트를 화폐로 사용하는 게임이 포함되어 있습니다. 다음과 같은 구매 옵션을 추가할 것입니다:

 

-A repeatable purchase option for 2000 Dashes at once.

한 번에 2000개의 Dash를 반복해서 구매할 수 있는 구매 옵션.


A one-time upgrade purchase to make the old style Dash into a modern style Dash.

옛 스타일의 Dash를 현대적인 스타일의 Dash로 업그레이드하는 일회성 업그레이드 구매.

 

A subscription that doubles the automatically generated clicks.

자동으로 생성된 클릭을 두 배로 하는 구독.

 

 

The first purchase option gives the user a direct benefit of 2000 Dashes. These are directly available to the user and can be bought many times. This is called a consumable as it is directly consumed and can be consumed multiple times.

첫 번째 구매 옵션은 사용자에게 2000개의 Dash를 직접적인 혜택으로 제공합니다. 이 Dash는 사용자에게 직접적으로 제공되며 여러 번 구매할 수 있습니다. 이를 "소비 가능(consumable)"이라고 합니다. 왜냐하면 이는 직접적으로 사용되고 여러 번 사용할 수 있기 때문입니다.

 

The second option upgrades the Dash to a more beautiful Dash. This only has to be purchased once and is available forever. Such a purchase is called non-consumable because it cannot be consumed by the app but is valid forever.

두 번째 옵션은 Dash를 더 아름답게 업그레이드합니다. 이는 한 번만 구매하면 영구적으로 사용할 수 있습니다. 이와 같은 구매는 "소비 불가능(non-consumable)"이라고 부르며, 앱에서 소비되지 않지만 영구적으로 유효합니다.

 

- 개인적인 의견 : consumable과 non-consumable의 차이는 인앱결제로 받은 재화가 사라지느냐 사라지지 않느냐에 따라 다른 것 같다.!

 

The third and last purchase option is a subscription. While the subscription is active the user will get Dashes more quickly, but when he stops paying for the subscription the benefits also go away.

세 번째로 마지막 구매 옵션은 구독입니다. 구독이 활성화된 동안 사용자는 빠르게 Dash를 획득할 수 있지만, 구독 비용을 지불하지 않으면 혜택도 사라집니다.

 

The backend service (also provided for you) runs as a Dart app, verifies that the purchases are made, and stores them using Firestore. Firestore is used to make the process easier, but in your production app, you can use any type of backend service.

백엔드 서비스(또한 제공됨)는 Dart 앱으로 실행되며, 구매가 이루어졌는지를 검증하고 Firestore를 사용하여 이를 저장합니다. Firestore는 프로세스를 간편하게 만들기 위해 사용되지만, 실제 제품 앱에서는 어떤 유형의 백엔드 서비스를 사용해도 됩니다.

 

 

728x90