본문 바로가기
개발/Flutter

In App 결제 기능 구축(4)

by dev_caleb 2023. 6. 5.
728x90

Confirming subscription price changes 

 

구독 가격 변경 확인

 

 

When the price of a subscription is changed the consumer will need to confirm that price change. If the consumer does not confirm the price change the subscription will not be auto-renewed. By default on both iOS and Android the consumer will automatically get a popup to confirm the price change, but App developers can override this mechanism and show the popup on a later moment so it doesn't interrupt the critical flow of the App. This works different for each of the stores.

구독 가격이 변경되면 소비자는 해당 가격 변경을 확인해야 합니다. 소비자가 가격 변경을 확인하지 않으면 구독이 자동 갱신되지 않습니다. iOS와 Android 모두 기본적으로 소비자는 가격 변경을 확인하기 위해 자동 팝업을 받게 되지만, 앱 개발자는 이 메커니즘을 재정의하고 팝업을 나중에 표시하여 앱의 중요한 흐름을 방해하지 않도록 할 수 있습니다. 이는 각 상점마다 다르게 작동합니다.

 

Google Play Store (Android)

When the subscription price is raised, the consumer should approve the price change within 7 days. The official documentation can be found here. When the price is lowered the consumer will automatically receive the lower price and does not have to approve the price change.

구독 가격이 인상되면, 소비자는 7일 이내에 가격 변경을 승인해야 합니다. 공식 문서는 여기에서 찾을 수 있습니다. 가격이 낮아지면, 소비자는 자동으로 낮은 가격을 받게 되며, 가격 변경을 승인할 필요가 없습니다.

After 7 days the consumer will be notified through email and notifications on Google Play to agree with the new price. App developers have 7 days to explain the consumer that the price is going to change and ask them to accept this change. App developers have to keep track of whether or not the price change is already accepted within the app or in the backend. The Google Play API can be used to check whether or not the price change is accepted by the consumer by reading the priceChange property on a subscription object.

7일이 지나면, 소비자는 Google Play의 이메일 및 알림을 통해 새로운 가격에 동의하라는 알림을 받게 됩니다. 앱 개발자는 소비자에게 가격이 변경될 것임을 설명하고 이 변경을 수락할 것을 요청하기 위해 7일의 시간이 주어집니다. 앱 개발자는 가격 변경이 이미 앱이나 백엔드에서 수락되었는지 여부를 추적해야 합니다. Google Play API를 사용하여 구독 객체의 priceChange 속성을 읽어 소비자가 가격 변경을 수락했는지 확인할 수 있습니다.

The InAppPurchaseAndroidPlatformAddition can be used to show the price change confirmation flow. The additions contain the function launchPriceChangeConfirmationFlow which needs the SKU code of the subscription.

InAppPurchaseAndroidPlatformAddition을 사용하여 가격 변경 확인 흐름을 표시할 수 있습니다. 이 추가 기능에는 구독의 SKU 코드를 필요로 하는 launchPriceChangeConfirmationFlow 함수가 포함되어 있습니다.

 

//import for InAppPurchaseAndroidPlatformAddition
import 'package:in_app_purchase_android/in_app_purchase_android.dart';
//import for BillingResponse
import 'package:in_app_purchase_android/billing_client_wrappers.dart';

if (Platform.isAndroid) {
  final InAppPurchaseAndroidPlatformAddition androidAddition =
    _inAppPurchase
      .getPlatformAddition<InAppPurchaseAndroidPlatformAddition>();
  var priceChangeConfirmationResult =
      await androidAddition.launchPriceChangeConfirmationFlow(
    sku: 'purchaseId',
  );
  if (priceChangeConfirmationResult.responseCode == BillingResponse.ok){
    // TODO acknowledge price change
  }else{
    // TODO show error
  }
}

 

Apple App Store (iOS)

When the price of a subscription is raised iOS will also show a popup in the app. The StoreKit Payment Queue will notify the app that it wants to show a price change confirmation popup. By default the queue will get the response that it can continue and show the popup. However, it is possible to prevent this popup via the 'InAppPurchaseStoreKitPlatformAddition' and show the popup at a different time, for example after clicking a button.

To know when the App Store wants to show a popup and prevent this from happening a queue delegate can be registered. The InAppPurchaseStoreKitPlatformAddition contains a setDelegate(SKPaymentQueueDelegateWrapper? delegate) function that can be used to set a delegate or remove one by setting it to null.

 

구독 가격이 인상되면 iOS에서도 앱 내에서 팝업이 표시됩니다. StoreKit Payment Queue는 앱에게 가격 변경 확인 팝업을 표시하고자 한다는 알림을 보냅니다. 기본적으로 큐는 계속해서 팝업을 표시할 수 있는 응답을 받습니다. 그러나 'InAppPurchaseStoreKitPlatformAddition'을 통해 이 팝업을 방지하고 다른 시점, 예를 들어 버튼을 클릭한 후에 팝업을 표시할 수도 있습니다.

App Store에서 팝업을 표시하려는 시기를 알고 이를 방지하기 위해 큐 대리자를 등록할 수 있습니다. InAppPurchaseStoreKitPlatformAddition에는 setDelegate(SKPaymentQueueDelegateWrapper? delegate) 함수가 포함되어 있어 대리자를 설정하거나 null로 설정하여 제거할 수 있습니다.

 

//import for InAppPurchaseStoreKitPlatformAddition
import 'package:in_app_purchase_storekit/in_app_purchase_storekit.dart';

Future<void> initStoreInfo() async {
  if (Platform.isIOS) {
    var iosPlatformAddition = _inAppPurchase
            .getPlatformAddition<InAppPurchaseStoreKitPlatformAddition>();
    await iosPlatformAddition.setDelegate(ExamplePaymentQueueDelegate());
  }
}

@override
Future<void> disposeStore() {
  if (Platform.isIOS) {
    var iosPlatformAddition = _inAppPurchase
            .getPlatformAddition<InAppPurchaseStoreKitPlatformAddition>();
    await iosPlatformAddition.setDelegate(null);
  }
}

 

그 다음은 중요해보이진 않는 것 같다.

 

728x90

'개발 > Flutter' 카테고리의 다른 글

GetX 관련 자료  (0) 2023.06.14
In App 결제 기능 구축(5)  (0) 2023.06.07
Get.until로 bottom NavigationBar 종료하기  (0) 2023.06.05
In App 결제 기능 구축(3)  (0) 2023.06.04
In App 결제 기능 구축(2)  (0) 2023.06.04