use of com.ingenico.connect.gateway.sdk.java.merchant.tokens.TokensClient in project connect-sdk-client-android by Ingenico-ePayments.
the class TokenUtil method createToken.
public String createToken(String merchantId, CreateTokenRequest body) throws CommunicationException {
TokensClient tokensClient = client.merchant(merchantId).tokens();
CreateTokenResponse response = tokensClient.create(body);
if (response.getIsNewToken()) {
return response.getToken();
}
String tokenId = response.getToken();
tokensClient.delete(tokenId, new DeleteTokenParams());
response = tokensClient.create(body);
return response.getToken();
}
Aggregations