updateSession static method
Update Mastercard session with card details using native Mobile SDK
This method calls the native Android/iOS Mastercard SDK to securely update the session with card data. The card data is encrypted and sent directly to Mastercard without passing through your servers.
Parameters:
sessionId: Session ID from create-session APIcardNumber: Card number (PAN)expiryMonth: Expiry month (MM format)expiryYear: Expiry year (YY or YYYY format)cvv: Card verification valuecardholderName: Name on card (optional)
Returns: Success message or throws exception on failure
Implementation
static Future<String?> updateSession({
required String sessionId,
required String cardNumber,
required String expiryMonth,
required String expiryYear,
required String cvv,
String? cardholderName,
}) async {
try {
final result = await _channel.invokeMethod('updateSession', {
"sessionId": sessionId,
"cardNumber": cardNumber,
"expiryMonth": expiryMonth,
"expiryYear": expiryYear,
"cvv": cvv,
"cardholderName": cardholderName ?? "",
});
return result as String?;
} on PlatformException catch (e) {
throw Exception('Failed to update session: ${e.message}');
}
}