Google Wallet deep links

Use the Airship Android SDK to programmatically create and deep link Google Wallet passes in your app.

The following examples demonstrate how to create and deep link Google Wallet passes with the Airship Android SDK.

Create a pass request

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()
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();

Execute the pass request to fetch a pass object

passRequest.execute(object : Callback {
    override fun onResult(pass: Pass) {
        // Handle the pass
    }

    override fun onError(errorCode: Int) {
        if (errorCode >= 500) {
            // retry
        }
    }
})
passRequest.execute(new Callback() {
    @Override
    public void onResult(Pass pass) {
        // Handle the pass
    }

    @Override
    public void onError(int errorCode) {
        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(applicationContext)
pass.requestToSavePass(getApplicationContext());