The Airship SDK provides tools to create Wallet passes and deep link them to Google Pay.
Create a pass request
Field field = new Field.Builder()
.setName("text")
.setValue("text value")
.setLabel("text label")
.build();
PassRequest passRequest = PassRequest.newBuilder()
.setAuth("User Name", "Airship API key")
.setTemplateId("template ID")
.addField(field)
.setTag("tag")
.build();
val field: Field = Field.Builder()
.setName("text")
.setValue("text value")
.setLabel("text label")
.build()
val passRequest = PassRequest.newBuilder()
.setAuth("User Name", "Airship API key")
.setTemplateId("template ID")
.addField(field)
.setTag("tag")
.build()
Execute the pass request to fetch a pass object
passRequest.execute(new Callback() {
@Override
public void onResult(Pass pass) {
// Handle the pass
}
@Override
public void onError(int errorCode) {
if (errorCode >= 500) {
// retry
}
}
});
passRequest.execute(object : Callback {
override fun onResult(pass: Pass) {
// Handle the pass
}
override fun onError(errorCode: Int) {
if (errorCode >= 500) {
// retry
}
}
})
Pass requests can be canceled at any time
passRequest.cancel();
passRequest.cancel()
Prompt the user to add the pass
pass.requestToSavePass(getApplicationContext());
pass.requestToSavePass(applicationContext)