This is a simple flutter plugin allow using authorize.net using its unique API approach.
This plugin is implemented using very simple methods & models to integrate the authorize.net API.
Please refer to the developer api references for more details: https://developer.authorize.net/api/reference
Note:
Only a limited set of operations are supported for now. Also, all the transactions are Credit card based transactions only.
- Testing Authentication of the client using credentials
- Charge a credit card
- Create an authorized payment for future transaction
- execute pre-authorized payment transaction
- void an existing authorized transaction
Visit https://pub.dev/packages/flutter_authorize_net_client#-installing-tab-
import 'package:flutter_authorize_net_client/flutter_authorize_net_client.dart';
final _client = AuthorizeNetClient(
'5KP3u95bQpv',
'346HZ32z3fP4hTG2',
// provide AuthorizeNetClient.ENV_PRODUCTION here to use production api
environment: AuthorizeNetClient.ENV_TEST,
);
final response = await _client.authenticationTest();
print('isSuccessFul: ${response.isSuccessful}');
final response = await _client.chargeCreditCard(
'5',
'USD'.toLowerCase(),
'5424000000000015',
'2022-12',
'123',
);
print('isSuccessFul: ${response.isSuccessful}');
final response = await _client.authorizeCardPayment(
'5',
'USD'.toLowerCase(),
'5424000000000015',
'2022-12',
'123',
);
print('isSuccessFul: ${response.isSuccessful}');
// keep a reference to transactionID in memory for future use
_refID = response?.transactionResponse?.transId;
final response = await _client.priorAuthCaptureTransaction(
'5',
'USD'.toLowerCase(),
'5424000000000015',
'2022-12',
'123',
);
print('isSuccessFul: ${response.isSuccessful}');
// keep a reference to transactionID in memory for future use
_refID = response?.transactionResponse?.transId;
final response = await _client.voidTransaction(_refID);
print('isSuccessFul: ${response.isSuccessful}');
Some notes regarding API parameters:
- Currency must be in ISO-4217 format
- Value must be passed in lowercase,
i.e
usd
instead ofUSD
,gbp
instead ofGBP
,eur
instead ofEUR
, etc - Currency symbols are not supported
- Value must be passed in lowercase,
i.e
- Amount can be a decimal value
- Up to 15 digits with a decimal point
- This is the total amount and must include tax, shipping, tips, and any other charges.
- File an issue on the repository, if something is not working as expected.
- Please follow the issue template used in flutter-sdk's repository, may be we'll integrate that here as well.
- File an issue in the repository, If you have any suggestions and/or feature requests, use
[Suggestion]
or[FeatureRequest]
tags in issue titles. - To support you just have to help out fellow developers on of the filed issues in this repository.
- To contribute, just follow the standard open source contributions instructions, maybe we can follow the ones used in the flutter sdk. We'll see how it goes.