Retrieving Transfer Tokens
You can look up an existing transfer token by specifying its tokenId. As shown in the example below, you can also get the token's complete payload and the associated signatures. Both of the latter are optional.
// fetch a token
public static
Token getToken(Member member
, String tokenId
) {
Token token = member.getTokenBlocking
(tokenId
);
// get token payload
TokenPayload payload
= token.getPayload
();
// get signatures
List<TokenSignature> signatures
= token.getPayloadSignaturesList
();
return
token
;
}
Here's an example of the response you'll receive if you request the token payload:
{
"token": {
"id": "tt:7ECKSivyfXzQzp8fAw9Z4aRkedPCKfPPuNH1MiprEmig:5zKcENpV",
"payload": {
"version": "1.0",
"refId": "jh3y2pckfore57u4qp747k3xrqmix3i7kp9irtdtjmdixgk3xr",
"issuer": {
"username": "iron"
},
"from": {
"id": "m:2YLns17mwhzbNYMofToaP34kFAYx:5zKtXEAq"
},
"expiresAtMs": "1502303565723",
"transfer": {
"redeemer": {
"id": "m:2X16B4ZTwqejz9YC3so9JDkbXL6d:5zKtXEAq",
"username": "iqzsaszle5shuscndt8wfusorrxj8xrvi5fs0l2q5fdb6e0zfr"
},
"instructions": {
"source": {
"account": {
"token": {
"memberId": "m:2YLns17mwhzbNYMofToaP34kFAYx:5zKtXEAq",
"accountId":
"a:GBTQ7DEbbKyo4wKarkkS3NaAMJiMbPnzf595dAELEaWW:5zKcENpV"
}
}
}
},
"currency": "EUR",
"lifetimeAmount": "100",
"pricing": {
"sourceQuote": {
"id": "17aa3c61992f4061bdf04b7bb48eef33",
"accountCurrency": "EUR",
"feesTotal": "0.25",
"fees": [{
"amount": "0.17",
"description": "Transaction Fee"
},
{
"amount": "0.08",
"description": "Initiation Fee"
}],
"expiresAtMs": "1502303565723"
},
"instructions": {
"feesPaidBy": "SHARED_FEE",
"fxPerformedBy": "SHARED_FX"
}
}
}
},
If you request signatures, you'll also receive this:
"payloadSignatures": [{
"action": "ENDORSED",
"signature": {
"memberId": "m:2YLns17mwhzbNYMofToaP34kFAYx:5zKtXEAq",
"keyId": "EVknJb1X_wqpyVc8",
"signature":
"1fO5tXvfB27P4_lYgerjxTyYX1q-n-TUdTmn0w-awEBuG0ml-6jEhkQFQxnDFTzGHlYVodIaggtxegsSV60lCg"
}
},
{
"action": "ENDORSED",
"signature": {
"memberId": "m:36XFB8Cx257rJb265Fa5FAkrXN7M:5zKtXEAq",
"keyId": "rki_qdKsD9al2BQf",
"signature":
"EE3Zk5VF257RFKcWs0JxyrXnkOCXB3EagATzfOSA_q7eltqTq_mUIL-zP8jT2r-vmRPHd_3BBEVTQtxgFuhjDw"
}
}]
},
"status": "SUCCESS"
}
}
Get a Paged List of Tokens
You can get a list of n tokens in order of the most recent, beginning at an offset, for which the TPP member was/is the payee.
The following example returns a list with the ten most recent tokens and an offset that can be used to get the next ten. Calling this method again will generate the next ten tokens in the list, and so forth.
// returns a list of transfer tokens associated with the member
public static
PagedList<Token, String> getTransferTokens
(Member member
) {
// last 10 tokens and offset that can be used to get the next 10
PagedList<Token, String> pagedList
= member.getTransferTokensBlocking
(""
, 10
);
return
pagedList
;
}
Next, let's discuss the method for canceling an active transfer token.