-
Notifications
You must be signed in to change notification settings - Fork 6
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
Omnisub 5499 - Upgrade/downgrade subscription #98
base: master
Are you sure you want to change the base?
Changes from 20 commits
79acc6c
08d0006
942e453
94f2f6f
203dc88
e8cd2e6
c6b1758
83b7702
e66769f
08616b0
484d8b9
27c85e6
7b706ca
56593af
62c3248
803326f
159809a
7e0d6da
ecb90c4
90f39e3
2c98f6a
86676e1
f8b63b0
ba2d1a7
e9c5422
418c231
fb2ae76
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,6 +161,29 @@ CBPurchase.purchaseProduct(purchaseProductParams = purchaseProductParams, custom | |
``` | ||
The above function will handle the purchase against Google Play Store and send the IAP token for server-side token verification to your Chargebee account. Use the Subscription ID returned by the above function, to check for Subscription status on Chargebee and confirm the access - granted or denied. | ||
|
||
### Upgrade or Downgrade Product | ||
Pass the `ChangeProductParams` and `CBCustomer` to the following function when the user chooses the product to purchase. | ||
|
||
`CBCustomer` - **Optional object**. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add the full description similar to the previous examples. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
|
||
**Note**: The `customer` parameter in the below code snippet is an instance of `CBCustomer` class that contains the details of the customer who wants to subscribe or buy the product. | ||
|
||
```kotlin | ||
val changeProductParams = ChangeProductParams(newProductParams, "currentProductId") | ||
val cbCustomer = CBCustomer("customerId","firstName","lastName","email") | ||
CBPurchase.changeProduct(changeProductParams = changeProductParams, customer = cbCustomer, object : CBCallback.PurchaseCallback<String>{ | ||
override fun onSuccess(result: ReceiptDetail, status:Boolean) { | ||
Log.i(TAG, "$status") | ||
Log.i(TAG, "${result.subscription_id}") | ||
Log.i(TAG, "${result.plan_id}") | ||
} | ||
override fun onError(error: CBException) { | ||
Log.e(TAG, "Error: ${error.message}") | ||
} | ||
}) | ||
``` | ||
The above function will handle the subscription upgrade or downgrade. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems redundant. Can we rephrase this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be |
||
### Invoke Manage Subscriptions in your App | ||
The `showManageSubscriptionsSettings()` function is designed to invoke the Manage Subscriptions in your app using Chargebee's Android SDKs. `Chargebee.showManageSubscriptionsSettings()`, opens the Play Store App subscriptions settings page. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="300dp" | ||
android:layout_height="300dp" | ||
tools:context=".MainActivity"> | ||
|
||
<com.google.android.material.textfield.TextInputLayout | ||
android:id="@+id/planIdInputLayout" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="96dp" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/textView"> | ||
|
||
<EditText | ||
android:id="@+id/productIdInput" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:ems="13" | ||
android:inputType="textPersonName" /> | ||
</com.google.android.material.textfield.TextInputLayout> | ||
|
||
<com.google.android.material.textfield.TextInputLayout | ||
android:id="@+id/currentPlanIdInputLayout" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="20dp" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintHorizontal_bias="0.497" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/textView"> | ||
|
||
<EditText | ||
android:id="@+id/currentProductIdInput" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:ems="13" | ||
android:inputType="textPersonName" /> | ||
</com.google.android.material.textfield.TextInputLayout> | ||
|
||
<TextView | ||
android:id="@+id/textView" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="20dp" | ||
android:text="Chargebee" | ||
android:textSize="24sp" | ||
android:textStyle="bold" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<Button | ||
android:id="@+id/btn_ok" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="34dp" | ||
android:text="Submit" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/planIdInputLayout" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we mention the function name rather than only saying "to the following function..."? It will make the sentence more clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pass the
ChangeProductParams
andCBCustomer
to the followingChangeProduct
function when the user chooses the product to purchase.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cb-sabuj Done