Sattar Hummatli
Sattar Hummatli

Reputation: 1408

How to insert promo code inside my android application to buy items?

I have implemented InApp Purchases in my app and works correctly. Now want to use promo code to get items freely.

In documentation it says: Your app should allow users to redeem promo codes inside the app itself. If your app supports the in-app purchase workflow (described in Making In-app Billing requests), your app automatically supports in-app redemption of promo codes. When you launch the in-app purchase UI, the user has the option to pay for the purchase with a promo code. https://developer.android.com/google/play/billing/billing_promotions.html

But in my application there is not any option to select for promo code. There is only buy option. How can user insert promo code inside app?

These images from PlayStore app. There is Redeem dialog looks like peyment dialog. It is possible to open it from play store app as described in this article and on following images. I can insert my promo code follwing this flow and it works. http://www.greenbot.com/article/3043048/android/how-to-redeem-a-google-play-store-promo-code.html.
enter image description here Redeem dialog

Upvotes: 1

Views: 5463

Answers (2)

Paris N. Salguero
Paris N. Salguero

Reputation: 120

When the user click on buy button, in the list of payment methods, exist an option to redeem a promo code, you can send to your user the code and he can redeem it using this payment method in the payment flow or he can reddem it going to the Play Store and click redeem, there your user should insert the promo code an follow the stepts to redeem it

Upvotes: -2

Codelaby
Codelaby

Reputation: 2873

In this SO your found solution

Adapt the code

String code = "request code with dialog"
try {
    String url = "https://play.google.com/redeem?code=" + URLEncoder.encode(code, "UTF-8");
    context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
} catch (android.content.ActivityNotFoundException e) {
  // Play Store app is not installed
}

Upvotes: 6

Related Questions