omise_dart 0.2.0 copy "omise_dart: ^0.2.0" to clipboard
omise_dart: ^0.2.0 copied to clipboard

A Dart SDK that serves as an API wrapper for the Omise API.

example/omise_dart_example.dart

import 'package:omise_dart/omise_dart.dart';

Future<void> main() async {
  // Initialize the Omise API with your public and secret keys
  final omiseApi = OmiseApi(
    publicKey: "your_public_key_here", // Replace with your actual public key
    secretKey: "your_secret_key_here", // Replace with your actual secret key
    enableDebug: true, // Enables debug logging
  );

  // Create a token using card details
  final createTokenRequest = CreateTokenRequest(
    name: "Name",
    number: "4242424242424242", // Example test card number
    expirationMonth: "09", // Card expiry month
    expirationYear: "27", // Card expiry year
  );

  // Call the Omise API to create a token
  final token = await omiseApi.tokens.create(createTokenRequest);

  print('Token created: ${token.id}');

  // Retrieve token information using the token ID
  final retrievedToken = await omiseApi.tokens.get(token.id);

  print('Token retrieved: ${retrievedToken.id}');

  // Fetch capability information from the Omise API
  final capability = await omiseApi.capability.get();

  print('Capability retrieved: ${capability.country}');
}
0
likes
140
pub points
33%
popularity

Publisher

verified publisheropn.ooo

A Dart SDK that serves as an API wrapper for the Omise API.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

http

More

Packages that depend on omise_dart