WalletInfoProvider
The WalletInfoProvider SPI allows the MPP app to supply contextual information to the SDK during transaction tracking. When implemented and registered, the SDK calls getWalletInfo() each time it reports an EVENT_NEW_TRANSACTION event, and appends the returned data to the event parameters.
If this SPI is not implemented, transaction tracking continues unaffected and no wallet-side fields are reported.
Register the implementation using ACTapManager.registerPlugin() together with other plugins during initialization, following the same pattern as TransactionPermit.
manager.registerPlugin(WalletInfoProvider.class, new DemoWalletInfoProvider(context));Method signature
public interface WalletInfoProvider {
@Nullable
WalletInfo getWalletInfo();
class WalletInfo {
public WalletInfo(double latitude, double longitude, boolean isForeground, String extension);
public double getLatitude();
public double getLongitude();
public boolean isForeground();
public String getExtension();
}
}Request parameters
getWalletInfo() takes no parameters. It returns a WalletInfo instance, or null if the information is unavailable. When null is returned, no wallet fields are appended to the event.
Method | Item | Type | Description | Required |
WalletInfo | latitude | double | The latitude of the device at the time of the transaction. | Yes |
longitude | double | The longitude of the device at the time of the transaction. | Yes | |
isForeground | boolean | Indicates whether the wallet app is in the foreground at the time of the transaction. Valid values are:
| Yes | |
extension | String | An extension payload for additional wallet-side data. Omitted when empty. | No |
Response parameters
When getWalletInfo() returns a non-null WalletInfo object, the SDK appends the following fields to the EVENT_NEW_TRANSACTION parameter map.
Item | Type | Description |
latitude | String | The latitude of the device at the time of the transaction. |
longitude | String | The longitude of the device at the time of the transaction. |
is_foreground | String | Indicates whether the wallet app is in the foreground at the time of the transaction. Valid values are:
|
wallet_info_extension | String | An extension payload for additional wallet-side data. Omitted when empty. |
Note: If no WalletInfoProvider is registered,
getWalletInfo()returnsnull, or an exception occurs while reading the wallet info, none of the above fields are reported and the transaction tracking event is still delivered normally.
Sample
The following example shows a basic implementation of WalletInfoProvider and how to register it during SDK initialization.
public class DemoWalletInfoProvider implements WalletInfoProvider {
private final Context context;
public DemoWalletInfoProvider(Context context) {
this.context = context.getApplicationContext();
}
@Nullable
@Override
public WalletInfo getWalletInfo() {
// Return null when the info is unavailable so the SDK skips these fields.
double latitude = getLastKnownLatitude();
double longitude = getLastKnownLongitude();
boolean isForeground = isAppInForeground(context);
String extension = "";
return new WalletInfo(latitude, longitude, isForeground, extension);
}
}