Search code examples
androidin-app-purchasein-app-billing

Android anjlab in-app billing


So I am using the anjlab in-app billing and it is working except I want to get the order ID so I can store it on my server. (This way if the user has a problem I can find the transaction) How do I get the orderID? I am unclear on this part.

Link to the github I am using to get the transaction details: https://github.com/anjlab/android-inapp-billing-v3

Here is my code:

public final String orderId;

@Override
public void onProductPurchased(String productId, TransactionDetails details) 
{
/* Called when requested PRODUCT ID was successfully purchased */

    Log.e(TAG, "Details: " + details);
}

Here is what TransactionDetails details shows when I Log it:

android.test.purchased purchased at 
null(transactionId.android.test.purchased). Token: 
inapp:com.mytestapp:android.test.purchased, Signature: null

Solution

  • Try as follows -

    String orderId = details.orderId; 
    Log.e(TAG, "Details: " + orderId);