logout static method

Future logout(
  1. String merchantId
)

Logs out the current merchant by invalidating the access token.

While access tokens automatically expire, it's strongly recommended to explicitly invalidate them when a merchant's session ends on the server.

Relying solely on token expiration can introduce security vulnerabilities and result in a suboptimal user experience.

Calling this method ensures that the merchant's session is terminated, preventing any further authenticated requests until a new login is performed.

Example usage:

class MyPayEngineManager {
  void merchantDidLogout() async {
    const merchantId = "your_merchant_id_here";
    await PayEngineNative.logout(merchantId);
    print("Merchant session terminated.");
  }
}

This ensures that no further authenticated requests can be made until a new access token is obtained.

Note: After calling logout, a new access token must be fetched before making further API requests.

merchantId The unique identifier of the merchant whose session should be invalidated.

Implementation

static Future logout(String merchantId) async {
  await _channel.invokeMethod("logout", {
    "merchantId": merchantId,
  });
}