Payment

final class Payment

Class providing methods linked with payments.

  • Contact InPlayer server and validate if purchase was successfull.

    Declaration

    Swift

    public static func validate(receiptString: String,
                                productIdentifier: String,
                                success: @escaping ()-> Void,
                                failure: @escaping (_ error: InPlayerError) -> Void)

    Parameters

    receiptString

    Base64EncodedString of the recept data stored on device after successfull in-app purchase.

    productIdentifier

    String combination of itemId and accessFeeId, connected with _

    success

    A closure to be executed once the request has finished successfully.

    failure

    A closure to be executed once the request has finished with error.

    error

    Containing information about the error that occurred.

  • Contact InPlayer server and validate if purchase was successfull.

    Declaration

    Swift

    public static func validateByProductName(productName: String,
                                             receipt: String,
                                             success: @escaping () -> Void,
                                             failure: @escaping (_ error: InPlayerError) -> Void)

    Parameters

    productName

    Purchased product name

    receipt

    Base64EncodedString of the recept data stored on device after successfull in-app purchase.

    success

    A closure to be executed once the request has finished successfully.

    failure

    A closure to be executed once the request has finished with error.

    error

    Containing information about the error that occurred.

  • Gets the purchase history

    Declaration

    Swift

    public static func getPurchaseHistory(status: PurchaseHistory = .all,
                                          page: Int,
                                          limit: Int,
                                          type: String? = nil,
                                          customerId: Int? = nil,
                                          success: @escaping (_ purchaseHistory: InPlayerCustomerPurchaseHistory) -> Void,
                                          failure: @escaping (_ error: InPlayerError) -> Void)

    Parameters

    status

    The status of the purchase - all/active/inactive.

    page

    The current pag

    limit

    The number of items per page

    type

    Type

    customerId

    Account’s id

    success

    A closure to be executed once the request has finished successfully.

    purchaseHistory

    Purchase history model containing list of all purchased access items.

    failure

    A closure to be executed once the request has finished with error.

    error

    Containing information about the error that occurred.