public interface PayClient implements HasApiKey<Api.ApiOptions.NotRequiredOptions>
Interface for Pay API.
Nested Class Summary
@interface | PayClient.RequestType | All possible request types that will be used by
callers of
PayClient.getPayApiAvailabilityStatus(int) . |
|
@interface | PayClient.SavePassesResult | Possible result codes passed back in
onActivityResult() when calling
PayClient.savePasses(String, Activity, int) or
PayClient.savePassesJwt(String, Activity, int) . |
Constant Summary
String | EXTRA_API_ERROR_MESSAGE | Debug message passed back in
onActivityResult() when calling
savePasses(String, Activity, int) or
savePassesJwt(String, Activity, int) . |
Public Method Summary
abstract Task<Integer> |
getPayApiAvailabilityStatus(int requestType)
Gets the
PayApiAvailabilityStatus
of the current user and device.
|
abstract void |
savePasses(String json,
Activity
activity, int requestCode)
Saves one or multiple passes in a JSON format.
|
abstract void |
savePassesJwt(String jwt,
Activity
activity, int requestCode)
Saves one or multiple passes in a JWT format.
|
Constants
public static final String EXTRA_API_ERROR_MESSAGE
Debug message passed back in onActivityResult()
when calling
savePasses(String, Activity, int)
or
savePassesJwt(String, Activity, int)
.
public void onActivityResult(int requestCode, int resultCode, Intent data) {
...
if (resultCode == PayClient.SavePassesResult.SAVE_ERROR && data != null) {
String errorMessage = data.getStringExtra(PayClient.EXTRA_API_ERROR_MESSAGE);
...
}
...
}
Constant Value:
"extra_api_error_message"
Public Methods
public abstract Task<Integer> getPayApiAvailabilityStatus (int requestType)
Gets the PayApiAvailabilityStatus
of the current user and device.
Parameters
requestType | A PayClient.RequestType
for how the API will be used. |
---|
Returns
- One of the possible
PayApiAvailabilityStatus
.
public abstract void savePasses (String json, Activity activity, int requestCode)
Saves one or multiple passes in a JSON format.
Must be called from an Activity
.
Parameters
json | A JSON string request to save one or multiple passes. The JSON format is consistent with the JWT save link format. Refer to Google Pay API for Passes for an overview on how save links are generated. Only focus on how the JSON is formatted. There is no need to sign the JSON string. |
---|---|
activity | The Activity that will receive the callback result. |
requestCode | An integer request code that will be passed back in
onActivityResult() , allowing you to identify whom this result came
from. |
public abstract void savePassesJwt (String jwt, Activity activity, int requestCode)
Saves one or multiple passes in a JWT format.
Must be called from an Activity
.
Parameters
jwt | A JWT string token to save one or multiple passes. The token format is the same used in the JWT save link format. Refer to Google Pay API for Passes for an overview on how save links are generated. |
---|---|
activity | The Activity that will receive the callback result. |
requestCode | An integer request code that will be passed back in
onActivityResult() , allowing you to identify whom this result came
from. |