GADDefaultInAppPurchaseDelegate

@protocol GADDefaultInAppPurchaseDelegate <NSObject>

In-app purchase delegate protocol for default purchase handling. The delegate must deliver the purchased item then call the GADDefaultInAppPurchase object’s finishTransaction method.

  • Called when the user successfully paid for a purchase. You must first deliver the purchased item to the user, then call defaultInAppPurchase’s finishTransaction method.

    Declaration

    Swift

    func userDidPay(for defaultInAppPurchase: GADDefaultInAppPurchase)

    Objective-C

    - (void)userDidPayForPurchase:
        (nonnull GADDefaultInAppPurchase *)defaultInAppPurchase;
  • Called when the user clicks on the buy button of an in-app purchase ad. Return YES if the default purchase flow should be started to purchase the item, otherwise return NO. If not implemented, defaults to YES.

    Declaration

    Swift

    optional func shouldStartPurchase(forProductID productID: String, quantity: Int) -> Bool

    Objective-C

    - (BOOL)shouldStartPurchaseForProductID:(nonnull NSString *)productID
                                   quantity:(NSInteger)quantity;