sbp 0.0.2 sbp: ^0.0.2 copied to clipboard
Flutter plugin, with which you can get a list of banks installed on the user's device, as well as launch a link to pay via SBP like https://qr.nspk.ru/.../
sbp #
Flutter plugin, with which you can get a list of banks installed on the device user, as well as launch a link to pay for the SBP of the form https://qr.nspk.ru/.../
Adding dependencies #
To use the plugin, add it to the pubspec.yaml file.
Installing #
IOS #
Add URL schemes to LSApplicationQueriesSchemes
in Info.plist
file:
This list is needed in order to make it possible to open third-party installed applications on
iOS. The list of banks supported by SBP can be obtained at c2bmembers.json.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>bank100000000000</string>
<string>bank100000000001</string>
...
<string>bank100000000999</string>
<string>bank100000001000</string>
</array>
Warning! Starting with iOS 15, the maximum number of the scheme list should not exceed 50.Detailed information can be obtained from this link
Description of functions with examples #
To use sbp and get current information on supported banks, SBP needs to be raised own server, which will pull up new information on banks once in a while. Warning!If you use json, don't forget to change the links to images in the file /sbp/lib/data/c2bmembers_data.dart as they take a long time to load or not to load at all (IOS).
Links to current banks from the official website of the SBP
Or you can use the current json I added to the project on 08/11/2022:
- Android: /sbp/lib/data/asset_links_data.dart
- IOS: /sbp/lib/data/c2bmembers_data.dart
Android #
List<ApplicationInfoModel> informations = await Sbp.getAndroidInstalledByAssetLinksJsonBanks(assetLinksData)
A variable is passed (json /sbp/lib/data/asset_links_data.dart), which is parsed and returns a List
- name - app name
- packageName - application packageName
- bitmap - bitmap application icons
I also foresaw that json can change (if you raise your server with data paging)
List<ApplicationInfoModel> informations = await Sbp.getAndroidInstalledByPackageNameBanks(List<String> packageNames)
We pass the packageNames list of banks supported by the SBP. Returns List
Sbp.openAndroidBank(String url, String packageName)
We pass the url of the form https://qr.nspk.ru/.../ and the packageName of the application in which you want to open the SBP
IOS #
List<C2bmembersModel> informations = await Sbp.getIOSInstalledByC2bmembersJsonBanks(c2bmembersData)
A variable is passed (json /sbp/lib/data/c2bmembers_data.dart), which is parsed and returns
List C2bmembersModel .
Sbp.getIOSInstalledByC2bmembersJsonBanks(Map<String, dynamic> c2bmembersData): IOS
Передается переменная(json /sbp/lib/data/c2bmembers_data.dart), которая парсится и возвращает
List.
C2bmembersModel contains fields such as:
- version - json version
- c2bmembersModel - List C2bmemberModel installed applications
- C2bmemberModel contains fields such as:
- bankName - bank name
- logoURL - link to picture
- schema - application schema
- packageName - application packageName
- C2bmemberModel contains fields such as:
I also foresaw that json can change (if you raise your server with data paging)
List<C2bmembersModel> informations = Sbp.getIOSInstalledBySchemesBanks(List<String> schemes)
We pass a list of schemas supported by the SBP banks. List
Sbp.openIOSBank(String url, String packageName)
We pass the url of the form https://qr.nspk.ru/.../ and the schema of the application in which you want to open the SBP