Generated using TypeDoc
Class responsible for storing payer address
+street number
+city name
+country code, for example 'PL'
+postal code
+Class responsible for storing ambiguous alias information
-Alias identifier
-Alias display name
-Generated using TypeDoc
Class responsible for storing ambiguous alias information
+Class responsible for storing information about ambiguous BLIK payment
-id of transaction received from ScreenlessBlikAmbiguousAlias result
-BLIK alias used to create transaction with BlikPayment
-ambiguous alias selected by user
-Generated using TypeDoc
Class responsible for storing information about ambiguous BLIK payment
+id of transaction received from ScreenlessBlikAmbiguousAlias result
+BLIK alias used to create transaction with BlikPayment
+ambiguous alias selected by user
+Class responsible for storing information about amount payment constraint
-maximum price that can be used while creating the transaction
-minimum price that can be used while creating the transaction
-type of a payment constraint
-Generated using TypeDoc
Class responsible for storing information about amount payment constraint
+Class responsible for storing information about Apple Pay configuration.
-unique id that identifies your business as a merchant able to accept apple payments
-country code, for example "PL"
-Generated using TypeDoc
Class responsible for storing information about Apple Pay configuration.
+unique id that identifies your business as a merchant able to accept apple payments
+country code, for example "PL"
+Class responsible for storing information about Apple Pay payment
-Token received from Apple Pay
-Generated using TypeDoc
Class responsible for storing information about Apple Pay payment
+Token received from Apple Pay
+Class responsible for storing information about payer's automatic payment methods
-tokenized cards created after successful credit card payment
-BLIK alias that will be registered after payment or used to pay (if registered)
-Generated using TypeDoc
Class responsible for storing information about payer's automatic payment methods
+tokenized cards created after successful credit card payment
+BLIK alias that will be registered after payment or used to pay (if registered)
+Generated using TypeDoc
Class responsible for storing information about BLIK alias
+true if this BLIK alias is registered (payer saved it after paying with 6-digit code)
+payer's unique alias value
+alias display name
+Class responsible for storing BLIK payment information
-You have to provide either code or alias. +
Class responsible for storing BLIK payment information
+You have to provide either code or alias. If you provide both, module will try to register the alias.
-6-digit code
-BLIK alias to register/pay with
-Generated using TypeDoc
6-digit code
+BLIK alias to register/pay with
+Class storing the information about callbacks
-where should user be redirected after payment
-where should payment notifications be sent
-Generated using TypeDoc
Class storing the information about callbacks
+where should user be redirected after payment
+where should payment notifications be sent
+Class responsible for storing information about certificate pinning.
-public key used to encrypt credit card data during payment/tokenization.
-Generated using TypeDoc
Class responsible for storing information about certificate pinning.
+public key used to encrypt credit card data during payment/tokenization.
+Indicates that configuration was successful
-Generated using TypeDoc
Indicates that configuration was successful
+OptionalmessageOptional error message or additional information
+OptionalpaymentPayment URL for continuation (used in screenless payments)
+OptionaltransactionTransaction ID when applicable
+ReadonlytypeType identifier for the result
+Class responsible for storing information about a credit card
-credit card number
-credit card expiration date
-cvv code
-other credit card information
-Generated using TypeDoc
Class responsible for storing information about a credit card
+credit card number
+credit card expiration date
+cvv code
+other credit card information
+Class responsible for storing payment related information about credit card
-whether credit card should be tokenized after payment
-domain of your store
-Generated using TypeDoc
Class responsible for storing payment related information about credit card
+whether credit card should be tokenized after payment
+domain of your store
+Class responsible for storing information about credit card payment
-You have to provide either creditCard or creditCardToken. +
Class responsible for storing information about credit card payment
+You have to provide either creditCard or creditCardToken. If you provide both, creditCardToken will be used.
-information about credit card
-token of tokenized card (for returning customers)
-Generated using TypeDoc
information about credit card
+token of tokenized card (for returning customers)
+Class responsible for storing information about expiration date
-2-digit month, for example '02'
-2-digit year, for example '24'
-Generated using TypeDoc
Class responsible for storing information about expiration date
+2-digit month, for example '02'
+2-digit year, for example '24'
+Class responsible for storing information about GooglePay configuration
-your merchant id in Tpay system
-Generated using TypeDoc
Class responsible for storing information about GooglePay configuration
+your merchant id in Tpay system
+Indicates that there was an error during Google Pay configuration
-Error message
-Generated using TypeDoc
Indicates that there was an error during Google Pay configuration
+Indicates a result of Google Pay configuration
-Generated using TypeDoc
AbstractIndicates a result of Google Pay configuration
+Indicates that Google Pay configuration was successful
-Generated using TypeDoc
Indicates that Google Pay configuration was successful
+Indicates that Google Pay was opened successfully but user closed it without selecting a credit card
-Generated using TypeDoc
Indicates that Google Pay was opened successfully but user closed it without selecting a credit card
+OptionalcardCredit card network when available
+OptionalcardLast digits of credit card number when available
+OptionaldescriptionCredit card description when available
+OptionaltokenGoogle Pay card token when available
+ReadonlytypeType identifier for the result
+Indicates that Google Pay utils were not configured before trying to open Google Pay. +
Indicates that Google Pay utils were not configured before trying to open Google Pay. Configure utils via configureGooglePayUtils(...) method
-Generated using TypeDoc
OptionalcardCredit card network when available
+OptionalcardLast digits of credit card number when available
+OptionaldescriptionCredit card description when available
+OptionaltokenGoogle Pay card token when available
+ReadonlytypeType identifier for the result
+Indicates a result of Google Pay open
-Generated using TypeDoc
AbstractIndicates a result of Google Pay open
+OptionalcardCredit card network when available
+OptionalcardLast digits of credit card number when available
+OptionaldescriptionCredit card description when available
+OptionaltokenGoogle Pay card token when available
+Abstract ReadonlytypeType identifier for the result
+Indicates that Google Pay was successfully opened and user has selected a credit card
-Credit card network
-Last digits of credit card number
-Credit card description, for example "Visa •••• 1111"
-Google Pay card token, use it with GooglePayPayment
-Generated using TypeDoc
Indicates that Google Pay was successfully opened and user has selected a credit card
+Credit card network
+Last digits of credit card number
+Credit card description, for example "Visa •••• 1111"
+Google Pay card token, use it with GooglePayPayment
+ReadonlytypeType identifier for the result
+Indicates that there was a unknown error
-Generated using TypeDoc
Indicates that there was a unknown error
+OptionalcardCredit card network when available
+OptionalcardLast digits of credit card number when available
+OptionaldescriptionCredit card description when available
+OptionaltokenGoogle Pay card token when available
+ReadonlytypeType identifier for the result
+Class responsible for storing information about Google Pay payment
-token received from Google Pay
-Generated using TypeDoc
Class responsible for storing information about Google Pay payment
+token received from Google Pay
+Class responsible for storing information about Google Pay utils configuration
-price that will be displayed in Google Pay
-store name displayed in Google Pay
-your merchantId in Tpay system
-Google Pay environment
-alternative request code that will be used to manage Google Pay data
-Generated using TypeDoc
Class responsible for storing information about Google Pay utils configuration
+price that will be displayed in Google Pay
+store name displayed in Google Pay
+your merchantId in Tpay system
+Google Pay environment
+alternative request code that will be used to manage Google Pay data
+Generated using TypeDoc
Class responsible for storing a localized string
-Generated using TypeDoc
Class responsible for storing a localized string
+Class responsible for storing merchant information
-merchant credentials
-environment that the module will use
-encryption information
-BLIK that will be registered with payment
-configuration of digital wallets
-Generated using TypeDoc
Class responsible for storing merchant information
+merchant credentials
+environment that the module will use
+encryption information
+BLIK that will be registered with payment
+configuration of digital wallets
+Class responsible for storing merchant's authorization
-your client id in Tpay system
-your client secret in Tpay system
-Generated using TypeDoc
Class responsible for storing merchant's authorization
+your client id in Tpay system
+your client secret in Tpay system
+Class responsible for storing localized information about merchant
-localized display names
-localized headquarters
-localized regulation urls
-Generated using TypeDoc
Class responsible for storing localized information about merchant
+localized display names
+localized headquarters
+localized regulation urls
+Indicates a module error
-Error message
-Generated using TypeDoc
Indicates a module error
+Error message
+OptionalpaymentPayment URL for continuation (used in screenless payments)
+OptionaltransactionTransaction ID when applicable
+ReadonlytypeType identifier for the result
+Indicates that user closed the module without making a payment/tokenization
-Generated using TypeDoc
Indicates that user closed the module without making a payment/tokenization
+OptionalmessageOptional error message or additional information
+OptionalpaymentPayment URL for continuation (used in screenless payments)
+OptionaltransactionTransaction ID when applicable
+ReadonlytypeType identifier for the result
+Class responsible for storing information about notifications
-notification url, payment notifications will be sent there
-notification email, payment notifications will be sent there
-Generated using TypeDoc
Class responsible for storing information about notifications
+notification url, payment notifications will be sent there
+notification email, payment notifications will be sent there
+Class responsible for storing information about PayPo payment
-Generated using TypeDoc
Class responsible for storing information about PayPo payment
+Generated using TypeDoc
Class responsible for storing information about payer and automatic payment methods
-payer information
-automatic payment methods for payer
-Generated using TypeDoc
Class responsible for storing information about payer and automatic payment methods
+payer information
+automatic payment methods for payer
+Indicates that payment failed and module was closed
-If exists, id of the transaction
-Generated using TypeDoc
Indicates that payment failed and module was closed
+OptionalmessageOptional error message or additional information
+OptionalpaymentPayment URL for continuation (used in screenless payments)
+If exists, id of the transaction
+ReadonlytypeType identifier for the result
+Class responsible for storing information about a payment channel
-channel constraints
-id of the payment channel
-channel image url
-channel display name
-Generated using TypeDoc
Class responsible for storing information about a payment channel
+Indicates that there was an error while fetching payment channels
-Error message
-Generated using TypeDoc
Indicates that there was an error while fetching payment channels
+Indicates a result of payment channels
-Generated using TypeDoc
AbstractIndicates a result of payment channels
+Indicates that payment channels were successfully received
-Payment channels
-Generated using TypeDoc
Indicates that payment channels were successfully received
+Indicates that payment was successful and module was closed
-Transaction id of the completed transaction
-Generated using TypeDoc
Indicates that payment was successful and module was closed
+OptionalmessageOptional error message or additional information
+OptionalpaymentPayment URL for continuation (used in screenless payments)
+Transaction id of the completed transaction
+ReadonlytypeType identifier for the result
+Class indicating that there is a payment constraint on a payment channel
-type of a payment constraint
-Generated using TypeDoc
Class indicating that there is a payment constraint on a payment channel
+Indicates that payment was successfully created
-Transaction id of the created transaction
-Generated using TypeDoc
Indicates that payment was successfully created
+OptionalmessageOptional error message or additional information
+OptionalpaymentPayment URL for continuation (used in screenless payments)
+Transaction id of the created transaction
+ReadonlytypeType identifier for the result
+Class responsible for storing information about payment details
-amount of money payer has to pay
-description of payment shown to payer
-description visible to store
-language of the transaction
-Generated using TypeDoc
Class responsible for storing information about payment details
+amount of money payer has to pay
+description of payment shown to payer
+description visible to store
+language of the transaction
+Class responsible for storing payment group's information
-id of the group
-group's image url
-group's display name
-Generated using TypeDoc
Class responsible for storing payment group's information
+Class responsible for storing selected payment methods
-selected payment methods
-selected digital wallets
-selected installment payments
-Generated using TypeDoc
Class responsible for storing selected payment methods
+selected payment methods
+selected digital wallets
+selected installment payments
+Class responsible for storing information about Raty Pekao payment
-id of Raty Pekao payment channel
-Generated using TypeDoc
Class responsible for storing information about Raty Pekao payment
+id of Raty Pekao payment channel
+Generated using TypeDoc
Generated using TypeDoc
Class responsible for storing information about redirect urls
+payer will be redirected to this url after successful payment
+payer will be redirected to this url after unsuccessful payment
+Indicates a result of Tpay UI module action
-Generated using TypeDoc
AbstractIndicates a result of Tpay UI module action
+OptionalmessageOptional error message or additional information
+OptionalpaymentPayment URL for continuation (used in screenless payments)
+OptionaltransactionTransaction ID when applicable
+Abstract ReadonlytypeType identifier for the result
+Indicates that payer has the same BLIK alias registered in more than one bank app. +
Indicates that payer has the same BLIK alias registered in more than one bank app. You need to display a list of aliases to user and then use AmbiguousBlikPayment to continue the payment.
-Ambiguous aliases that need to be displayed to the user
-Transaction id of the created transaction
-Generated using TypeDoc
Ambiguous aliases that need to be displayed to the user
+OptionalerrorError message when applicable
+OptionalmessageOptional error message or additional information
+OptionalpaymentPayment URL for continuation when applicable
+Transaction id of the created transaction
+ReadonlytypeType identifier for the result
+Indicates that creating payment failed because of error with:
+Indicates that creating payment failed because of error with:
Optional error message
-Transaction id of the created transaction
-Generated using TypeDoc
OptionalaliasesAmbiguous aliases for BLIK payments when applicable
+Optional error message
+OptionalmessageOptional error message or additional information
+OptionalpaymentPayment URL for continuation when applicable
+Transaction id of the created transaction
+ReadonlytypeType identifier for the result
+Indicates a module error
-Error message
-Generated using TypeDoc
Indicates a module error
+OptionalaliasesAmbiguous aliases for BLIK payments when applicable
+OptionalerrorError message when applicable
+Error message
+OptionalpaymentPayment URL for continuation when applicable
+OptionaltransactionTransaction ID when applicable
+ReadonlytypeType identifier for the result
+Indicates that payment was completed successfully
-Transaction id of the completed transaction
-Generated using TypeDoc
Indicates that payment was completed successfully
+OptionalaliasesAmbiguous aliases for BLIK payments when applicable
+OptionalerrorError message when applicable
+OptionalmessageOptional error message or additional information
+OptionalpaymentPayment URL for continuation when applicable
+Transaction id of the completed transaction
+ReadonlytypeType identifier for the result
+Class responsible for storing information about screenless payment details
-information about price and description
-information about payer
-redirects and notification information
-Generated using TypeDoc
Class responsible for storing information about screenless payment details
+information about price and description
+information about payer
+redirects and notification information
+Indicates that payment was created. +
Indicates that payment was created. If it was a credit card or transfer payment you might have to display paymentUrl to the user to finish the payment. If it was a BLIK payment user has to accept it in bank app. It is advised to use long polling mechanism to observe payment status via transactionId.
-Payment url, needs to be displayed to the user to finish the payment
-Transaction id of the created transaction
-Generated using TypeDoc
OptionalaliasesAmbiguous aliases for BLIK payments when applicable
+OptionalerrorError message when applicable
+OptionalmessageOptional error message or additional information
+Payment url, needs to be displayed to the user to finish the payment
+Transaction id of the created transaction
+ReadonlytypeType identifier for the result
+Indicates that payment was not created because of an error
-Optional error message
-Generated using TypeDoc
Indicates that payment was not created because of an error
+OptionalaliasesAmbiguous aliases for BLIK payments when applicable
+Optional error message
+OptionalmessageOptional error message or additional information
+OptionalpaymentPayment URL for continuation when applicable
+OptionaltransactionTransaction ID when applicable
+ReadonlytypeType identifier for the result
+Indicates a result of screenless action
-Generated using TypeDoc
AbstractIndicates a result of screenless action
+OptionalaliasesAmbiguous aliases for BLIK payments when applicable
+OptionalerrorError message when applicable
+OptionalmessageOptional error message or additional information
+OptionalpaymentPayment URL for continuation when applicable
+OptionaltransactionTransaction ID when applicable
+Abstract ReadonlytypeType identifier for the result
+Indicates that some data passed to payment is invalid
-Validation error message
-Generated using TypeDoc
Indicates that some data passed to payment is invalid
+OptionalaliasesAmbiguous aliases for BLIK payments when applicable
+OptionalerrorError message when applicable
+Validation error message
+OptionalpaymentPayment URL for continuation when applicable
+OptionaltransactionTransaction ID when applicable
+ReadonlytypeType identifier for the result
+Class responsible for storing information about standard Tpay UI module payment
-information about payer and automatic payment methods
-amount of money payer has to pay
-description of payment shown to payer
-payment notification url and email
-Generated using TypeDoc
Class responsible for storing information about standard Tpay UI module payment
+information about payer and automatic payment methods
+amount of money payer has to pay
+description of payment shown to payer
+description of payment shown to merchant
+payment notification url and email
+Class responsible for storing information about credit card token payment with Tpay UI module.
-token of tokenized card
-payer information
-amount of money payer has to pay
-description of payment shown to payer
-payment notification url and email
-Generated using TypeDoc
Class responsible for storing information about credit card token payment with Tpay UI module.
+token of tokenized card
+payer information
+amount of money payer has to pay
+description of payment shown to payer
+description of payment shown to merchant
+payment notification url and email
+Class responsible for storing information needed to start UI tokenization.
-information about payer
-url for tokenization notifications
-Generated using TypeDoc
Class responsible for storing information needed to start UI tokenization.
+information about payer
+url for tokenization notifications
+Indicates that credit card tokenization was successful and module was closed
-Generated using TypeDoc
Indicates that credit card tokenization was successful and module was closed
+OptionalmessageOptional error message or additional information
+OptionalpaymentPayment URL for continuation (used in screenless payments)
+OptionaltransactionTransaction ID when applicable
+ReadonlytypeType identifier for the result
+Indicates that credit card tokenization failed and module was closed
-Generated using TypeDoc
Indicates that credit card tokenization failed and module was closed
+OptionalmessageOptional error message or additional information
+OptionalpaymentPayment URL for continuation (used in screenless payments)
+OptionaltransactionTransaction ID when applicable
+ReadonlytypeType identifier for the result
+Class responsible for storing tokenized card information
-credit card token
-4 last numbers of credit card number
-credit card brand
-Generated using TypeDoc
Class responsible for storing tokenized card information
+credit card token
+4 last numbers of credit card number
+credit card brand
+Class responsible for storing information about Tpay configuration
-configuration information about merchant
-information about merchant in different languages
-languages that user will be able to use in Tpay UI module
-payment methods that user will be able to use in Tpay UI module
-Generated using TypeDoc
Class responsible for storing information about Tpay configuration
+configuration information about merchant
+information about merchant in different languages
+languages that user will be able to use in Tpay UI module
+payment methods that user will be able to use in Tpay UI module
+Class responsible for storing information about UI module transaction
-amount of money payer has to pay
-description of payment shown to payer
-payment notification url and email
-Generated using TypeDoc
Class responsible for storing information about UI module transaction
+amount of money payer has to pay
+description of payment shown to payer
+description of payment shown to merchant
+payment notification url and email
+Class responsible for storing information about transfer payment
-channel id of a bank in Tpay system
-Generated using TypeDoc
Class responsible for storing information about transfer payment
+channel id of a bank in Tpay system
+Indicates that some data passed to module is invalid
-Validation error message
-Generated using TypeDoc
Indicates that some data passed to module is invalid
+Validation error message
+OptionalpaymentPayment URL for continuation (used in screenless payments)
+OptionaltransactionTransaction ID when applicable
+ReadonlytypeType identifier for the result
+Class responsible for storing wallet configuration
-Google Pay configuration
-Apple Pay configuration
-Generated using TypeDoc
Class responsible for storing wallet configuration
+Google Pay configuration
+Apple Pay configuration
+Generated using TypeDoc
Enum describing possible credit card brands
+Generated using TypeDoc
Generated using TypeDoc
Enum describing Google Pay environment options
-Generated using TypeDoc
Enum describing Google Pay environment options
+Generated using TypeDoc
Generated using TypeDoc
Enum describing available payment constraint types
-Generated using TypeDoc
Enum describing available payment constraint types
+Generated using TypeDoc
Generated using TypeDoc
Generated using TypeDoc
Method used to configure Tpay UI Module
+Method used to configure Tpay UI Module
ConfigurationSuccess when Tpay module was successfully configured
-Generated using TypeDoc
Method used to configure Google Pay utils. +
Method used to configure Google Pay utils. Call this method before using isGooglePayAvailable and openGooglePay methods.
Android only
-Generated using TypeDoc
Method used to fetch payment channels from Tpay
-Generated using TypeDoc
Method used to fetch payment channels from Tpay
+Method used to check if Google Pay is available
+Method used to check if Google Pay is available
Android only
true if Google Pay is available on the device
-Generated using TypeDoc
Method used to open Google Pay
+Method used to open Google Pay
Android only
GooglePayOpenSuccess object if user successfully selects the credit card
-Generated using TypeDoc
Method used to continue BLIK one click payment if ambiguous aliases were returned
-Generated using TypeDoc
Method used to continue BLIK one click payment if ambiguous aliases were returned
+Method used to start screenless Apple Pay payment
-Generated using TypeDoc
Method used to start screenless Apple Pay payment
+Method used to start screenless BLIK payment
-Generated using TypeDoc
Method used to start screenless BLIK payment
+Method used to start screenless credit card payment
-Generated using TypeDoc
Method used to start screenless credit card payment
+Method used to start screenless Google Pay payment
-Generated using TypeDoc
Method used to start screenless Google Pay payment
+Method used to start screenless PayPo payment
-Generated using TypeDoc
Method used to start screenless PayPo payment
+Method used to start screenless Raty Pekao payment
-Generated using TypeDoc
Method used to start screenless Raty Pekao payment
+Method used to start screenless transfer payment
-Generated using TypeDoc
Method used to start screenless transfer payment
+Method used to start credit card token payment with Tpay UI Module
-Generated using TypeDoc
Method used to start credit card token payment with Tpay UI Module
+Method used to start standard payment with Tpay UI Module
-Generated using TypeDoc
Method used to start standard payment with Tpay UI Module
+Method used to start credit card tokenization with Tpay UI Module
-Generated using TypeDoc
Method used to start credit card tokenization with Tpay UI Module
+Generated using TypeDoc
The Tpay SDK empowers your app to seamlessly integrate Tpay’s payment functionalities, providing a comprehensive and developer-friendly solution for managing payments. +
This SDK allows your app to make payments with Tpay. Documentation is available here.
-npm install react-native-tpay
-
-Tpay package contains a UI module. Users can interact with it to make payments.
-Tpay UI module is a native Android bottom sheet. In order to handle system backpress events you need +
| Library | +Version | +
|---|---|
| npm | +1.3.8 | +
| Minimum Android SDK | +23 (Android 6.0, Marshmallow) | +
| Minimum iOS version | +12.0 | +
+For this SDK to work you will need client_id and client_secret tokens. You can find in merchant's panel.
If you are partner, you can obtain them in your merchant partner account. For detailed +instructions how to do that or how to create such an account +check this site.
++To be able to test the SDK properly, +use mock data.
+npm install react-native-tpay
+
+
++In this section we will provide examples for each configuration to the TpayConfiguration class +you will be able to make.
++Beneath you will find all configurations that are MANDATORY.
+At first, you have to configure your app to be able to make any requests by providing SDK info about
+your merchant account.
+Info about client_id and client_secret you will find in your merchant's panel at Integration -> API.
new Merchant(
new MerchantAuthorization(
'client_id',
'client_secret'
),
TpayEnvironment.sandbox,
new CertificatePinningConfiguration('ssl_pinning'),
'blik_alias',
new WalletConfiguration(
new GooglePayConfiguration('merchant_id'),
new ApplePayConfiguration('merchant_id', 'country_code')
)
);
+
+
+Tpay SDK provides two types of environments you can use in your app:
+TpayEnvironment.sandbox - used only for tests and in stage/dev flavor.TpayEnvironment.production - used for production flavors.For users to be able to use a specific payment method you have declare it in the configuration.
+| Method | +Description | +
|---|---|
| BLIK | +Web docs | +
| Pbl (Pay-By-Link) | +Web docs | +
| Card | +Web docs | +
| DigitalWallets | +GOOGLE_PAY ; APPLE_PAY | +
| InstallmentPayments | +RATY_PEKAO | +
| DeferredPayments (BNPL) | +PAY_PO | +
new PaymentMethods(
[PaymentMethod.card, PaymentMethod.blik, PaymentMethod.transfer],
[DigitalWallet.googlePay, DigitalWallet.applePay],
[InstallmentPayment.ratyPekao, InstallmentPayment.payPo],
);
+
+
+If you decide to enable the credit card payment option, you have to provide SSL certificates.
+
+You can find SSL public key on you merchant panel at section Integrations -> API -> Cards API.
+You can find public key on you merchant panel:
+Credit card payments -> APIIntegrations -> API -> Cards APInew CertificatePinningConfiguration('ssl_pinning')
+
+
+In order to be able to use Google Pay method you have to provide your merchant_id to the SDK.
+Your login name to the merchant panel is your merchant id.
+ new WalletConfiguration(
new GooglePayConfiguration('merchant_id'),
)
+
+
+In order to be able to use Apple Pay method you have to provide your merchant_id and country_code to the SDK.
+To obtain the merchantIdentifier, follow these steps:
+Certificates, Identifiers & Profiles section.Identifiers, select Merchant IDs.+ button to create a new Merchant ID. new WalletConfiguration(
new ApplePayConfiguration('merchant_id', 'country_code')
)
+
+
+Tpay SDK lets you decide what languages will be available in the Tpay's screen and which one of them +will be preferred/default.
+Right now, SDK allows you to use 2 languages:
+Language.pl - polishLanguage.en - englishnew Languages(Language.pl, [Language.en, Language.pl]);
+
+
+As a merchant, you can configure how information about you will be shown.
+You can set up your display name, city/headquarters and regulations link.
+You can choose to provide different copy for each language, or simply use one for all.
new MerchantDetails(
[
new LocalizedString(Language.pl, 'Sklep'),
new LocalizedString(Language.en, 'Merchant'),
],
[
new LocalizedString(Language.pl, 'Warszawie'),
new LocalizedString(Language.en, 'Warsaw'),
],
[
new LocalizedString(Language.pl, 'polish URL'),
new LocalizedString(Language.en, 'english URL'),
]
);
+
+
+
+Every LocalizedString value MUST NOT be an empty string!
+Otherwise this may cause an app crash.
Beneath you will find how a complete configuration should look like.
+const merchant = new Merchant(
new MerchantAuthorization(
'client_id',
'client_secret'
),
TpayEnvironment.sandbox,
new CertificatePinningConfiguration('ssl_pinning'),
'blik_alias',
new WalletConfiguration(
new GooglePayConfiguration('merchant_id'),
new ApplePayConfiguration('merchant_id', 'country_code')
)
);
const merchantDetails = new MerchantDetails(
[
new LocalizedString(Language.pl, 'Sklep'),
new LocalizedString(Language.en, 'Merchant'),
],
[
new LocalizedString(Language.pl, 'Warszawie'),
new LocalizedString(Language.en, 'Warsaw'),
],
[
new LocalizedString(Language.pl, 'polish URL'),
new LocalizedString(Language.en, 'english URL'),
]
);
const languages = new Languages(Language.pl, [Language.en, Language.pl]);
const paymentMethods = new PaymentMethods(
[PaymentMethod.card, PaymentMethod.blik, PaymentMethod.transfer],
[DigitalWallet.googlePay, DigitalWallet.applePay],
[InstallmentPayment.ratyPekao, InstallmentPayment.payPo]
);
const configuration = new TpayConfiguration(
merchant,
merchantDetails,
languages,
paymentMethods
);
await configure(configuration);
+
+
+Tpay UI module is a native Android bottom sheet. In order to handle system backpress events you need to add the following code to your Activity.
-import com.tpay.util.TpayBackpressUtil;
class MainActivity : ReactActivity() {
override fun onBackPressed() {
if (TpayBackpressUtil.isModuleVisible) {
TpayBackpressUtil.onBackPressed()
} else {
super.onBackPressed()
}
}
}
-
-When 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.
-The 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.
-Integration Steps
+import com.tpay.util.TpayBackpressUtil;
+
+class MainActivity : ReactActivity() {
+ override fun onBackPressed() {
+ if (TpayBackpressUtil.isModuleVisible) {
+ TpayBackpressUtil.onBackPressed()
+ } else {
+ super.onBackPressed()
+ }
+ }
+}
+
+
+If you are using Proguard/R8 in your project, you have to add the following rules to the
+android/app/proguard-rules.pro file, to keep Tpay SDK classes.
# Keep all Tpay SDK classes
+-keep class com.tpay.sdk.** { *; }
+
+
+When 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. +The 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”.
+Integration Steps:
Info.plist file.Example:
-<key>NSCameraUsageDescription</key>
<string>We need access to your camera to automatically fill the credit card form for secure payment processing.</string>
-
-function handleResult(result: Result) {
if (result instanceof TokenizationCompleted) {
// credit card was tokenized successfully
}
if (result instanceof TokenizationFailure) {
// credit card was not tokenized
}
if (result instanceof ConfigurationSuccess) {
// Tpay package was configured successfully
}
if (result instanceof ModuleClosed) {
// User closed the Tpay UI module
}
if (result instanceof ValidationError) {
// provided data is invalid
// check error message via result.message
}
if (result instanceof PaymentCreated) {
// payment completed successfully
// read transactionId via result.transactionId
}
if (result instanceof PaymentCompleted) {
// payment completed successfully
// read transactionId via result.transactionId
}
if (result instanceof PaymentCancelled) {
// payment was cancelled by user
// result.transactionId might not exist if
// an error occurred during payment creation
}
if (result instanceof MethodCallError) {
// package error occurred
// read error message via result.message
}
}
-
-async function configureTpay() {
const authorization = new MerchantAuthorization('client id', 'client secret');
const certificateConfiguration = new CertificatePinningConfiguration(
'public key hash'
);
const merchant = new Merchant(
authorization,
TpayEnvironment.production,
certificateConfiguration,
'BLIK alias to register',
new WalletConfiguration(
new GooglePayConfiguration('merchant id'),
new ApplePayConfiguration('merchant identifier', 'country code')
)
);
const merchantDetails = new MerchantDetails(
[
new LocalizedString(Language.pl, 'Sklep'),
new LocalizedString(Language.en, 'Merchant'),
],
[
new LocalizedString(Language.pl, 'Warszawie'),
new LocalizedString(Language.en, 'Warsaw'),
],
[
new LocalizedString(Language.pl, 'polish url'),
new LocalizedString(Language.en, 'english url'),
]
);
const languages = new Languages(Language.pl, [Language.en, Language.pl]);
const paymentMethods = new PaymentMethods(
[PaymentMethod.card, PaymentMethod.blik, PaymentMethod.transfer],
[DigitalWallet.googlePay, DigitalWallet.applePay],
[InstallmentPayment.ratyPekao]
);
const configuration = new TpayConfiguration(
merchant,
merchantDetails,
languages,
paymentMethods
);
const result = await configure(configuration);
handleResult(result);
}
-
-async function startUiPayment() {
// Create a payer object, phone number and address fields are optional
// Name and email fields can be empty, user will fill them in the UI
const payer = new Payer('John Doe', 'john.doe@example.com', null, null);
// Users can choose to save a credit card, it will result in your backend
// receiving the tokenized card data, provide it there to enable one click payment.
// You can also provide the BLIK alias to enable the one click BLIK payments.
// To register the BLIK alias user has to make a payment with 6-digit code first and save the alias.
// BLIK one click will be shown in the UI when the provided 'isRegistered' parameter is true.
const automaticPaymentMethods = new AutomaticPaymentMethods(
[new TokenizedCard('card token', 'card tail', CreditCardBrand.mastercard)],
new BlikAlias(true, 'alias value', 'alias label')
);
// Tokenized card and BLIK alias registration data will be sent to the notification url.
// Payments will result in a email notifications sent to notification email.
const notifications = new Notifications(
'https://yourdomain.com/notifications',
'store@yourdomain.com'
);
const payerContext = new PayerContext(payer, automaticPaymentMethods);
const transaction = new SingleTransaction(
payerContext,
39.99,
'transaction description',
notifications
);
const result = await startPayment(transaction);
handleResult(result);
}
-
-async function startCreditCardTokenizationUi() {
// Create a payer object, phone number and address fields are optional
// Name and email fields can be empty, user will fill them in the UI
const payer = new Payer('John Doe', 'john.doe@example.com', null, null);
// Tokenized card data will be sent to notification url
const tokenization = new Tokenization(
payer,
'https://yourdomain.com/notifications'
);
const result = await tokenizeCard(tokenization);
handleResult(result);
}
-
-async function startCreditCardTokenPaymentUi() {
// Create a payer object, phone number and address fields are optional
// Name and email fields are required, because user cannot fill them in the UI
const payer = new Payer('John Doe', 'john.doe@example.com', null, null);
const notifications = new Notifications(
'https://yourdomain.com/notifications',
'store@yourdomain.com'
);
const tokenPayment = new TokenPayment(
'credit card token',
payer,
39.99,
'transaction description',
notifications
);
const result = await startCardTokenPayment(tokenPayment);
handleResult(result);
}
-
-Tpay package provides methods to create payments without displaying the UI module.
-function handleScreenlessResult(result: ScreenlessResult) {
if (result instanceof ScreenlessPaid) {
// payment completed successfully
// read transactionId via result.transactionId
}
if (result instanceof ScreenlessPaymentCreated) {
// payment was successfully created
// if it was a BLIK payment user has to accept it in bank app
// if it was a credit card, transfer or installment payment you have to
// display result.paymentUrl to finish the payment
// it is advised to use long polling mechanism to observe payment status
// you can get transaction id from result.transactionId
}
if (result instanceof ScreenlessPaymentError) {
// creating payment failed
// read error message via result.error
}
if (result instanceof ScreenlessConfiguredPaymentFailed) {
// creating payment failed because of error with:
// - credit card data or credit card token
// - BLIK code or BLIK alias
}
if (result instanceof ScreenlessBlikAmbiguousAlias) {
// when using BLIK payment with alias this result indicates
// that user has alias registered in more than one bank
// display result.aliases to the user and
// continue payment using screenlessAmbiguousBLIKPayment(...) method
}
if (result instanceof ScreenlessValidationError) {
// provided data is invalid
// check error message via result.message
}
if (result instanceof ScreenlessMethodCallError) {
// package error occurred
// read error message via result.message
}
}
-
-Screenless payments require the following objects.
-// Create a payer object, phone number and address fields are optional
// Name and email fields are required in screenless payments
const payer = new Payer('John Doe', 'john.doe@example.com', null, null);
// Hidden description can be used to search for transaction internally.
// Tpay website (if needed) will open in the provided language.
const paymentDetails = new PaymentDetails(
39.99,
'transaction description',
'hidden description',
Language.pl
);
// User will be redirected to these urls after a payment on the Tpay website.
// Catch these urls in your web view to know if the payment was successful or not.
const redirects = new Redirects(
'https://yourdomain.com/success',
'https://yourdomain.com/error'
);
// Tokenized card and BLIK alias registration data will be sent to the notification url.
// Payments will result in a email notifications sent to notification email.
const notifications = new Notifications(
'https://yourdomain.com/notifications',
'store@yourdomain.com'
);
const callbacks = new Callbacks(redirects, notifications);
-
-Using BLIK user can pay with 6-digit code or alias (for returning customers).
-async function startScreenlessBlikPayment() {
// You have to provide either code or alias.
// If you provide both, package will try to register the alias.
// One alias can be registered in multiple banks.
const blikPayment = new BlikPayment(
'6-digit code',
new BlikAlias(true, 'alias value', 'alias label'),
paymentDetails,
payer,
callbacks
);
const screenlessResult = await screenlessBLIKPayment(blikPayment);
handleScreenlessResult(screenlessResult);
}
-
-screenlessBLIKPayment(...) method can return a ScreenlessBlikAmbiguousAlias result, -this means that user has BLIK alias registered in more than one bank. -You need to display ambiguous aliases provided in ScreenlessBlikAmbiguousAlias result to the user. -After that, you need to continue the payment with ambiguous alias selected by user using screenlessAmbiguousBLIKPayment(...) method.
-async function startAmbiguousBlikPayment(
result: ScreenlessBlikAmbiguousAlias,
ambiguousAlias: AmbiguousAlias
) {
// BLIK alias used to create payment with screenlessBLIKPayment(...) method
const blikAlias = new BlikAlias(true, 'alias value', 'alias label');
// Provide transaction id from result and ambiguous alias selected by user
const ambiguousBlikPayment = new AmbiguousBlikPayment(
result.transactionId,
blikAlias,
ambiguousAlias
);
const screenlessResult = await screenlessAmbiguousBLIKPayment(
ambiguousBlikPayment
);
handleScreenlessResult(screenlessResult);
}
+<key>NSCameraUsageDescription</key>
<string>We need access to your camera to automatically fill the credit card form for secure payment processing.</string>
-Screenless transfer payment
Transfer payment requires a channelId of bank in Tpay system.
-async function startScreenlessTransferPayment() {
// Provide channelId of a bank
const transferPayment = new TransferPayment(
3,
paymentDetails,
payer,
callbacks
);
const screenlessResult = await screenlessTransferPayment(transferPayment);
handleScreenlessResult(screenlessResult);
}
-
-Screenless Raty Pekao payment
Raty Pekao payment requires a channelId of Raty Pekao variant.
-async function startScreenlessRatyPekaoPayment() {
// Provide channelId of Raty Pekao variant
const ratyPekaoPayment = new RatyPekaoPayment(
80,
paymentDetails,
payer,
callbacks
);
const screenlessResult = await screenlessRatyPekaoPayment(ratyPekaoPayment);
handleScreenlessResult(screenlessResult);
}
-
-Screenless PayPo payment
async function startScreenlessPayPoPayment() {
const payPoPayment = new PayPoPayment(paymentDetails, payer, callbacks);
const screenlessResult = await screenlessPayPoPayment(payPoPayment);
handleScreenlessResult(screenlessResult);
}
-
-Screenless credit card payment
Credit card payment can be created with credit card data or credit card token (for returning customers).
-async function startScreenlessCreditCardPayment() {
const creditCard = new CreditCard(
'card number',
new ExpirationDate('month', 'year'),
'cvv',
// Configure if the credit card should be tokenized after payment
// Provide your domain, it's used while encrypting the credit card data
new CreditCardConfig(false, 'yourdomain.com', null)
);
const creditCardToken = 'card token';
// You have to provide either credit card or credit card token
const creditCardPayment = new CreditCardPayment(
creditCard,
creditCardToken,
paymentDetails,
payer,
callbacks
);
const screenlessResult = await screenlessCreditCardPayment(creditCardPayment);
handleScreenlessResult(screenlessResult);
}
-
-Screenless Google Pay payment (Android only)
Google Pay payment requires a Google Pay token.
-async function startScreenlessGooglePayPayment() {
const googlePayPayment = new GooglePayPayment(
'Google Pay token',
paymentDetails,
payer,
callbacks
);
const screenlessResult = await screenlessGooglePayPayment(googlePayPayment);
handleScreenlessResult(screenlessResult);
}
-
-Screenless Apple Pay payment (iOS only)
Apple Pay payment requires a Apple Pay token.
-async function startScreenlessApplePayPayment() {
const applePayPayment = new ApplePayPayment(
'Apple Pay token',
paymentDetails,
payer,
callbacks
);
const screenlessResult = await screenlessApplePayPayment(applePayPayment);
handleScreenlessResult(screenlessResult);
}
-
-Google Pay utils (Android only)
Tpay package offers few convenience methods to interact with Google Pay.
-async function googlePayUtils() {
// Create configuration object by providing the final price,
// your store name, your merchant id and a Google Pay environment
const googlePayUtilsConfiguration = new GooglePayUtilsConfiguration(
39.99,
'your store name',
'your merchant id',
GooglePayEnvironment.production,
null
);
const configurationResult = await configureGooglePayUtils(
googlePayUtilsConfiguration
);
if (configurationResult instanceof GooglePayConfigureError) {
// configuration failed
// check error message via configurationResult.message
}
if (configurationResult instanceof GooglePayConfigureSuccess) {
// utils are configured
const isAvailable = await isGooglePayAvailable();
if (isAvailable) {
// show Google Pay button
// if user clicks on the button do the following
const googlePayOpenResult = await openGooglePay();
if (googlePayOpenResult instanceof GooglePayOpenSuccess) {
// credit card data was received
// read Google Pay token via googlePayOpenResult.token
// and use it with GooglePayPayment
}
if (googlePayOpenResult instanceof GooglePayOpenCancelled) {
// user closed Google Pay
}
if (googlePayOpenResult instanceof GooglePayOpenNotConfigured) {
// Google Pay utils not configured
}
if (googlePayOpenResult instanceof GooglePayOpenUnknownError) {
// unknown error has occurred
}
}
}
}
-
-Fetch payment channels
Fetch available payment channels for your merchant account. Filter channels based on availability and payment constraints.
-async function fetchPaymentChannels() {
const result = await getPaymentChannels();
if (result instanceof PaymentChannelsSuccess) {
// payment channels received
result.channels.forEach((channel) => {
// channel can have payment constraints
// that need to be satisfied, otherwise the payment creation will fail
channel.constraints.forEach((constraint) => {
switch (constraint.type) {
case PaymentConstraintType.amount:
// check if your payment amount is between
// - amountConstraint.minimum
// - amountConstraint.maximum
// this constraint can have:
// - only minimum value
// - only maximum value
// - minimum and maximum values
const amountConstraint = constraint as AmountPaymentConstraint;
}
});
// display payment channel if all payment constraints are satisfied
});
}
if (result instanceof PaymentChannelsError) {
// error occurred
// read error message via result.message
}
}
-
-License
This library is released under the MIT License.
-Generated using TypeDoc
Integration Steps:
+app.json file.ios -> infoPlist -> NSCameraUsageDescriptionExample:
+"ios": {
"infoPlist": {
"NSCameraUsageDescription": "We need access to your camera to automatically fill the credit card form for secure payment processing."
}
},
+
+
+Tpay SDK provides two ways of handling payments:
+Official SDK screens - you can use Tpay's official screens where you just need to provide "soft"
+information, like price, description or payer info.Screenless - you can use screenless functionalities, where you set callbacks for payments and
+display all necessary information on your own screens.To make integration with the SDK faster, we created 3 types of sheets that can be used to handle +payments:
+SingleTransaction - the most simple screen where the user can choose any payment method and proceed with it,Tokenization - screen that handles generating payment token from the credit card,TokenPayment - screen that handles payment with previously created token for credit card,SingleTransaction flow opens a UI module and allows the customer to pick one of the defined payment methods. +This method requires setting up a few things in order to fulfill payment:
+amount - simply the price of the transactiondescription - transaction descriptionhiddenDescription (optional) - description visible only to the merchantpayerContext - information about payer
+payer - information about person who is making the payment
+name - payer nameemail - payer emailphone - payer phone numberaddress - payer address
+city - city namecountryCode - country code in ISO 3166-1 alpha-2 formataddress - street addresspostalCode - postal codeautomaticPaymentMethods - configuration of automatic payments
+tokenizedCards - previously saved credit cards
+token - card tokencardTails - last 4 digits of the cardbrand - card brandblikAlias - previously saved BLIK alias
+value - alias valuelabel - alias labelnotifications - info about where the merchant should be notified about new transactions
+notificationEmail - email address to send notification tonotificationUrl - URL to send notification to / URL to send tokens for tokenizationconst transaction = new SingleTransaction(
new PayerContext(
new Payer(
'John Doe',
'john.doe@example.com',
'123456789',
new Address(
'Test Street1',
'Warsaw',
'PL',
'00-007',
),
),
new AutomaticPaymentMethods(
[
new TokenizedCard(
'token',
'1234',
CreditCardBrand.visa,
),
new TokenizedCard(
'token',
'1234',
CreditCardBrand.mastercard,
),
],
new BlikAlias(
true,
'alias value',
'label'
),
),
),
39.99,
'transaction description',
'hidden description',
new Notifications(
'https://yourdomain.com/notifications',
'email@address'
)
);
await startPayment(transaction);
+
+
+
+Tpay SDK also supports NFC and camera card scanning:
NFC - Adding card info during transaction, user can tap on the NFC button.
+Then, if NFC is enabled in the device, after holding physical card near the device, SDK will scan
+the card's data and automatically fill the form with it.Camera - Adding card info during transaction, user can tap on the camera button.
+Then, if the camera scans card data successfully, form will be filled automatically.Using SingleTransaction screen you can set up automatic BLIK or card payments.
+Thanks to that, user will not have to enter BLIK/card data all over again each time making the
+payment.
If user using a card as a payment method will opt-in saving card, on successful payment, on the link
+specified as Notifications -> url Tpay backend will send information about the saved card token, tail and
+brand.
+Next, your backend has to send it to you, so you can use this info next time the same user will want
+to pay with the card.
+When you already have all required information, you can add automaticPaymentMethods to the payerContext.
new AutomaticPaymentMethods(
[
new TokenizedCard(
'token',
'1234',
CreditCardBrand.visa,
),
new TokenizedCard(
'token',
'1234',
CreditCardBrand.mastercard,
),
],
new BlikAlias(
true,
'alias value',
'label'
),
);
+
+
+Tpay SDK allows you to make credit card transactions without need of entering card's data each time. +Instead, you can create and use a token, associated with a specific card and user.
++There are 2 types of tokens you can use in transactions.
++For recurring payments, you can simply use created token to make transaction without need of user +interaction.
+
+notificationUrl should be the URL handled by your backend, because there will be sent token from
+the successful token creation.
const transaction = new Tokenization(
new Payer(
'John Doe',
'john.doe@example.com',
'123456789',
new Address(
'Test Street1',
'Warsaw',
'PL',
'00-007',
),
),
'https://yourdomain.com/notifications',
);
await tokenizeCard(transaction);
+
+
+If you already have card token payment, you can simply proceed with an actual tokenization +transaction.
+
+cardToken is a token sent to your backend during card tokenization process.
const transaction = new TokenPayment(
'card_token',
new Payer(
'John Doe',
'john.doe@example.com',
'123456789',
new Address(
'Test Street1',
'Warsaw',
'PL',
'00-007',
),
),
10.99,
'Payment description',
'Hidden description',
new Notifications(
'https://yourdomain.com/notifications',
'email@address',
)
);
await startCardTokenPayment(transaction);
+
+
+Each transaction with a predefined screen returns a result +that you can use to either show information to the user or e.g. log errors.
+function handleResult(result: Result) {
if (result instanceof TokenizationCompleted) {
// credit card was tokenized successfully
}
if (result instanceof TokenizationFailure) {
// credit card was not tokenized
}
if (result instanceof ConfigurationSuccess) {
// Tpay package was configured successfully
}
if (result instanceof ModuleClosed) {
// User closed the Tpay UI module
}
if (result instanceof ValidationError) {
// provided data is invalid
// check error message via result.message
}
if (result instanceof PaymentCreated) {
// payment completed successfully
// read transactionId via result.transactionId
}
if (result instanceof PaymentCompleted) {
// payment completed successfully
// read transactionId via result.transactionId
}
if (result instanceof PaymentCancelled) {
// payment was cancelled by user
// result.transactionId might not exist if
// an error occurred during payment creation
}
if (result instanceof MethodCallError) {
// package error occurred
// read error message via result.message
}
}
+
+
+Screenless payments are a special type of payment functionality that gives you the whole power of +payment process, but do not limit you to using predefined Tpay screens.
+To be able to use screenless functionalities you will need to know which payment methods are
+available to your merchant account. To get them, you can simply call getAvailablePaymentChannels
+method on the TpayPlatform.instance and set up result observer for them.
+Available methods needs to be filtered by the amount of the transaction, because some payment
+methods have specific constraints, like minimum or maximum amount.
async function getPaymentMethods() {
const result = await getAvailablePaymentChannels();
if (result instanceof PaymentChannelsSuccess) {
result.channels.forEach(channel => {
channel.constraints.forEach(constraint => {
switch (constraint.type) {
case PaymentConstraintType.amount:
// check if your payment amount is between
// - amountConstraint.minimum
// - amountConstraint.maximum
// this constraint can have:
// - only minimum value
// - only maximum value
// - minimum and maximum values
const amountConstraint = constraint as AmountPaymentConstraint;
break;
}
// display payment channel if all payment constraints are satisfied
});
});
}
if (result instanceof PaymentChannelsError) {
// handle error
}
}
+
+
+Before you run any screenless payment we do recommend setting up a function to handle specific payment results.
+You will need this to be able to monitor each payment status, i.e. it's status in real time. To do so,
+create a function, that will accept ScreenlessResult as a parameter and handle each of them.
+Note that long polling mechanism will start only when it's needed:
+ScreenlessPaymentCreated: when payment is created and you have to display payment URL.ScreenlessBlikAmbiguousAlias: when payment is created and there are more than one BLIK alias registered,
+so you have to display them to the user and continue payment with selected one.function handleScreenlessResult(result: ScreenlessResult) {
if (result instanceof ScreenlessPaid) {
// payment completed successfully
}
if (result instanceof ScreenlessPaymentCreated) {
// payment created, use result.paymentUrl to redirect the user to the payment page
}
if (result instanceof ScreenlessPaymentError) {
// creating payment failed
}
if (result instanceof ScreenlessConfiguredPaymentFailed) {
// creating payment failed because of error with:
// - credit card data or credit card token
// - BLIK code or BLIK alias
}
if (result instanceof ScreenlessBlikAmbiguousAlias) {
// single alias has been registered multiple times, use result.aliases to let user choose desired one
}
if (result instanceof ScreenlessValidationError) {
// passed data is incorrect
}
if (result instanceof ScreenlessMethodCallError) {
// something went wrong with the plugin
}
}
+
+
+CreditCardPayment allows you to create payments with credit card data.
+const transaction = new CreditCardPayment(
new CreditCard(
'card_number',
new ExpirationDate('12', '24'),
'123',
new CreditCardConfig(
false,
'yourstore.com',
null,
),
),
null,
new PaymentDetails(
19.99,
'transaction description',
'hidden description',
Language.pl,
),
new Payer(
'John Doe',
'john.doe@example.com',
'123456789',
new Address(
'Test Street1',
'Warsaw',
'PL',
'00-007',
),
),
new Callbacks(
new Redirects('https://success.url', 'https://error.url'),
new Notifications(
'https://yourdomain.com/notifications',
'email@address',
),
)
);
const result = await screenlessCreditCardPayment(transaction);
handleScreenlessResult(result);
+
+
+
+If CreditCardPayment returns ScreenlessPaymentCreated result, you have to handle paymentUrl
+sent with it and redirect user to it in order to complete the payment.
You can also Opt-in to generate a credit card token for future payments
+if you want to let users pay for transactions with previously used card.
+To do so, in creditCard -> config object, set the shouldSave to true.
new CreditCardConfig(
true,
'yourstore.com',
null,
)
+
+
+
+Generated card token will be sent to notificationUrl specified in the notifications callbacks.
If you already have a credit card token, you can then set up token payment omitting credit card
+info.
+To do so, use creditCardToken instead of creditCard field.
const transaction = new CreditCardPayment(
null,
'creadit_card_token',
new PaymentDetails(
19.99,
'transaction description',
'hidden description',
Language.pl,
),
new Payer(
'John Doe',
'john.doe@example.com',
'123456789',
new Address(
'Test Street1',
'Warsaw',
'PL',
'00-007',
),
),
new Callbacks(
new Redirects('https://success.url', 'https://error.url'),
new Notifications(
'https://yourdomain.com/notifications',
'email@address',
),
)
);
const result = await screenlessCreditCardPayment(transaction);
handleScreenlessResult(result);
+
+
++Right now, ReactNative's Tpay SDK does not support recurring payments. +If you'd like to implement them manually, +check our API support for recurring payments.
+Tpay SDK let's make transactions with BLIK as well. Simply use BLIKPayment class.
const blikPayment = new BlikPayment(
'blik_code',
null,
new PaymentDetails(
27.99,
'transaction description',
'hidden description',
Language.pl,
),
new Payer(
'John Doe',
'john.doe@example.com',
'123456789',
new Address(
'Test Street1',
'Warsaw',
'PL',
'00-007',
),
),
new Callbacks(
new Redirects('https://success.url', 'https://error.url'),
new Notifications(
'https://yourdomain.com/notifications',
'email@address',
),
),
);
const screenlessResult = await screenlessBLIKPayment(blikPayment);
handleScreenlessResult(screenlessResult);
+
+
+If you have for example a returning users and you want to make their payments with BLIK even +smoother, +you can register BLIK Alias for them, so they will only be prompted to accept payment in their +banking app, +without need of entering BLIK code each time they want to make the payment.
+
+In order to register alias for a user/payment, you have to set isRegistered parameter to false.
+Then, a successful payment will register the alias in Tpay system
+and next time user will be able to use it.
const blikPayment = new BlikPayment(
'777123',
new BlikAlias(false, '1234', 'label_1234'),
// rest of the BLIKPayment configuration
);
+
+
+If the payment were successful, you can assume an alias was created and can be used for the future +payments.
+
+If you already have registered alias for a user, you can set up isRegistered parameter to true.
+To be able to pay with BLIK alias, you MUST set the code parameter to null.
const blikPayment = new BlikPayment(
null,
new BlikAlias(false, '1234', 'label_1234'),
// rest of the BLIKPayment configuration
);
+
+
+Sometimes, there is a possibility for one alias to be registered more than once. For example, if +you register alias associated with one user for the multiple banks. +In such a situation, you have to fetch those aliases from Tpay API and show them to user to let him +choose one for the payment.
+In BLIKPayment's call in the execute method you can get ScreenlessBlikAmbiguousAlias
+type of result,
+that will indicate that current alias was registered more than once.
+This result holds all possible variations of the alias you used to start payment with in aliases
+field.
+You have to simply show them to the user, let him choose, and then use the chosen alias to retry the
+payment.
if (result instanceof ScreenlessBlikAmbiguousAlias) {
showAmbiguousAliases(result.aliases);
}
+
+
++In such scenario, you have to use different class to make the payment than at the beginning.
+const blikPayment = new AmbiguousBlikPayment(
transactionId,
new BlikAlias(true, '1234', 'label_1234'),
new AmbiguousAlias('name','code',),
);
const screenlessResult = await screenlessAmbiguousBLIKPayment(blikPayment);
handleScreenlessResult(screenlessResult);
+
+
++Right now, Tpay SDK does NOT support recurring payments with BLIK +In order to achieve that, check +our API support for BLIK recurring payments.
+Tpay SDK allows you to make transfer payments with bank available to your merchant account.
++To get banks with their channel ids check +the Get Payment Channels +section.
+After your customer chooses their bank from the list, you can use it's channelId to make the payment.
const transaction = new TransferPayment(
15,
new PaymentDetails(
0.15,
'transaction description',
'hidden description',
Language.pl,
),
new Payer(
'John Doe',
'john.doe@example.com',
'123456789',
new Address(
'Test Street1',
'Warsaw',
'PL',
'00-007',
),
),
new Callbacks(
new Redirects('https://success.url', 'https://error.url'),
new Notifications(
'https://yourdomain.com/notifications',
'email@address',
),
),
);
const screenlessResult = await screenlessTransferPayment(transaction);
handleScreenlessResult(screenlessResult);
+
+
+
+If TransferPayment returns ScreenlessPaymentCreated result, you have to handle paymentUrl
+sent with it and redirect user to it in order to complete the payment.
Tpay SDK allows you to create long term installment payments.
+const transaction = new RatyPekaoPayment(
15,
new PaymentDetails(
71.15,
'transaction description',
'hidden description',
Language.pl,
),
new Payer(
'John Doe',
'john.doe@example.com',
'123456789',
new Address(
'Test Street1',
'Warsaw',
'PL',
'00-007',
),
),
new Callbacks(
new Redirects('https://success.url', 'https://error.url'),
new Notifications(
'https://yourdomain.com/notifications',
'email@address',
),
),
);
const screenlessResult = await screenlessRatyPekaoPayment(transaction);
handleScreenlessResult(screenlessResult);
+
+
+
+If RatyPekaoPayment returns ScreenlessPaymentCreated result, you have to handle paymentUrl
+sent with it and redirect user to it in order to complete the payment.
Tpay SDK allows you to create deferred payments (BNPL) using PayPo method.
++For PayPo payment to work, amount of the payment must be at least 40PLN! +For more information about PayPo payments +check our PayPo documentation.
+
+For sandbox, working phone number is 500123456
async function startScreenlessPayPoPayment() {
const payPoPayment = new PayPoPayment(paymentDetails, payer, callbacks);
const screenlessResult = await screenlessPayPoPayment(payPoPayment);
handleScreenlessResult(screenlessResult);
}
+
+
+
+If PayPoPayment returns ScreenlessPaymentCreated result, you have to handle paymentUrl
+sent with it and redirect user to it in order to complete the payment.
Google Pay payment requires a Google Pay token.
+const transaction = new PayPoPayment(
new PaymentDetails(
71.15,
'transaction description',
'hidden description',
Language.pl,
),
new Payer(
'John Doe',
'john.doe@example.com',
'123456789',
new Address(
'Test Street1',
'Warsaw',
'PL',
'00-007',
),
),
new Callbacks(
new Redirects('https://success.url', 'https://error.url'),
new Notifications(
'https://yourdomain.com/notifications',
'email@address',
),
),
);
const screenlessResult = await screenlessPayPoPayment(transaction);
handleScreenlessResult(screenlessResult);
+
+
+
+If PayPoPayment returns ScreenlessPaymentCreated result, you have to handle paymentUrl
+sent with it and redirect user to it in order to complete the payment.
Tpay SDK allows you to perform Google Pay transactions.
+const transaction = new GooglePayPayment(
'google_pay_token',
new PaymentDetails(
71.15,
'transaction description',
'hidden description',
Language.pl,
),
new Payer(
'John Doe',
'john.doe@example.com',
'123456789',
new Address(
'Test Street1',
'Warsaw',
'PL',
'00-007',
),
),
new Callbacks(
new Redirects('https://success.url', 'https://error.url'),
new Notifications(
'https://yourdomain.com/notifications',
'email@address',
),
),
);
const screenlessResult = await screenlessGooglePayPayment(transaction);
handleScreenlessResult(screenlessResult);
+
+
+
+If GooglePayPayment returns ScreenlessPaymentCreated result, you have to handle paymentUrl
+sent with it and redirect user to it in order to complete the payment.
+Take under consideration, that choosing this option,
+you have to configure whole Google Wallet SDK and fetch Google Pay token on your own.
+For ANDROID system only, we provide a bit smoother way of handling Google Pay transactions with our wrappers.
If you do not want to configure whole Google Pay functionality, you can use GooglePlayUtil class.
+It will handle all payment, with additional info in bottom sheet and send you all the needed info in
+callback.
+To use GooglePayUtil, first, you have to configure them it.
+const config = new GooglePayUtilsConfiguration(
19.71,
'Test Merchant',
'merchant_id',
GooglePayEnvironment.test,
null,
);
const configResult = await configureGooglePayUtils(config);
if (configResult instanceof GooglePayConfigureError) {
// handle error
} else if (configResult instanceof GooglePayConfigureSuccess) {
// handle success
}
+
+
+
+Before you use our utils, make sure Google Pay is enabled in the device. Use isGooglePayAvailable method.
const isAvailable = await isGooglePayAvailable()
if (isAvailable) {
// display Google Pay button
}
+
+
+Next, you can open Google Pay module and let the user choose his credit card, so you can use it to make +the payment.
+const googlePayResult = await openGooglePay()
if (googlePayResult instanceof GooglePayOpenSuccess) {
// credit card data was received
}
else if (googlePayResult instanceof GooglePayOpenCancelled) {
// user closed Google Pay
}
else if (googlePayResult instanceof GooglePayOpenNotConfigured) {
// Google Pay utils not configured
}
else if (googlePayResult instanceof GooglePayOpenUnknownError) {
// unknown error has occurred
}
+
+
+
+If googlePayResult returns GooglePayOpenSuccess, you HAVE TO use it's content to make an actual
+payment buy using GooglePayPayment and screenlessGooglePayPayment.
Tpay SDK allows you to perform Apple Pay transactions.
+
+To be able to complete Apple Pay payment, you will need apple_pay_token. You HAVE TO
+acquire a token by yourself. To do that check
+official Apple Pay documentation
const applePayPayment = new ApplePayPayment(
'apple_pay_token',
new PaymentDetails(
71.15,
'transaction description',
'hidden description',
Language.pl,
),
new Payer(
'John Doe',
'john.doe@example.com',
'123456789',
new Address(
'Test Street1',
'Warsaw',
'PL',
'00-007',
),
),
new Callbacks(
new Redirects('https://success.url', 'https://error.url'),
new Notifications(
'https://yourdomain.com/notifications',
'email@address',
),
),
);
const screenlessResult = await screenlessApplePayPayment(applePayPayment);
handleScreenlessResult(screenlessResult);
+
+
+This library is released under the MIT License.
+Generated using TypeDoc
Whether the button should be enabled
-Called when button is clicked
-Generated using TypeDoc
Class responsible for storing payer address
-