{"id":32287719,"url":"https://github.com/tpay-com/tpay-flutter","last_synced_at":"2026-01-23T12:56:55.279Z","repository":{"id":230382701,"uuid":"738105442","full_name":"tpay-com/tpay-flutter","owner":"tpay-com","description":"Tpay.com Flutter Framework library","archived":false,"fork":false,"pushed_at":"2025-12-12T14:57:32.000Z","size":2696,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-12-14T06:19:15.444Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tpay-com.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-01-02T12:40:49.000Z","updated_at":"2025-12-12T14:57:30.000Z","dependencies_parsed_at":"2025-05-14T08:33:15.715Z","dependency_job_id":"1879fa06-28b5-49cc-abb9-a8cbb560b01b","html_url":"https://github.com/tpay-com/tpay-flutter","commit_stats":null,"previous_names":["tpay-com/tpay-flutter"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/tpay-com/tpay-flutter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpay-com%2Ftpay-flutter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpay-com%2Ftpay-flutter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpay-com%2Ftpay-flutter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpay-com%2Ftpay-flutter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tpay-com","download_url":"https://codeload.github.com/tpay-com/tpay-flutter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpay-com%2Ftpay-flutter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28692474,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T11:01:27.039Z","status":"ssl_error","status_checked_at":"2026-01-23T11:00:26.909Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-23T02:16:29.678Z","updated_at":"2026-01-23T12:56:55.265Z","avatar_url":"https://github.com/tpay-com.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tpay\n![Static Badge](https://img.shields.io/badge/flutter-\u003e=2.5.0-blue?logo=flutter\u0026label=Flutter)\n![Static Badge](https://img.shields.io/badge/dart-\u003e=2.18-blue?logo=dart\u0026label=Dart)\n![Static Badge](https://img.shields.io/badge/min_android_sdk-23-blue?logo=android\u0026label=Min%20Android%20SDK)\n![Static Badge](https://img.shields.io/badge/min_ios_sdk-12.0+-blue?logo=apple\u0026label=iOS)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n## About\nThis plugin allows your app to make payments with Tpay.\n\n| Library | Version |\n| ------- | ------- |\n| Flutter | \u003e=2.5.0 |\n| Dart | \u003e=2.18 |\n| Minimum Android SDK | 23 (Android 6.0, Marshmallow) |\n| Minimum iOS version | 12.0 |\n\n\u003e [!warning]\n\u003e For this SDK to work you will need `client_id` and `client_secret` tokens. You can find in [merchant's panel](https://panel.tpay.com).\n\u003e\n\u003e If you are partner, you can obtain them in your merchant partner account. For detailed\n\u003e instructions how to do that or how to create such an account\n\u003e check [this site](https://docs-api.tpay.com/en/merchant-accounts/).\n\n\u003e [!tip]\n\u003e To be able to test the SDK properly,\n\u003e use [mock data](https://support.tpay.com/sprzedawca/srodowisko-testowe-sandbox).\n\n## Install\n\nFor details on adding SDK to your app check our [pub.dev page](https://pub.dev/packages/flutter_tpay).\n\n### Run sample application\n```bash\ngit clone \u003cgithub-link\u003e tpay\ncd tpay/example\nflutter run\n```\n\n## Configuration\n\n\u003e [!note]\n\u003e In this section we will provide examples for each configuration to the TpayConfiguration class\n\u003e you will be able to make.\n\n\u003e [!important]\n\u003e Beneath you will find all configurations that are **MANDATORY**.\n\n### Initialization\n\nAt first, you have to configure your app to be able to make any requests by providing SDK info about\nyour merchant account.\nInfo about `client_id` and `client_secret` you will find in your merchant's panel at `Integration -\u003e API`.\n\n```dart\nMerchantAuthorization(\n  clientId: \"YOUR_CLIENT_ID\", \n  clientSecret: \"YOUR_CLIENT_SECRET\"\n)\n```\n\n### Environment\n\nTpay SDK provides two types of environments you can use in your app:\n\n* `TpayEnvironment.sandbox` - used only for tests and in stage/dev flavor.\n* `TpayEnvironment.production` - used for production flavors.\n\n### Payment methods\n\nFor users to be able to use a specific payment method you have declared it in the configuration.\n\n| Method                      | Description |\n|-----------------------------| ----------- |\n| BLIK                        | [Web docs](https://docs-api.tpay.com/en/payment-methods/blik/) |\n| Pbl **(Pay-By-Link)**       | [Web docs](https://docs-api.tpay.com/en/payment-methods/pbl/) |\n| Card                        | [Web docs](https://docs-api.tpay.com/en/payment-methods/cards/) |\n| DigitalWallets              | [GOOGLE_PAY](https://docs-api.tpay.com/en/payment-methods/google-pay/) ; [APPLE_PAY](https://docs-api.tpay.com/en/payment-methods/apple-pay/) |\n| InstallmentPayments         | [RATY_PEKAO](https://docs-api.tpay.com/en/payment-methods/installments/) |\n| DeferredPayments **(BNPL)** | [PAY_PO](https://docs-api.tpay.com/en/payment-methods/bnpl/) |\n\n```dart\nPaymentMethods(  \n  methods: [\n    PaymentMethod.card, \n    PaymentMethod.blik, \n    PaymentMethod.transfer\n  ],  \n  wallets: [\n    DigitalWallet.applePay, \n    DigitalWallet.googlePay\n  ],\n  installmentPayments: [\n    InstallmentPayment.ratyPekao,\n    InstallmentPayment.payPo\n  ]\n)\n```\n\n#### Card\n\nIf you decide to enable the credit card payment option, you have to provide SSL certificates.\n\n\u003e [!tip]\n\u003e You can find SSL public key on you merchant panel at section `Integrations -\u003e API -\u003e Cards API`.\n\n\u003e [!tip]\n\u003e You can find public key on you merchant panel:\n\u003e - Acquirer Elavon: `Credit card payments -\u003e API`\n\u003e - Acquirer Pekao: `Integrations -\u003e API -\u003e Cards API`\n\n```dart\nCertificatePinningConfiguration(publicKeyHash: \"PUBLIC_KEY_HASH\")\n```\n\n#### Google Pay configuration\n\nIn order to be able to use Google Pay method you have to provide your `merchant_id` to the SDK.\n\n\u003e [!tip]\n\u003e Your login name to the merchant panel is your merchant id.\n\n```dart\nGooglePayConfiguration(merchantId: \"MERCHANT_ID\")\n```\n\n#### Apple Pay configuration\n\nIn order to be able to use Apple Pay method you have to provide your `merchant_id` and `country_code` to the SDK.\n\n\u003e [!important]\n\u003e To obtain the merchantIdentifier, follow these steps:\n\u003e 1. Log in to your Apple Developer account.\n\u003e 2. Navigate to the `Certificates, Identifiers \u0026 Profiles` section.\n\u003e 3. Under `Identifiers,` select `Merchant IDs.`\n\u003e 4. Click the `+` button to create a new Merchant ID.\n\u003e 5. Fill in the required information and associate it with your app's Bundle ID.\n\u003e 6. Once created, the merchant identifier can be found in the list of Merchant IDs.\n\u003e 7. For more details, please follow [Apple Pay documentation](https://developer.apple.com/documentation/passkit/apple_pay/setting_up_apple_pay).\n\n```dart\nApplePayConfiguration(merchantIdentifier: \"merchant_id\", countryCode: \"PL\")\n```\n\n### Languages\n\nTpay SDK lets you decide what languages will be available in the Tpay's screen and which one of them\nwill be preferred/default.\n\nRight now, SDK allows you to use 2 languages:\n\n* `Language.pl` - polish\n* `Language.en` - english\n\n```dart\nLanguages(preferredLanguage: Language.pl, supportedLanguages: [Language.pl, Language.en])\n```\n\n### Merchant details\n\nAs a merchant, you can configure how information about you will be shown.\nYou can set up your `display name`, `city/headquarters` and `regulations link`.\nYou can choose to provide different copy for each language, or simply use one for all.\n\n```dart\nMerchantDetails(\n  merchantDisplayName: [\n    LocalizedString(language: Language.pl, value: \"polish name\"),\n    LocalizedString(language: Language.en, value: \"english name\"),\n  ],\n  merchantHeadquarters: [\n    LocalizedString(language: Language.pl, value: \"polish city name\"),\n    LocalizedString(language: Language.en, value: \"english city name\"),\n  ],\n  regulations: [\n    LocalizedString(language: Language.pl, value: \"polish regulation URL\"),\n    LocalizedString(language: Language.en, value: \"english regulation URL\"),\n  ],\n),\n```\n\n### Summary\nBeneath you will find how a complete configuration should look like.\n\n```dart\nfinal configuration = TpayConfiguration(  \n  merchant: Merchant(\n    authorization: MerchantAuthorization(\n      clientId: \"YOUR_CLIENT_ID\", \n      clientSecret: \"YOUR_CLIENT_SECRET\"\n    ),\n    environment: TpayEnvironment.sandbox,\n    certificatePinningConfiguration: CertificatePinningConfiguration(publicKeyHash: \"PUBLIC_KEY_HASH\"),\n    blikAliasToRegister: \"BLIK alias\",\n    walletConfiguration: WalletConfiguration(\n      googlePay: GooglePayConfiguration(merchantId: \"YOUR_MERCHANT_ID\"),\n      applePay: ApplePayConfiguration(merchantIdentifier: \"MERCHANT_IDENTIFIER\", countryCode: \"PL\")\n    ),\n  ), \n  merchantDetails: MerchantDetails(\n    merchantDisplayName: [  \n      LocalizedString(language: Language.pl, value: \"polish name\"),  \n      LocalizedString(language: Language.en, value: \"english name\")  \n    ],\n    merchantHeadquarters: [\n      LocalizedString(language: Language.pl, value: \"polish city name\"),\n      LocalizedString(language: Language.en, value: \"english city name\")\n    ],\n    regulations: [  \n      LocalizedString(language: Language.pl, value: \"polish regulation URL\"),  \n      LocalizedString(language: Language.en, value: \"english regulation URL\")  \n    ],  \n  ),  \n  languages: Languages(  \n    preferredLanguage: Language.pl,  \n    supportedLanguages: [Language.pl, Language.en]  \n  ),  \n  paymentMethods: PaymentMethods(  \n    methods: [\n      PaymentMethod.card, \n      PaymentMethod.blik, \n      PaymentMethod.transfer\n    ],  \n    wallets: [\n      DigitalWallet.applePay, \n      DigitalWallet.googlePay\n    ],\n    installmentPayments: [\n      InstallmentPayment.ratyPekao, \n      InstallmentPayment.payPo\n    ]\n  ),\n);  \n\ntpay.configure(configuration);\n```\n\n### Android\nTpay UI module requires your MainActivity to extend FlutterFragmentActivity and to pass system backpress events.\n\n```kotlin\nclass MainActivity: FlutterFragmentActivity() {\n    override fun onBackPressed() {\n        if (TpayBackpressUtil.isModuleVisible) {\n            TpayBackpressUtil.onBackPressed()\n        } else {\n            super.onBackPressed()\n        }\n    }\n}\n```\n\n#### Proguard/R8\n\nIf you are using Proguard/R8 in your project, you have to add the following rules to the\n`android/app/proguard-rules.pro` file, to keep Tpay SDK classes.\n\n```proguard\n# Keep all Tpay sdk classes\n-keep class com.tpay.sdk.** { *; }\n```\n\n### IOS\n\nWhen integrating the Tpay payment module into your app, it’s important to ensure that the necessary permissions are correctly set up to ensure a smooth user experience.\nThe module allows the user to automatically fill the credit card form for secure payment processing. This feature requires you to setup the “Privacy - Camera Usage Description” in your app’s Info.plist file.\n\nIntegration Steps:\n1. Open your project’s Info.plist file.\n2. Add the key-value pair for the “Privacy - Camera Usage Description” permission, explaining the purpose of camera access. Clearly state that the camera is used to facilitate the automatic filling of the credit card form for secure payment processing.\n\nExample:\n```\n\u003ckey\u003eNSCameraUsageDescription\u003c/key\u003e\n\u003cstring\u003eWe need access to your camera to automatically fill the credit card form for secure payment processing.\u003c/string\u003e\n```\n\n## Handling payments\n\nTpay SDK provides two ways of handling payments:\n\n- `Official SDK screens` - you can use Tpay's official screens where you just need to provide \"soft\"\n  information, like price, description or payer info.\n- `Screenless` - you can use screenless functionalities, where you set callbacks for payments and\n  display all necessary information on your own screens.\n\n## Official SDK screens\n\nTo make integration with the SDK faster, we created 3 types of sheets that can be used to handle\npayments:\n\n* `SingleTransaction` - the most simple screen where the user can choose any payment method and proceed with it,\n* `Tokenization` - screen that handles generating payment token from the credit card,\n* `TokenPayment` - screen that handles payment with previously created token for credit card,\n\n### SingleTransaction\n\nSingleTransaction flow opens a UI module and allows the customer to pick one of teh defined payment methods.\nThis method requires setting up a few things in order to fulfill payment:\n\n* `amount` - simply the price of the transaction\n* `description` - transaction description\n* `hiddenDescription` (optional) - description visible only to the merchant\n* `payerContext` - information about payer\n    * `payer` - information about the person who is making the payment\n        * `name` - payer name\n        * `email` - payer email\n        * `phone` - payer phone number\n        * `address` - payer address\n            * `city` - city name\n            * `countryCode` - country code in ISO 3166-1 alpha-2 format\n            * `address` - street address\n            * `postalCode` - postal code\n    * `automaticPaymentMethods` - configuration of automatic payments\n        * `tokenizedCards` - previously saved credit cards\n            * `token` - card token\n            * `cardTails` - last 4 digits of the card\n            * `brand` - card brand\n        * `blikAlias` - previously saved BLIK alias\n            * `value` - alias value\n            * `label` - alias label\n* `notifications` - info about where the merchant should be notified about new transactions\n    * `notificationEmail` - email address to send notification to\n    * `notificationUrl` - URL to send notification to / URL to send tokens for tokenization\n* `activity` - activity to associate the view with\n* `supportFragmentManager` - fragment manager to associate the view with\n\n```dart\nfinal transaction = SingleTransaction(  \n  amount: 19.99,  \n  description: \"transaction description\", \n  hiddenDescription: \"Hidden message\",\n  payerContext: PayerContext(  \n    payer: Payer(  \n      name: \"John Doe\",  \n      email: \"example@example.com\",\n      phone: \"123487123\",\n      address: PayerAddress(\n        address: \"Test Street 1\",\n        city: \"Warsaw\",\n        countryCode: \"PL\",\n        postalCode: \"00-007\",\n      ),\n    ),\n    automaticPaymentMethods: AutomaticPaymentMethods(  \n      tokenizedCards: [  \n        TokenizedCard(\n          token: \"card token\", \n          cardTail: \"1234\", \n\t      brand: CreditCardBrand.mastercard\n \t    ), \n        TokenizedCard(\n          token: \"card token\", \n          cardTail: \"4321\", \n          brand: CreditCardBrand.visa\n        )  \n      ],\n      blikAlias: BlikAlias(isRegistered: true, value: \"alias value\", label: \"label\")\n    )\n  ),\n  notifications: Notifications(url: \"https://yourstore.com\", email: \"payments@yourstore.com\")\n);  \n\ntpay.startPayment(\n  transaction,\n  onPaymentCreated: (transactionId) {\n    // The onPaymentCreated optional parameter is a callback function\n    // that is triggered when a payment is successfully created.\n    // It receives the transactionId as an argument, allowing you to handle the event.\n  },\n);\n```\n\n\u003e [!important]\n\u003e Tpay SDK also supports `NFC` and `camera` card scanning:\n\u003e * `NFC` - Adding card info during transaction, user can tap on the NFC button.\n    Then, if NFC is enabled in device, after holding physical card near the device, SDK will scan\n    the card's data and automatically fill the form with it.\n\u003e * `Camera` - Adding card info during transaction, user can tap on the camera button.\n    Then, if the camera scans card data successfully, form will be filled automatically.\n\n#### Automatic Payments\n\nUsing `SingleTransaction` screen you can set up automatic BLIK or card payments.\nThanks to that, user will not have to enter BLIK/card data all over again each time making the\npayment.\n\nIf user using a card as a payment method will opt-in saving card, on successful payment, on the link\nspecified as `Notifications -\u003e url` Tpay backend will send information about the saved card token, tail and\nbrand.\nNext, your backend has to send it to you, so you can use this info next time the same user will want\nto pay with the card.\nWhen you already have all required information, you can add `automaticPaymentMethods` to the `payerContext`.\n\n```dart\nAutomaticPaymentMethods(  \n  tokenizedCards: [  \n    TokenizedCard(\n      token: \"card_token\", \n      cardTail: \"1234\", \n      brand: CreditCardBrand.mastercard\n    ), \n    TokenizedCard(\n      token: \"card_token\", \n      cardTail: \"4321\", \n      brand: CreditCardBrand.visa\n    )  \n  ],\n  blikAlias: null\n)\n```\n\n## Tokenization\n\nTpay SDK allows you to make credit card transactions without need of entering card's data each time.\nInstead, you can create and use a token, associated with a specific card and user.\n\n\u003e [!important]\n\u003e There are 2 types of tokens you can use in transactions.\n\u003e * [Simple tokens](https://docs-api.tpay.com/en/tokenization/#tokenization-without-charging) -\n    tokens that go with card data upon transaction,\n\u003e * [Network tokens](https://docs-api.tpay.com/en/tokenization/#tokenization-plus) -\n    tokens that can be used without exposing the card details. Also, this token persists even if\n    card expires and the user requests a new one.\n\n\u003e [!warning]\n\u003e For recurring payments, you can simply use created token to make transaction without need of user\n\u003e interaction.\n\n### Creating card token\n\n\u003e [!warning]\n\u003e `notificationUrl` should be the URL handled by your backend, because there will be sent token from\n\u003e the successful token creation.\n\n```dart\nfinal payer = Payer(\n  name: \"John Doe\",\n  email: \"example@example.com\",\n  phone: \"123487123\",\n  address: PayerAddress(\n    address: \"Test Street 1\",\n    city: \"Warsaw\",\n    countryCode: \"PL\",\n    postalCode: \"00-007\",\n  ),\n);  \n\ntpay.tokenizeCard(Tokenization(payer: payer, notificationUrl: \"https://yourstore.com/notifications\"));\n```\n\n### Token payment\n\nIf you already have card token payment, you can simply proceed with an actual tokenization\ntransaction.\n\n\u003e [!warning]\n\u003e `cardToken` is a token sent to your backend during card tokenization process.\n\n```dart\nfinal tokenPayment = TokenPayment(  \n  amount: 5.21,  \n  description: \"transaction description\",  \n  cardToken: \"card_token\",  \n  payer: Payer(\n    name: \"John Doe\",\n    email: \"example@example.com\",\n    phone: \"123487123\",\n    address: PayerAddress(\n      address: \"Test Street 1\",\n      city: \"Warsaw\",\n      countryCode: \"PL\",\n      postalCode: \"00-007\",\n    ),\n  ),  \n);  \n\ntpay.startCardTokenPayment(tokenPayment);\n```\n\n### Common\nEach transaction with a predefined screen returns a result\nthat you can use to either show information to the user or, e.g. log errors.\n\n```dart\nvoid handleResult(Result result) {\n  switch (result) {\n    case PaymentCompleted():\n    // payment completed successfully and Tpay module was closed\n      break;\n    case PaymentCancelled():\n    // payment failed and Tpay module was closed\n      break;\n    case TokenizationCompleted():\n    // tokenization was successful and Tpay module was closed\n      break;\n    case TokenizationFailure():\n    // tokenization failed and Tpay module was closed\n      break;\n    case ConfigurationSuccess():\n    // Tpay module configuration was successful\n      break;\n    case ValidationError():\n    // passed data is incorrect\n      break;\n    case ModuleClosed():\n    // user closed the Tpay module\n    // without making a payment or tokenization\n      break;\n    case MethodCallError():\n    // something went wrong with the plugin\n      break;\n    default:\n      break;\n  }\n}\n```\n\n## Screenless Payments\n\nScreenless payments are a special type of payment functionality that gives you the whole power of\npayment process, but do not limit you to using predefined Tpay screens.\n\n### Get payment channels\n\nTo be able to use screenless functionalities you will need to know which payment methods are\navailable to your merchant account. To get them, you can simply call `getAvailablePaymentChannels`\nmethod on the `TpayPlatform.instance` and set up result observer for them.\n\n\u003e [!warning]\n\u003e Available methods needs to be filtered by the `amount` of the transaction, because some payment\n\u003e methods have specific constraints, like minimum or maximum amount.\n\n```dart\nvoid _getPaymentChannels() async {\n  final result = await tpay.getAvailablePaymentChannels();\n  \n  switch (result) {\n    case PaymentChannelsSuccess():\n      for (var channel in result.channels) {\n        for (var constraint in channel.constraints.whereType\u003cAmountPaymentConstraint\u003e()) {\n          // filter payment methods by the transaction amount\n        }\n      }\n    case PaymentChannelsError():\n      // handle error\n      break;\n  }\n}\n```\n\n### Configuration\n\nBefore you run any screenless payment we do recommend setting up function to handle specific payment results.\nYou will need this to be able to monitor each payment status, i.e. it's status in real time. To do so,\ncreate a function, that will accept `ScreenlessResult` as a parameter and handle each of them.\n\n\u003e [!warning]\n\u003e Note that long polling mechanism will start only when it's needed:\n\u003e - `ScreenlessPaymentCreated`: when payment is created and you have to display payment URL.\n\u003e - `ScreenlessBlikAmbiguousAlias`: when payment is created and there are more than one BLIK alias registered,\n    \u003e so you have to display them to the user and continue payment with selected one.\n\n```dart\nvoid handleScreenlessResult(ScreenlessResult result) {\n  switch (result) {\n    case ScreenlessPaid():\n    // payment completed successfully\n      break;\n    case ScreenlessPaymentCreated():\n    // payment created, use result.paymentUrl to redirect the user to the payment page\n      break;\n    case ScreenlessPaymentError():\n    // creating payment failed\n      break;\n    case ScreenlessConfiguredPaymentFailed():\n    // creating payment failed because of error with:\n    // - credit card data or credit card token\n    // - BLIK code or BLIK alias\n      break;\n    case ScreenlessBlikAmbiguousAlias():\n    // single alias has been registered multiple times, use result.aliases to let user choose desired one\n      break;\n    case ScreenlessValidationError():\n    // passed data is incorrect\n      break;\n    case ScreenlessMethodCallError():\n    // something went wrong with the plugin\n      break;\n    default:\n      break;\n  }\n}\n```\n\n### Screenless Credit Card Payment\n\nCreditCardPayment allows you to create payments with credit card data.\n\n```dart\nfinal payment = CreditCardPayment(  \n  creditCard: CreditCard(  \n    cardNumber: \"card number\",\n    expiryDate: ExpirationDate(\n      month: \"12\",\n      year: \"24\"\n    ),  \n    cvv: \"123\",  \n    config: CreditCardConfig(\n      shouldSave: false,  \n      domain: \"yourstore.com\"  \n    )  \n  ),\n  paymentDetails: PaymentDetails(  \n    amount: 19.99,  \n    description: \"transaction description\",  \n    hiddenDescription: \"hidden description\",  \n    language: Language.pl  \n  ),  \n  payer: Payer(  \n    name: \"John Doe\",  \n    email: \"example@example.com\",  \n    phone: null,  \n    address: null  \n  ),  \n  callbacks: Callbacks(  \n    redirects: Redirects(  \n      successUrl: \"https://yourstore.com/success\",  \n      errorUrl: \"https://yourstore.com/error\",  \n    ),  \n    notifications: Notifications(  \n      url: \"https://yourstore.com\",  \n      email: \"payments@yourstore.com\"  \n    )  \n  )  \n);  \n   \ntpay.screenlessCreditCardPayment(payment);\n```\n\n\u003e [!warning]\n\u003e If CreditCardPayment returns `ScreenlessPaymentCreated` result, you have to handle `paymentUrl`\n\u003e sent with it and redirect user to it in order to complete the payment.\n\n#### Tokenization\n\nYou can also Opt-in to generate credit card token for future payments\nif you want to let user pay for transactions with previously used card.\nTo do so, in `creditCard -\u003e config` object, set the `shouldSave` to true.\n\n```dart\ncreditCard: CreditCard(\n    cardNumber: \"4056 2178 4359 7258\",\n    expiryDate: ExpirationDate(\n        month: \"12\",\n        year: \"67\"\n    ),\n    cvv: \"123\",\n    config: CreditCardConfig(\n        shouldSave: true,\n        domain: \"testdomain.com\"\n    )\n),\n```\n\n\u003e [!warning]\n\u003e Generated card token will be sent to `notificationUrl` specified in the notifications callbacks.\n\nIf you already have a credit card token, you can then set up token payment omitting credit card\ninfo.\nTo do so, use `creditCardToken` instead of `creditCard` field.\n\n```dart\nfinal payment = CreditCardPayment(\n  creditCardToken: \"card_token\",\n  paymentDetails: PaymentDetails(  \n    amount: 19.99,  \n    description: \"transaction description\",  \n    hiddenDescription: \"hidden description\",  \n    language: Language.pl  \n  ),  \n  payer: Payer(  \n    name: \"John Doe\",  \n    email: \"example@example.com\",  \n    phone: null,  \n    address: null  \n  ),  \n  callbacks: Callbacks(  \n    redirects: Redirects(  \n      successUrl: \"https://yourstore.com/success\",  \n      errorUrl: \"https://yourstore.com/error\",  \n    ),  \n    notifications: Notifications(  \n      url: \"https://yourstore.com\",  \n      email: \"payments@yourstore.com\"  \n    )  \n  )  \n);  \n   \ntpay.screenlessCreditCardPayment(payment);\n```\n\n#### Recurring Payments\n\nCreditCardPayment let's you set up the recurring payments as well, so you don't have to remember\nto charge your customer for your service periodically.\n\n\u003e [!important]\n\u003e You can choose one of the specified recurring payment frequencies:\n\u003e `daily`, `weekly`, `monthly`,`quarterly` or `yearly`.\n\n\u003e [!important]\n\u003e You can choose to either charge user specified times using quantity (int) option,\n\u003e or to set it up to being charged until expiration date is being hit or user cancels subscription\n\u003e on his own with `quantity: null`.\n\n```dart\nfinal payment = CreditCardPayment(\n  creditCardToken: \"card_token\", \n  recursive: Recursive(\n    frequency: Frequency.monthly,\n    quantity: 19,\n    endDate: \"1410-07-17\"\n  ),\n  paymentDetails: PaymentDetails(  \n    amount: 19.99,  \n    description: \"transaction description\",  \n    hiddenDescription: \"hidden description\",  \n    language: Language.pl  \n  ),  \n  payer: Payer(  \n    name: \"John Doe\",  \n    email: \"example@example.com\",  \n    phone: null,  \n    address: null  \n  ),  \n  callbacks: Callbacks(  \n    redirects: Redirects(  \n      successUrl: \"https://yourstore.com/success\",  \n      errorUrl: \"https://yourstore.com/error\",  \n    ),  \n    notifications: Notifications(  \n      url: \"https://yourstore.com\",  \n      email: \"payments@yourstore.com\"  \n    )  \n  )  \n);  \n   \ntpay.screenlessCreditCardPayment(payment);\n```\n\n### Screenless BLIK payment\nTpay SDK let's make transactions with BLIK as well. Simply use `BLIKPayment` class.\n\n```dart\nfinal result = BLIKPayment(\n  code: \"777462\",  \n  paymentDetails: PaymentDetails(\n    amount: 5.21,  \n    description: \"transaction description\",  \n    hiddenDescription: \"hidden description\",  \n    language: Language.pl  \n  ),  \n  payer: Payer(  \n    name: \"John Doe\",  \n    email: \"john.doe@test.pl\",  \n    phone: \"123456789\",  \n    address: PayerAddress(\n        address: \"TEST\",\n        city: \"TEST\",\n        countryCode: \"PL\",\n        postalCode: \"60-111\"\n    )\n  ),  \n  callbacks: Callbacks(  \n    redirects: Redirects(  \n      successUrl: \"https://yourstore.com/success\",  \n      errorUrl: \"https://yourstore.com/error\",  \n    ),  \n    notifications: Notifications(  \n      url: \"https://yourstore.com\",  \n      email: \"payments@yourstore.com\"  \n    )  \n  )  \n);  \n  \ntpay.screenlessBLIKPayment(result);\n```\n\n#### BLIK Alias Payment\n\nIf you have for example a returning users and you want to make their payments with BLIK even\nsmoother,\nyou can register BLIK Alias for them, so they will only be prompted to accept payment in their\nbanking app,\nwithout need of entering BLIK code each time they want to make the payment.\n\n\u003e [!warning]\n\u003e In order to register alias for a user/payment, you have to set `isRegistered` parameter to `false`.\n\u003e Then, a successful payment will register the alias in Tpay system\n\u003e and next time user will be able to use it.\n\n```dart\nfinal result = BLIKPayment(\n  code: \"777462\",  \n  alias: BlikAlias(\n      isRegistered: false,\n      value: \"1234\",\n      label: \"alias_1234\"\n  ),\n  // rest of the BLIKPayment configuration\n);\n```\n\nIf the payment were successful, you can assume an alias was created and can be used for the future\npayments.\n\n\u003e [!warning]\n\u003e If you already have registered alias for a user, you can set up `isRegistered` parameter to `true`.\n\n\u003e [!warning]\n\u003e To be able to pay with BLIK alias, you **MUST** set the code parameter to `null`.\n\n```dart\nfinal result = BLIKPayment(\n  alias: BlikAlias(\n      isRegistered: true,\n      value: \"1234\",\n      label: \"alias_1234\"\n  ),\n  // rest of the BLIKPayment configuration\n);\n```\n\n#### BLIK Ambiguous Alias Payment\n\nSometimes, there is a possibility for one alias to be registered more than once. For example, if\nyou register alias associated with one user for the multiple banks.\nIn such a situation, you have to fetch those aliases from Tpay API and show them to the user to let him\nchoose one for the payment.\n\nIn BLIKPayment's call in execute method you can get `ScreenlessBlikAmbiguousAlias`\ntype of result,\nthat will indicate that current alias was registered more than once.\nThis result hold all possible variations of the alias you used to start payment with in `aliases`\nfield.\nYou have to simply show them to user, let him choose, and then use chosen alias to retry the\npayment.\n\n```dart\nif (result is ScreenlessBlikAmbiguousAlias) {\n  showAmbiguousAliases(result.aliases);\n}\n```\n\n\u003e [!warning]\n\u003e In such scenario, you have to use different class to make the payment than at the beginning.\n\u003e ```dart\n\u003e final payment = AmbiguousBLIKPayment(\n\u003e   transactionId: \"transaction_id\",\n\u003e   blikAlias: BlikAlias(\n\u003e     isRegistered: true,\n\u003e     value: \"1234\",\n\u003e     label: \"alias_1234\",\n\u003e   ),\n\u003e   ambiguousAlias: AmbiguousAlias(\n\u003e     name: chosenAlias.name,\n\u003e     code: chosenAlias.code,\n\u003e   )\n\u003e );\n\u003e \n\u003e tpay.screenlessAmbiguousBLIKPayment(payment);\n\u003e ```\n\n\u003e [!important]\n\u003e Right now, Tpay SDK does NOT support recurring payments with BLIK\n\u003e In order to achieve that, check\n\u003e our [API support for BLIK recurring payments](https://docs-api.tpay.com/en/payment-methods/blik/#blik-recurring-payments).\n\n### Screenless Transfer Payment\n\nTpay SDK allows you to make transfer payments with bank available to your merchant account.\n\n\u003e [!tip]\n\u003e To get banks with their channel ids check\n\u003e the [Get Payment Channels](https://docs-api.tpay.com/en/first-steps/list-of-payment-methods/)\n\u003e section.\n\nAfter your customer chooses their bank from the list, you can use it's `channelId` to make the payment.\n\n```dart\nfinal payment = TransferPayment(  \n  channelId: 4,\n  bankName: \"bank_name\",\n  paymentDetails: PaymentDetails(  \n    amount: 19.99,  \n    description: \"transaction description\",  \n    hiddenDescription: \"hidden description\",  \n    language: Language.pl  \n  ),  \n  payer: Payer(  \n    name: \"John Doe\",  \n    email: \"example@example.com\",  \n    phone: null,  \n    address: null  \n  ),  \n  callbacks: Callbacks(  \n    redirects: Redirects(  \n      successUrl: \"https://yourstore.com/success\",  \n      errorUrl: \"https://yourstore.com/error\",  \n    ),  \n    notifications: Notifications(  \n      url: \"https://yourstore.com\",  \n      email: \"payments@yourstore.com\"  \n    )  \n  )  \n);  \n  \ntpay.screenlessTransferPayment(payment);\n```\n\n\u003e [!warning]\n\u003e If TransferPayment returns `ScreenlessPaymentCreated` result, you have to handle `paymentUrl`\n\u003e sent with it and redirect user to it in order to complete the payment.\n\n### Screenless Installment Payments\n\nTpay SDK allows you to create long term installment payments.\n\n```dart\nfinal payment = RatyPekaoPayment(\n  channelId: 81,\n  paymentDetails: PaymentDetails(\n    amount: 119.99,\n    description: \"transaction description\",\n    hiddenDescription: \"hidden description\",\n    language: Language.pl\n  ),\n  payer: Payer(\n    name: \"John Doe\",\n    email: \"example@example.com\",\n    phone: null,\n    address: null\n  ),\n  callbacks: Callbacks(\n    redirects: Redirects(\n      successUrl: \"https://yourstore.com/success\",\n      errorUrl: \"https://yourstore.com/error\",\n    ),\n    notifications: Notifications(\n      url: \"https://yourstore.com\",\n      email: \"payments@yourstore.com\"\n    )\n  ),\n);\n\ntpay.screenlessRatyPekaoPayment(payment);\n```\n\n\u003e [!warning]\n\u003e If RatyPekaoPayment returns `ScreenlessPaymentCreated` result, you have to handle `paymentUrl`\n\u003e sent with it and redirect user to it in order to complete the payment.\n\n### Screenless Deferred Payments\n\nTpay SDK allows you to create deferred payments (BNPL) using PayPo method.\n\n\u003e [!warning]\n\u003e For PayPo payment to work, amount of the payment must be at least 40PLN!\n\u003e For more information about PayPo payments\n\u003e check [our PayPo documentation](https://docs-api.tpay.com/en/payment-methods/bnpl/#paypo).\n\n\u003e [!tip]\n\u003e For sandbox, working phone number is `500123456`\n\n```dart\nfinal payment = PayPoPayment(\n  paymentDetails: PaymentDetails(\n    amount: 119.99,\n    description: \"transaction description\",\n    hiddenDescription: \"hidden description\",\n    language: Language.pl\n  ),\n  payer: Payer(\n    name: \"John Doe\",\n    email: \"example@example.com\",\n    phone: null,\n    address: null\n  ),\n  callbacks: Callbacks(\n    redirects: Redirects(\n      successUrl: \"https://yourstore.com/success\",\n      errorUrl: \"https://yourstore.com/error\",\n    ),\n    notifications: Notifications(\n      url: \"https://yourstore.com\",\n      email: \"payments@yourstore.com\"\n    )\n  ),\n);\n\ntpay.screenlessPayPoPayment(payment);\n```\n\n\u003e [!warning]\n\u003e If PayPoPayment returns `ScreenlessPaymentCreated` result, you have to handle `paymentUrl`\n\u003e sent with it and redirect user to it in order to complete the payment.\n\n### Screenless Google Pay Payment\n\nTpay SDK allows you to perform Google Pay transactions.\n\n```dart\nfinal payment = GooglePayPayment(\n  token: \"google_pay_token\",\n  paymentDetails: PaymentDetails(\n    amount: 19.99,\n    description: \"transaction description\",\n    hiddenDescription: \"hidden description\",\n    language: Language.pl\n  ),\n  payer: Payer(\n      name: \"John Doe\",\n      email: \"example@example.com\",\n      phone: null,\n      address: null\n  ),\n  callbacks: Callbacks(\n    redirects: Redirects(\n      successUrl: \"https://yourstore.com/success\",\n      errorUrl: \"https://yourstore.com/error\",\n    ),\n    notifications: Notifications(\n      url: \"https://yourstore.com\",\n      email: \"payments@yourstore.com\"\n    )\n )\n);\n\ntpay.screenlessGooglePayPayment(payment);\n```\n\n\u003e [!warning]\n\u003e If GooglePayPayment returns `Created` result, you have to handle `paymentUrl`\n\u003e sent with it and redirect user to it in order to complete the payment.\n\n\u003e [!warning]\n\u003e Take under consideration, that choosing this option,\n\u003e you have to configure whole Google Wallet SDK and fetch Google Pay token on your own.\n\u003e For `ANDROID` system only, we provide a bit smoother way of handling Google Pay transactions with our wrappers.\n\n#### Google Pay Utils\n\nIf you do not want to configure whole Google Pay functionality, you can use `GooglePlayUtil` class.\nIt will handle all payments, with additional info in the bottom sheet and send you all the needed info in\ncallback.\n\n\u003e [!important]\n\u003e To use GooglePayUtil, first, you have to configure them it.\n\n```dart\nfinal configuration = GooglePayUtilsConfiguration(\n  price: 39.99,\n  merchantName: \"merchant_name\",\n  merchantId: \"merchant_id\",\n  environment: GooglePayEnvironment.test,\n);\n\nfinal configurationResult = tpay.configureGooglePayUtils(configuration);\n\nswitch (configurationResult) {\n  case GooglePayConfigureSuccess():\n    break;\n  case GooglePayConfigureError():\n    break;\n}\n```\n\n\u003e [!warning]\n\u003e Before you use our utils, make sure Google Pay is enabled in the device. Use `isGooglePayAvailable` method.\n\n```dart\nfinal isAvailable = await _tpay.isGooglePayAvailable();\n\nif (isAvailable) {\n  // display Google Pay button\n}\n```\n\nNext, you can open Google Pay module and let user choose his credit card, so you can use it to make\nthe payment.\n\n```dart\nfinal googlePayResult = await _tpay.openGooglePay();\n\nswitch (googlePayResult) {\n  case GooglePayOpenSuccess():\n    break;\n  case GooglePayOpenCancelled():\n    break;\n  case GooglePayOpenUnknownError():\n    break;\n  case GooglePayOpenNotConfigured():\n    break;\n}\n```\n\n\u003e [!important]\n\u003e If `googlePayResult` returns `GooglePayOpenSuccess`, you **HAVE TO** use it's content to make an actual\n\u003e payment buy using `GooglePayPayment` and `screenlessGooglePayPayment`.\n\n### Screenless Apple Pay payment\n\nTpay SDK allows you to perform Apple Pay transactions.\n\n\u003e [!warning]\n\u003e To be able to complete Apple Pay payment, you will need `apple_pay_token`. You **HAVE TO**\n\u003e acquire a token by yourself. To do that check\n\u003e official [Apple Pay documentation](https://developer.apple.com/design/human-interface-guidelines/apple-pay#app-top)\n\n```dart\nfinal payment = ApplePayPayment(\n  applePayToken: \"apple_pay_token\",\n  paymentDetails: PaymentDetails(\n    amount: 19.99,\n    description: \"transaction description\",\n    hiddenDescription: \"hidden description\",\n    language: Language.pl\n  ),\n  payer: Payer(\n    name: \"John Doe\",\n    email: \"example@example.com\",\n    phone: null,\n    address: null\n  ),\n  callbacks: Callbacks(\n    redirects: Redirects(\n      successUrl: \"https://yourstore.com/success\",\n      errorUrl: \"https://yourstore.com/error\",\n    ),\n    notifications: Notifications(\n      url: \"https://yourstore.com\",\n      email: \"payments@yourstore.com\"\n    )\n  )\n);\n\ntpay.screenlessApplePayPayment(payment);\n```\n\n## License\n\nThis library is released under the [MIT License](https://opensource.org/license/mit/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpay-com%2Ftpay-flutter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftpay-com%2Ftpay-flutter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpay-com%2Ftpay-flutter/lists"}