A plugin to use Openpay in flutter.
A flutter plugin to tokenize cards using Openpay
First, add flutter_openpay as a dependency in your pubspec.yaml file.
<application> to your app's
AndroidManifest.xml file. This is required due to Openpay using its remote API to tokenize the card.
For tokenizing the card information correctly, you need to add some keys to your iOS app's Info.plist file, located in
UIBackgroundModes with the fetch and remote-notifications keys - Required. Describe why your app needs to access background taks, suck talking to an external API (to tokenize the card). This is called Required background modes, with the keys App download content from network and App downloads content in response to push notifications respectively in the visual editor (since both methods aren't actually overriden, not adding this property/keys may only display a warning, but shouldn't prevent its correct usage).
<key>UIBackgroundModes</key> <array> <string>fetch</string> <string>remote-notification</string> </array>
There is only one method that should be used with this package:
Will let you tokenize a card. This receives eight required parameters: the
publicApiKey to specify your Openpay public key, the
productionMode flag to indicate whether it should tokenize the card using the production or the sandbox API, the
merchantId from Openpay, the
expiryMonth and the
expiryYear. Returns a
String with the token representing the card.
Will let you generate a unique device session id, which you should use to access resources from the Openpay API. This receives three required parameters: the
productionMode flag, the
publicApiKey to specify your Openpay public key, and the
merchantId from Openpay. Returns a
String with the device session id.
Currently supported features #
- [x] Tokenize card using Openpay.
- [x] Generate device session id to access Openpay API resources.
Demo App #
See example app.