cloudpayments_api 1.0.3 cloudpayments_api: ^1.0.3 copied to clipboard
This package allows implementing payment acceptance into mobile, web, desktop apps and works as an extension to the CloudPayments API
cloudpayments_api #
Dart REST client for CloudPayments API
Get started #
Add dependency #
dependencies:
cloudpayments_api: ^1.0.3
Simple to use #
import 'package:cloudpayments_api/cloudpayments_api.dart';
import 'package:dio/dio.dart';
void main() async {
final paymentRequest = CardPaymentRequest(
amount: '100',
ipAddress: 'YOUR_IP_ADDRESS',
cardCryptogramPacket: 'cryptogram_packet',
);
final dio = Dio();
final cloudPaymentsApi = CloudPaymentsApi(
dio,
cpAuthCredentials: const CpAuthCredentials(
publicID: 'YOUR_PUBLIC_ID',
apiPassword: 'YOUR_API_PASSWORD',
),
);
final result = await cloudPaymentsApi.chargeCryptogramPayment(paymentRequest);
result.when(
success: (TransactionInfo info) {},
incorrectlyRequest: (message) {},
required3dsecure: (Three3DSecureResponse response) {},
error: (TransactionInfo info) {},
);
}