- Make sure issuer app has been installed
- Setup up App schema in AndroidManifest.xml
- Issuer App will launch your App with tspPushToken and cancelUrl
- Parse TspPushToken and cancelUrl from intent data
- Send Push Token API to Tappay server
- You will get a suceess response with cardKey and cardToken
- You may get more card information by Card Metadata API if you want
Setup App schema in AndroidManifest.xml
<activity
android:name="tech.cherri.tokenpushexample.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" >
<!-- please custom your app schema here-->
<data
android:host="mock.merchant.app"
android:scheme="cherri" />
</intent-filter>
</activity>
Fill in partner_key in string.xml
// string.xml
<string name="partner_key">your partner key</string>
TokenPushTask will show you how to send a HTTP POST request to TapPay
//change env to Prod if you has passed your test case in sandbox
env = Env.Sandbox;
...
// JSON request
JSONObject jsonRequest = new JSONObject();
try {
jsonRequest.put("partner_key", partnerKey);
jsonRequest.put("tsp_push_token", tokenPushParam.getTspToken());
} catch (JSONException e) {
Log.e(TAG, "init TokenPushTask error: " + Log.getStackTraceString(e));
}
// onPostExecute , Register a callback if you need to Show Add Card Result in your UI component (MainActivity here)
tokenPushParam.getTokenPushCallback().getTaskResult(jsonObject);