get_net
使用getnet api进行支付的包
入门
此项目是Dart的起点
包,
一个库模块,其中包含可以轻松共享的代码
多个Flutter或Dart项目。
要开始使用Flutter,请查看getnet
在线文档,其中提供了教程,
示例、移动开发指南和完整的 API 参考。
用法
您将需要创建3个dart/class文件
首先
创建一个constant.dart文件,其中包含getnet所需的参数
以下所有参数您都可以在此处找到:https://developers.getnet.com.br/login(创建免费账户)
const String myUrlGetnetApi = “getnet api的url”;
const String mySellerId = “您的卖家ID”;
const myClientId = “您的客户端ID”;
const myClientSecret = “您的客户端密钥”;
const myAuthorizationBasic = “连接客户端ID,后面跟着“:”(两个点)加上客户端密钥,转换为base64″
其次
让我们创建一个将使用拦截器的自定义Dio
class CustomDioGetnet {
Dio dio = Dio();
CustomDioGetnet() {
dio.options = BaseOptions(
connectTimeout: 300000,
receiveTimeout: 300000,
baseUrl: myUrlGetnetApi);
dio.interceptors.add(GetnetInterceptor());
}
}
最后创建一个拦截器
此拦截器会将登录时保存的令牌添加到您的请求中。
options.headers["Authorization"] = "Bearer $accessToken";
如何使用
在这个视频中,我将向您展示如何使用这个库(语言为巴西葡萄牙语)
链接:https://youtu.be/l3vLa9l7Wsc