0 purchases
checkout sdk flutter
Checkout SKD for Flutter #
A Flutter plugin that wraps the Checkout.com's tokenization API in order to allow the tokenization for
card details as well as Apple Pay and Google Pay payloads.
Installation #
Add checkout_sdk_flutter to your pubspec.yaml file:
dependencies:
...
checkout_sdk_flutter: <version>
copied to clipboard
Usage #
If our team did not create an account for you already, you can create one here.
Once you have an account you should have access to your public API key.
Import the plugin in your code:
import 'package:johnnysdk_flutter/checkout_sdk_flutter.dart';
copied to clipboard
Initialize the SDK with your public key:
var cko = new Checkout(publicKey: "your_key");
copied to clipboard
Note that the SDK will automatically determine what environment to use based on the key you provide.
Tokenize a card
final request = CardTokenizationRequest(
number: "4242424242424242",
expiryMonth: 11,
expiryYear: 2029,
cvv: "100",
name: "John Smith");
var res = await cko.tokenizeCard(request);
copied to clipboard
Tokenize an ApplePay payload
final request = ApplePayTokenizationRequest(
tokenData: AppleTokenData(
version: 'EC_v1',
data: 'XXXXXX',
signature: 'XXXXXX',
header: AppleHeader(
ephemeralPublicKey: 'XXXXXX',
publicKeyHash: 'XXXXXX',
transactionId: 'XXXXXX')),
);
var res = await cko.tokenizeApplePay(request);
copied to clipboard
Tokenize a GooglePay payload
final request = GooglePayTokenizationRequest(
tokenData: GoogleTokenData(
signature: 'XXX', protocolVersion: 'XXX', signedMessage: "XXX"),
);
var res = await cko.tokenizeGooglePay(request);
copied to clipboard
Handle exemptions
try {
// sdk action
} on UnauthorizedError catch (exception) {
// handle UnauthorizedError
} on InvalidDataError catch (exception) {
// handle InvalidDataError
} catch (error) {
// handle any other exemptions
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.