createMultipleUseToken method
Future<TokenResult>
createMultipleUseToken(
- XCard card, {
- String onBehalfOf = '',
- BillingDetails? billingDetails,
- Customer? customer,
Creates a multiple-use token. Authentication must be created separately if shouldAuthenticate is true.
@param card A credit card @param onBehalfOf The onBehalfOf is sub account business id @param billingDetails Billing details of the card @param customer Customer linked to the payment method
Implementation
Future<TokenResult> createMultipleUseToken(
XCard card, {
String onBehalfOf = '',
BillingDetails? billingDetails,
Customer? customer,
}) async {
var params = <String, dynamic>{
'publishedKey': publishedKey,
'card': card.to(),
'onBehalfOf': onBehalfOf,
};
if (billingDetails != null) {
params['billingDetails'] = billingDetails.to();
}
if (customer != null) {
params['customer'] = customer.to();
}
try {
var result = await _channel.invokeMethod('createMultiToken', params);
return TokenResult(token: Token.from(result));
} on PlatformException catch (e) {
return TokenResult(
errorCode: e.code,
errorMessage: e.message ?? '',
);
}
}