You can get token and order id parsing the response from 'getPurchases'
https://developer.android.com/google/play/billing/billing_reference.html#getPurchases
But it is easer if you use IabHelper from TrialDrive Sample .
https://github.com/googlesamples/android-play-billing/tree/master/TrivialDrive
There you app you can retrieve the token from the purchase object which you obtain starting a queryInventory:
IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
Log.d(TAG, "Query inventory finished.");
// Have we been disposed of in the meantime? If so, quit.
if (mHelper == null) return;
// Is it a failure?
if (result.isFailure()) {
Log.d(TAG, "Failed to query inventory: " + result);
return;
}
Purchase premiumMonthly = inventory.getPurchase(SKU_SUSCRIPTION);
if (premiumMonthly != null && premiumMonthly.isAutoRenewing()) {
String token = premiumMonthly.getToken();
String orderid = premiumMonthly.getOrderId();
Log.d(TAG, token);
Log.d(TAG, orderid);
}
}
....
mHelper.queryInventoryAsync(mGotInventoryListener);