cloudpayments_sdk library

CloudPayments for Flutter.

Card validation and formatting in pure Dart, cryptogram generation through the official CloudPayments native SDKs, the Payment API over HTTPS, and 3-D Secure in a native WebView screen.

Start with CloudpaymentsSdk:

final cp = CloudpaymentsSdk(publicId: 'pk_xxxxxxxxxxxxxxxxxxxxxxxxx');
final result = await cp.pay(
  card: CardData(number: '4111111111111111', expiryDate: '12/30', cvv: '123'),
  details: const PaymentDetails(amount: 100, currency: Currency.rub),
);

Card data must never be logged, persisted, or sent anywhere other than through CloudpaymentsSdk.createCryptogram. Keep it in memory only for as long as it takes to build a cryptogram.

Classes

BinInfo
What CloudPayments knows about a card's issuing bank, looked up from the first six digits of the card number.
CardData
Raw card details, on their way to being encrypted.
CardNumberInputFormatter
Groups a card number as the user types — 4111 1111 1111 1111 — using the grouping of the detected payment system, and caps the length at 19 digits.
CardPaymentRequest
A payment made with card data that has been encrypted into a cryptogram.
CardUtils
Pure-Dart validation, detection and formatting helpers for card data.
CloudpaymentsApiClient
A typed client for the CloudPayments Payment API.
CloudpaymentsPublicKey
The RSA public key CloudPayments issues for encrypting card data, together with the version the gateway needs in order to pick the matching private key.
CloudpaymentsRecurrent
Instructions to create a subscription alongside a payment.
CloudpaymentsSdk
The entry point of the package: card data in, paid transaction out.
CloudpaymentsSdkPlatform
The interface every platform implementation of this plugin must satisfy.
CvvInputFormatter
Restricts input to the digits of a security code, sized for the payment system of the card number returned by cardNumber.
ExpiryDateInputFormatter
Formats an expiry date as MM/yy while typing, clamping an obviously wrong leading month digit (4 becomes 04).
FormPaymentClosed
The user closed the form without paying. No money moved.
FormPaymentFailed
The payment did not go through — declined, or failed somewhere in the form.
FormPaymentSucceeded
The payment succeeded.
MethodChannelCloudpaymentsSdk
The default CloudpaymentsSdkPlatform, talking to the Android and iOS implementations over a MethodChannel.
Payer
Payer details sent in the Payer object of a payment request.
PaymentCancelled
The cardholder dismissed the 3-D Secure screen without finishing.
PaymentDeclined
The issuer refused the payment.
PaymentDetails
Everything about a payment except how it is paid for.
PaymentFailure
The payment could not be completed for a reason that is neither a decline nor a cancellation — most often 3-D Secure authentication that failed.
PaymentFormOptions
Options for the ready-made CloudPayments payment form.
PaymentFormResult
The outcome of the ready-made CloudPayments payment form.
PaymentRequiresThreeDs
The issuer wants the cardholder to authenticate before the payment can go ahead.
PaymentResult
The outcome of a payment.
PaymentSuccess
The payment went through.
Receipt
A fiscal receipt (кассовый чек) to be registered alongside the payment.
ReceiptAmounts
How the receipt total is split across payment methods.
ReceiptItem
A single line on a fiscal receipt.
ThreeDsCallbackResult
The answer from payments/ThreeDSCallback, the endpoint that finishes a 3-D Secure payment for clients that only have a Public ID.
ThreeDsCancelled
The user dismissed the 3-D Secure screen before finishing.
ThreeDsChallenge
The 3-D Secure challenge a transaction is waiting on.
ThreeDsFailure
Authentication failed: the ACS returned something other than a valid callback, or the issuer refused the challenge.
ThreeDsResult
The outcome of the native 3-D Secure screen.
ThreeDsSuccess
The cardholder completed authentication and the ACS posted its result back.
TokenPaymentRequest
A repeat payment against a card token from an earlier payment made with saveCard: true.
Transaction
A CloudPayments transaction — the Model object of a payment response.

Enums

CardSystem
Payment systems recognised by CloudPayments.
CloudpaymentsPaymentMethod
The payment methods the ready-made form can offer.
CultureName
The language CloudPayments uses for cardholder-facing messages and notification emails, sent as CultureName.
Currency
Currencies CloudPayments accepts, as ISO 4217 alphabetic codes.
EmailFieldBehavior
How the form treats the email field.
RecurrentInterval
How often a subscription charges.
TaxationSystem
The taxation system reported on a fiscal receipt (54-ФЗ).
TransactionStatus
The lifecycle state of a transaction, as reported in Model.Status.
VatRate
VAT rate applied to a receipt line.

Exceptions / Errors

CloudpaymentsApiException
CloudPayments rejected the request itselfSuccess: false with a Message and no transaction: a bad Public ID, a missing amount, a malformed cryptogram. No payment was attempted.
CloudpaymentsConfigurationException
The package was used incorrectly — pay() before init(), an empty Public ID, a request that needs the API secret when only a Public ID is set, and so on. These are programming errors; they should not reach production.
CloudpaymentsCryptogramException
The native SDK could not build a card cryptogram.
CloudpaymentsException
Base class for the failures this package throws.
CloudpaymentsNetworkException
The request never reached CloudPayments, or the response could not be read: no connectivity, a timeout, a TLS failure, a 5xx, or a non-JSON body.