4

Is there a way to get the buyer's email after purchasing using the google wallet,

I am using the IabHelper.launchSubscriptionPurchaseFlow, and there is only two objects retrieved (IabResult and Purchase) after the success purchasing (Subscription), but unfortunately no one of them contains the buyer's email.

The senario is, if a user has more than one Email connected to his Android Device, and he has a credit card connected to one of the his secondary emails, i need to get the email address that used to purchasing to use it in the server side.

I hope to find some one helping me in this issue, because i spend many time of searching about this issue and unfortunately i didn't found the solution.

Best Regards

1 Answers1

-1

I think in successful purchase response you can not get the buyer's email to stored.

So it will be possible by using AccountManager class for that you just call this following method in onIabPurchaseFinished.

public static String getemailId(Activity act){
        Pattern emailPattern = Patterns.EMAIL_ADDRESS;
        Account[] accounts= AccountManager.get(act).getAccounts();
        String userEmailId="";
        for (Account account : accounts) {
            if (emailPattern.matcher(account.name).matches()) {
                userEmailId = account.name;

            }
        }
        return userEmailId;
}

This method will returns you the email_id of buyer to stored for future purpose.

Hope it will helps you a lot.

Born To Win
  • 3,319
  • 3
  • 19
  • 27
  • 2
    This is not the solution. It can give all the email id's on the device but it cannot tell which id was used to make the purchase. – A.J. Jan 04 '15 at 17:01