Sync Response
Response Handling
The result of the transaction can be listened by the application with the method:
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { ... }
The resultCode indicates if the transaction went successfully (Activity.RESULT_OK) or not (Activity.RESULT_CANCELED)
When the transaction is successful, the data intent also contains the id of the finished transaction and it can be obtained by using the following:
data.getExtras().get("transaction_hash");
Also in the response intent it's possible to get the response code of the transaction with the following:
data.getExtras().getInt(RESPONSE_CODE)
Check in the following table the returned response codes.
Response Codes
Response Code | Description |
---|---|
0 | Success |
1 | User pressed back or canceled a dialog |
2 | The network connection is down |
3 | This billing API version is not supported for the type requested |
4 | Requested product (aka SKU) is not available for purchase |
5 | Invalid arguments provided to the API |
6 | Fatal error during the API action |
7 | Failure to purchase since item is already owned |
8 | Failure to consume since item is not owned |
Updated about 5 years ago