diff --git a/README.md b/README.md index 4cf3af0..71bc6d4 100644 --- a/README.md +++ b/README.md @@ -164,7 +164,7 @@ const customer: Customer = { lastName: 'lname', email: 'fname@domain.com', }; -const productType = ProductType.non_consumable +const productType = ProductType.NON_CONSUMABLE try { const result: OneTimePurchase = await Chargebee.purchaseNonSubscriptionProduct("product-id", productType, customer); console.log(result); @@ -177,7 +177,7 @@ The given code defines a function named `purchaseNonSubscriptionProduct` in the - `product`: An instance of `Product` class, representing the product to be purchased from the Apple App Store or Google Play Store. - `customer`: Optional. An instance of `CBCustomer` class, initialized with the customer's details such as `customerId`, `firstName`, `lastName`, and `email`. -- `productType`: An enum instance of `productType` type, indicating the type of product to be purchased. It can be either .`consumable`, or `non_consumable`, or `non_renewing_subscription`. Note that `non_renewing_subscription` is supported only in Apple App Store. +- `productType`: An enum instance of `productType` type, indicating the type of product to be purchased. It can be either .`consumable`, or `non_consumable`, or `non_renewing_subscription` Note that `non_renewing_subscription` is supported only in Apple App Store. The function is called asynchronously, and it returns a `Result` object with a `success` or `failure` case, as mentioned are below. - If the purchase is successful, it returns `OneTimePurchase` object. which includes the `invoiceId`, `chargeId`, and `customerId` associated with the purchase. @@ -324,7 +324,7 @@ const customer: Customer = { lastName: 'lname', email: 'fname@domain.com', }; -const productType = ProductType.non_consumable +const productType = ProductType.NON_CONSUMABLE try { const result: OneTimePurchase = await Chargebee.validateReceiptForNonSubscriptions(productId, productType, customer) } catch (error) { diff --git a/ios/ChargebeeHelper.swift b/ios/ChargebeeHelper.swift index 5c51bb0..d199106 100644 --- a/ios/ChargebeeHelper.swift +++ b/ios/ChargebeeHelper.swift @@ -289,7 +289,7 @@ public class ChargebeeHelper: NSObject { } private func convertStringToProductType(productTypeString: String)-> ProductType{ - let productType: ProductType! + let productType: ProductType if productTypeString == ProductType.Consumable.rawValue{ productType = .Consumable }else if productTypeString == ProductType.NonConsumable.rawValue{