Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type of ReceiptInfo = [String: AnyObject], but it needs to be actual type #65

Closed
Joker666 opened this issue Aug 8, 2016 · 2 comments
Closed
Assignees

Comments

@Joker666
Copy link

Joker666 commented Aug 8, 2016

The receipt validation info for non-consumables contains all the history of previously purchased products. But the type is just a dictionary.

ReceiptInfoField is just an enum of string.

The RMStore has an actual type for receipts https://github.com/robotmedia/RMStore/blob/master/RMStore/Optional/RMAppReceipt.h

@bizz84
Copy link
Owner

bizz84 commented Aug 20, 2016

Apologies for the late reply.

@Joker666 Just to clarify what needs to be implemented, are you suggesting to modify the InAppReceipt.verify() method so that the completion block returns a strong-typed ReceiptInfo type, with all relevant fields parsed from the JSON data?

In other words, refactor this:

typealias ReceiptInfo = [String: AnyObject]

to:

struct ReceiptInfo {
  // All relevant fields, same as declared in `RMAppReceiptIAP`
}

For reference, this Stack overflow thread summarises quite well the topic of receipt validation, with information about how it's been done on RMStore: http://stackoverflow.com/questions/19943183/a-complete-solution-to-locally-validate-an-in-app-receipts-and-bundle-receipts-o

@bizz84 bizz84 self-assigned this Oct 19, 2016
@bizz84
Copy link
Owner

bizz84 commented May 11, 2017

Release 0.9.0 introduces a ReceiptItem type:

public struct ReceiptItem {
    // The product identifier of the item that was purchased. This value corresponds to the productIdentifier property of the SKPayment object stored in the transaction’s payment property.
    public let productId: String
    // The number of items purchased. This value corresponds to the quantity property of the SKPayment object stored in the transaction’s payment property.
    public let quantity: Int
    // The transaction identifier of the item that was purchased. This value corresponds to the transaction’s transactionIdentifier property.
    public let transactionId: String
    // For a transaction that restores a previous transaction, the transaction identifier of the original transaction. Otherwise, identical to the transaction identifier. This value corresponds to the original transaction’s transactionIdentifier property. All receipts in a chain of renewals for an auto-renewable subscription have the same value for this field.
    public let originalTransactionId: String
    // The date and time that the item was purchased. This value corresponds to the transaction’s transactionDate property.
    public let purchaseDate: Date
    // For a transaction that restores a previous transaction, the date of the original transaction. This value corresponds to the original transaction’s transactionDate property. In an auto-renewable subscription receipt, this indicates the beginning of the subscription period, even if the subscription has been renewed.
    public let originalPurchaseDate: Date
    // The primary key for identifying subscription purchases.
    public let webOrderLineItemId: String
    // The expiration date for the subscription, expressed as the number of milliseconds since January 1, 1970, 00:00:00 GMT. This key is only present for auto-renewable subscription receipts.
    public let subscriptionExpirationDate: Date?
    // For a transaction that was canceled by Apple customer support, the time and date of the cancellation. Treat a canceled receipt the same as if no purchase had ever been made.
    public let cancellationDate: Date?

    public let isTrialPeriod: Bool
}

Closing this as it's now resolved.

@bizz84 bizz84 closed this as completed May 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants