I want to build an autorenewable subscription service, with an introductory trial period. There doesn't seem to be much written documentation on what models and fields I need to best model (and futureproof) my subscriptions. I'm starting with Apple's App store right now, but I do have a web interface and want to go to the Play Store at some point.
From this video: https://developer.apple.com/videos/play/wwdc2018/705/ it seems like the minimum I need is something like a Subscription
model with fields userId, productId, originalTransactionId, latestExpiresDate, consumedProductDiscounts, latestReceiptData
.
Is there anything else I need?
Will I be able to properly retrieve other subscription information in the future and augment my table (i.e. the billingRetry
information as suggested in the video for grace periods; my understanding is by sending the saved receipt data I can get the JSON blob again and retrieve additional fields if I need to)?
Is this extensible to co-exist with web and Play Store subscriptions?
These is the models we use to handle the subscription. maybe it helps you.
struct BillingTransaction : Codable {
var expires_date: String
var original_purchase_date: String
var is_in_intro_offer_period: Bool
var product_id: String
var original_transaction_id: Int
var transaction_id: Int
}
struct BillingReceipt : Codable {
var app_item_id: String
var application_version: String
var bundle_id: String
var in_app: [BillingTransaction]
}
struct BillingRenewalInfo : Codable {
var product_id: String
var auto_renew_product_id: String
var auto_renew_status: Int
var is_in_billing_retry_period: Int
var original_transaction_id: Int
}