Skip to content

shahzadc/flutter_authorize_net_client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flutter_authorize_net_client

pub package License: MIT

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.

Supported Operations:

Install plugin:

Visit https://pub.dev/packages/flutter_authorize_net_client#-installing-tab-

Import library:

import 'package:flutter_authorize_net_client/flutter_authorize_net_client.dart';

Usage Examples:

Create Client instance:

final _client = AuthorizeNetClient(
                  '5KP3u95bQpv',
                  '346HZ32z3fP4hTG2',
                  // provide AuthorizeNetClient.ENV_PRODUCTION here to use production api
                  environment: AuthorizeNetClient.ENV_TEST,
                );

Test Authentication:

    final response = await _client.authenticationTest();
    print('isSuccessFul: ${response.isSuccessful}');

Charge a credit card:

    final response = await _client.chargeCreditCard(
      '5',
      'USD'.toLowerCase(),
      '5424000000000015',
      '2022-12',
      '123',
    );
    print('isSuccessFul: ${response.isSuccessful}');

Pre-Authorize payment:

    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;

Execute Pre-Authorize payment:

    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;

Void payment:

    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 of USD, gbp instead of GBP, eur instead of EUR, etc
    • Currency symbols are not supported
  • 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.

Contribution/Support

  • 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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 94.6%
  • HTML 3.7%
  • Other 1.7%