Transaction Listener
+ Implement TransactionListener to be notified when a transaction ends. TransactionListener will notify you about the success, error or cancel state of the processed transaction.
diff --git a/docs/-datatrans -android -s-d-k/ch.datatrans.payment.api/-transaction-listener/index.html b/docs/-datatrans -android -s-d-k/ch.datatrans.payment.api/-transaction-listener/index.html new file mode 100644 index 0000000..75d771f --- /dev/null +++ b/docs/-datatrans -android -s-d-k/ch.datatrans.payment.api/-transaction-listener/index.html @@ -0,0 +1,91 @@ + +
+ +Implement TransactionListener to be notified when a transaction ends. TransactionListener will notify you about the success, error or cancel state of the processed transaction.
This is called after a transaction has been cancelled. This callback can be used to cancel any on-going process involving the transaction.
Some payment methods - such as Twint that involves an app-switch - also call this method when a payment error or decline occurs, to prevent showing an error dialog twice, as an error is already displayed in the payment application.
This is called after a transaction fails or encounters an error. Keep in mind that the SDK shows the error to the user before this is invoked. Therefore, this callback can be used to cancel any on-going process involving the transaction.
You may also use the error details provided here and display it the way you want when suppressing the error message within the TransactionOptions.
The exception that occurred.
This is called after a transaction has been successfully completed. This callback provides details about the transaction.
The object including the information related to the transaction success.
Your unique callback scheme to be used by the external web process (for example PayPal) to return to the merchant app.
Specify the GooglePayConfig object here. This is mandatory for Google Pay transactions.
This class can be used to specify miscellaneous options related to the transaction.
Specify the SamsungPayConfig object here. This is mandatory for Samsung Pay transactions.
Use this setting to display or hide critical and transaction errors.
Whether secure connections to Datatrans servers require a certificate chain signed with a specific CA private key. The device's trust settings are explicitly ignored, i.e. custom installed/white-listed certificates and/or CAs will not work.
Implementation uses SecureRandom
, make sure to patch your app if you intend to use this feature on older devices. (See here for more information.)
Please be advised that enabling this option will break your app in many corporate networks with anti-malware/-theft/-espionage SSL proxying.
This object is the main class to start any operation with the SDK.
Starts the SDK and displays any needed user interface using the provided activity. Note that a transaction can only be started once.
Activity used to present the user interface during an on-going transaction
Transaction that gets started
The currently active transaction. Use this if the starting activity has been destroyed and you have to reset the TransactionListener.
This class includes the success message and other details of a transaction. You will also obtain a transactionId that you can use for operations after the transaction (for example settlement, cancel or refund requests).
Object containing the token details of the payment method. The token details are also returned to your webhook and can be accessed with a status server-to-server request.
The payment method used during the transaction.
The transactionId that you can use for operations after the transaction (for example settlement, cancel or refund requests).
Use this constructor to start the SDK with a mobileToken that has previously been initialized with a server-to-server init call together with the card information. Please note that this will only be used if you have direct access to the card information of your customers. For this to work, you can only send one payment method in your server-to-server init call. Use this constructor if you use your own UI fields for the card information.
The mobileToken that has previously been initialized with a server-to-server init call.
Card object used for the transaction.
Use this constructor to start the SDK with a mobileToken that has previously been initialized with a server-to-server init call and display a selection of one or more saved tokens. The user will then be able to click on their desired saved token to finalize the payment.
The mobileToken that has previously been initialized with a server-to-server init call.
Specify here the tokens that are available for selection to the user.
Use this constructor to start the SDK with a mobileToken that has previously been initialized with a server-to-server init call. After this class is initialized, you should define its listener and the options properties.
The mobileToken that has previously been initialized with a server-to-server init call.
Use this class to start a transaction with a mobileToken
that has previously been initialized with a server-to-server init call. After the transaction has been completed - regardless if successful or not - the listener
will be called with some basic information about the success or failure.
The mobileToken that has previously been initialized with a server-to-server init call.
This listener will be notified after a transaction has been completed, regardless if successful or not.
The available options for how a transaction is handled by the mobile SDK.
This class contains information which is available when authentication fails.
This class contains information which is available when authorization fails.
This class contains information which is available when the datatrans backend returns an error.
This class contains information which is available if a user selects the TWINT payment method without having the app installed.
This class contains information which is available when there is a technical problem for example when Google Pay fails for an unknown reason.
This class includes the error message and other details of a transaction.
The payment method used during the transaction.
The identifier of the failed transaction.
Initializes the card expiry date with the given month and year.
Card expiry month, 1, 12, e.g. 1 for January or 12 for December
Card expiry year, 2 or 4 digits, e.g. 30 or 2030
Formats the month to a two digit string.
Formats the year to a two digit string.
Class to be used to represent the card expiry date (month and year).
Card expiry month, 1, 12, e.g. 1 for January or 12 for December
Card expiry year, 2 or 4 digits, e.g. 30 or 2030
Initializes a card token object with the given card data.
Payment method type, e.g. Visa
This is the token for the card, also known as alias. This can be used to debit the card without further customer interaction.
Expiry date
The masked card number you can use to display that specific card in your app. The masked card number shows the first 6 digits and the last 4 digits of the card, e.g. 432930xxxxxx6095.
Cardholder's name
Expiry date
Cardholder's name
For TalkBack this title is used instead of displayTitle.
A human readable title e.g. '•••• 6095'
This class contains the token information about a credit or debit card registration from a previously completed transaction. Just like any other PaymentMethodToken subclass, this class can be used to finalize a payment without user interaction or to display a selection of saved token payments to the user for fast checkouts. A token can be returned after completing a successful card payment or with a dedicated registration.
The masked card number you can use to display that specific card in your app. The masked card number shows the first 6 digits and the last 4 digits of the card, e.g. 432930xxxxxx6095.
Use this to initialize a card object with the card data.
Card type, e.g. Visa or Mastercard
Card number
Expiry date
Card security code - null if the card does not have a card security code
Cardholder's name
Cardholder's name
Expiry date
Use this class to process raw card data for payments. You should use this class if your app takes over the user interface for the card input fields.
Card type, e.g. Visa or Mastercard
Card number
Expiry date
Card security code - null if the card does not have a card security code
Cardholder's name
Card type, e.g. Visa or Mastercard
Although the library automatically hides Google Pay if no cards are supported, this shows if Google Pay is available for the specified card acquirers.
True if Google Pay is available on the device, false if it is unavailable.
Android context
Supported card acquirers
True if running on sandbox, false otherwise. Default is false.
Creates a new GooglePayConfig object.
Supported card acquirers
The displayed merchant name
Use this option to show Google Pay as a payment button instead of a listed payment method.
Configuration object for Google Pay transactions.
Supported card acquirers
The displayed merchant name
Use this option to show Google Pay as a payment button instead of a listed payment method.
This constructor has to be used to initialize a PayPal payment object.
Token for a PayPal account
PayPal e-mail address. This will be used for displaying purposes.
For TalkBack this title is used instead of displayTitle.
A human readable title
This class contains the token information about a PayPal registration from a previously completed transaction. Just like any other PaymentMethodToken subclass, this class can be used to finalize a payment without user interaction or to show a selection of saved token payments to the user for fast checkouts. A token can be returned after completing a successful PayPal payment or with a dedicated registration.
Token for a PayPal account
PayPal e-mail address. This will be used for displaying purposes.
PayPal e-mail address. This will be used for displaying purposes.
Creates a new token payment object from a given JSON string. This is a convenience method for serialization/deserialization.
The deserialized token payment object
JSON string to be deserialized into a token payment object
Creates a new token payment object from data encoded by the old payment library.
The decoded PaymentMethodToken, CardToken, PostFinanceCardToken, RekaToken or PayPalToken, if successful, null if legacyData is invalid.
Data encoded by the old payment library
This constructor has to be used to initialize a payment object.
Payment method type, e.g. PayPal or Twint.
The token that can be used to process recurring payments or fast checkouts.
For TalkBack this title is used instead of displayTitle.
A human readable title
This class is the base token class to gather token information and process recurring payments or fast checkouts with any payment method. This class is sufficient to process payments with tokens of some payment methods (e.g. Twint). More complex payment methods require you to specify some more details in their token subclasses (e.g. card payments, PostFinance, etc.). Please refer to the list below to see if you need to call an additional token subclass for your payments.
Easy payment methods: Swisscom Easypay, SEPA (ELV), Twint, Google Pay, Byjuno, SwissPass, Powerpay Invoice
Complex payment methods (requiring token subclass): Card payments, PayPal, PostFinance, Reka
Please refer to the Datatrans documentation to see if you can register a token during payment or require a dedicated registration.
Payment method type, e.g. PayPal or Twint.
The token that can be used to process recurring payments or fast checkouts.
Payment method type, e.g. Visa.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
This function returns the PaymentMethodType based on the Datatrans payment method identifier.
The payment method type, e.g. Visa
The payment method identifier from Datatrans
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method used during the transaction.
This constructor has to be used to initialize a PostFinance Card payment object.
Token for a PostFinance Card
Expiry date
The masked card number you can use to display that specific card in your app. The masked card number shows the last 4 digits of the card, e.g. **** 1234.
This class contains the token information about a PostFinance Card registration from a previously completed transaction. Just like any other PaymentMethodToken subclass, this class can be used to finalize a payment without user interaction or to show a selection of saved token payments to the user for fast checkouts. A token can be returned after completing a successful PostFinance Card payment or with a dedicated registration.
Token for a PostFinance Card
Expiry date
The masked card number you can use to display that specific card in your app. The masked card number shows the last 4 digits of the card, e.g. **** 1234.
This constructor has to be used to initialize a Reka payment object.
Token for a Reka card
Expiry date
The masked card number you can use to display that specific card in your app. The masked card number shows the first 6 digits and the last 4 digits of the card, e.g. 123456xxxxxxxxx1234.
This class contains the token information about a Reka card registration from a previously completed transaction. Just like any other PaymentMethodToken subclass, this class can be used to finalize a payment without user interaction or to show a selection of saved token payments to the user for fast checkouts. A token can be returned after completing a successful Reka payment or with a dedicated registration.
Token for a Reka card
Expiry date
The masked card number you can use to display that specific card in your app. The masked card number shows the first 6 digits and the last 4 digits of the card, e.g. 123456xxxxxxxxx1234.
This constructor has to be used with SEPA (ELV) tokens created before April 15th 2015. Please refer to the primary constructor for newer tokens.
Token for SEPA (ELV). This value was returned for tokens created before April 15th 2015.
A bank code (German: Bankleitzahl) is a unique identification code for a particular bank. This is required for tokens created before April 15th 2015.
For TalkBack this title is used instead of displayTitle.
A human readable title
This class contains the token information about a SEPA (ELV) registration from a previously completed transaction. Just like any other PaymentMethodToken subclass, this class can be used to finalize a payment without user interaction or to show a selection of saved token payments to the user for fast checkouts. A token can be returned after completing a successful SEPA payment or with a dedicated registration.
Token for SEPA (ELV)
Although the library automatically hides Samsung Pay if no cards are supported, this shows if Samsung Pay is available for the specified card acquirers.
True if Samsung Pay is available on the device, false if it is unavailable.
Android context
Supported card acquirers
True if running on sandbox, false otherwise. Default is false.
Supported card acquirers
The displayed merchant name
Class for transaction configurations for Samsung Pay payments.
Activity that handles switches to other external processes such as Custom Tabs which are used for PayPal. This activity must be defined in the app manifest like this:
<activity android:name="ch.datatrans.payment.ExternalProcessRelayActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="com.example.payment" />
</intent-filter>
</activity>
In addition, the defined data scheme (e.g. com.example.payment) must be set in the ch.datatrans.payment.api.TransactionOptions using ch.datatrans.payment.api.TransactionOptions.appCallbackScheme.
Implement TransactionListener to be notified when a transaction ends. TransactionListener will notify you about the success, error or cancel state of the processed transaction.
This is called after a transaction has been cancelled. This callback can be used to cancel any on-going process involving the transaction.
Some payment methods - such as Twint that involves an app-switch - also call this method when a payment error or decline occurs, to prevent showing an error dialog twice, as an error is already displayed in the payment application.
This is called after a transaction fails or encounters an error. Keep in mind that the SDK shows the error to the user before this is invoked. Therefore, this callback can be used to cancel any on-going process involving the transaction.
You may also use the error details provided here and display it the way you want when suppressing the error message within the TransactionOptions.
The exception that occurred.
This is called after a transaction has been successfully completed. This callback provides details about the transaction.
The object including the information related to the transaction success.
Your unique callback scheme to be used by the external web process (for example PayPal) to return to the merchant app.
Specify the GooglePayConfig object here. This is mandatory for Google Pay transactions.
This class can be used to specify miscellaneous options related to the transaction.
Specify the SamsungPayConfig object here. This is mandatory for Samsung Pay transactions.
Use this setting to display or hide critical and transaction errors.
Whether secure connections to Datatrans servers require a certificate chain signed with a specific CA private key. The device's trust settings are explicitly ignored, i.e. custom installed/white-listed certificates and/or CAs will not work.
Implementation uses SecureRandom
, make sure to patch your app if you intend to use this feature on older devices. (See here for more information.)
Please be advised that enabling this option will break your app in many corporate networks with anti-malware/-theft/-espionage SSL proxying.
This object is the main class to start any operation with the SDK.
Starts the SDK and displays any needed user interface using the provided activity. Note that a transaction can only be started once.
Activity used to present the user interface during an on-going transaction
Transaction that gets started
The currently active transaction. Use this if the starting activity has been destroyed and you have to reset the TransactionListener.
This class includes the success message and other details of a transaction. You will also obtain a transactionId that you can use for operations after the transaction (for example settlement, cancel or refund requests).
Object containing the token details of the payment method. The token details are also returned to your webhook and can be accessed with a status server-to-server request.
The payment method used during the transaction.
The transactionId that you can use for operations after the transaction (for example settlement, cancel or refund requests).
Use this constructor to start the SDK with a mobileToken that has previously been initialized with a server-to-server init call together with the card information. Please note that this will only be used if you have direct access to the card information of your customers. For this to work, you can only send one payment method in your server-to-server init call. Use this constructor if you use your own UI fields for the card information.
The mobileToken that has previously been initialized with a server-to-server init call.
Card object used for the transaction.
Use this constructor to start the SDK with a mobileToken that has previously been initialized with a server-to-server init call and display a selection of one or more saved tokens. The user will then be able to click on their desired saved token to finalize the payment.
The mobileToken that has previously been initialized with a server-to-server init call.
Specify here the tokens that are available for selection to the user.
Use this constructor to start the SDK with a mobileToken that has previously been initialized with a server-to-server init call. After this class is initialized, you should define its listener and the options properties.
The mobileToken that has previously been initialized with a server-to-server init call.
Use this class to start a transaction with a mobileToken
that has previously been initialized with a server-to-server init call. After the transaction has been completed - regardless if successful or not - the listener
will be called with some basic information about the success or failure.
The mobileToken that has previously been initialized with a server-to-server init call.
This listener will be notified after a transaction has been completed, regardless if successful or not.
The available options for how a transaction is handled by the mobile SDK.
This class contains information which is available when authentication fails.
This class contains information which is available when authorization fails.
This class contains information which is available when the datatrans backend returns an error.
This class contains information which is available if a user selects the TWINT payment method without having the app installed.
This class contains information which is available when there is a technical problem for example when Google Pay fails for an unknown reason.
This class includes the error message and other details of a transaction.
The payment method used during the transaction.
The identifier of the failed transaction.
Initializes the card expiry date with the given month and year.
Card expiry month, 1, 12, e.g. 1 for January or 12 for December
Card expiry year, 2 or 4 digits, e.g. 30 or 2030
Formats the month to a two digit string.
Formats the year to a two digit string.
Class to be used to represent the card expiry date (month and year).
Card expiry month, 1, 12, e.g. 1 for January or 12 for December
Card expiry year, 2 or 4 digits, e.g. 30 or 2030
Initializes a card token object with the given card data.
Payment method type, e.g. Visa
This is the token for the card, also known as alias. This can be used to debit the card without further customer interaction.
Expiry date
The masked card number you can use to display that specific card in your app. The masked card number shows the first 6 digits and the last 4 digits of the card, e.g. 432930xxxxxx6095.
Cardholder's name
Expiry date
Cardholder's name
A human readable title e.g. '•••• 6095'
For TalkBack this title is used instead of displayTitle.
This class contains the token information about a credit or debit card registration from a previously completed transaction. Just like any other PaymentMethodToken subclass, this class can be used to finalize a payment without user interaction or to display a selection of saved token payments to the user for fast checkouts. A token can be returned after completing a successful card payment or with a dedicated registration.
The masked card number you can use to display that specific card in your app. The masked card number shows the first 6 digits and the last 4 digits of the card, e.g. 432930xxxxxx6095.
Use this to initialize a card object with the card data.
Card type, e.g. Visa or Mastercard
Card number
Expiry date
Card security code - null if the card does not have a card security code
Cardholder's name
Cardholder's name
Expiry date
Use this class to process raw card data for payments. You should use this class if your app takes over the user interface for the card input fields.
Card type, e.g. Visa or Mastercard
Card number
Expiry date
Card security code - null if the card does not have a card security code
Cardholder's name
Card type, e.g. Visa or Mastercard
Although the library automatically hides Google Pay if no cards are supported, this shows if Google Pay is available for the specified card acquirers.
True if Google Pay is available on the device, false if it is unavailable.
Android context
Supported card acquirers
True if running on sandbox, false otherwise. Default is false.
Creates a new GooglePayConfig object.
Supported card acquirers
The displayed merchant name
Use this option to show Google Pay as a payment button instead of a listed payment method.
Configuration object for Google Pay transactions.
Supported card acquirers
The displayed merchant name
Use this option to show Google Pay as a payment button instead of a listed payment method.
This constructor has to be used to initialize a PayPal payment object.
Token for a PayPal account
PayPal e-mail address. This will be used for displaying purposes.
A human readable title
For TalkBack this title is used instead of displayTitle.
This class contains the token information about a PayPal registration from a previously completed transaction. Just like any other PaymentMethodToken subclass, this class can be used to finalize a payment without user interaction or to show a selection of saved token payments to the user for fast checkouts. A token can be returned after completing a successful PayPal payment or with a dedicated registration.
Token for a PayPal account
PayPal e-mail address. This will be used for displaying purposes.
PayPal e-mail address. This will be used for displaying purposes.
Creates a new token payment object from a given JSON string. This is a convenience method for serialization/deserialization.
The deserialized token payment object
JSON string to be deserialized into a token payment object
Creates a new token payment object from data encoded by the old payment library.
The decoded PaymentMethodToken, CardToken, PostFinanceCardToken, RekaToken or PayPalToken, if successful, null if legacyData is invalid.
Data encoded by the old payment library
This constructor has to be used to initialize a payment object.
Payment method type, e.g. PayPal or Twint.
The token that can be used to process recurring payments or fast checkouts.
A human readable title
For TalkBack this title is used instead of displayTitle.
This class is the base token class to gather token information and process recurring payments or fast checkouts with any payment method. This class is sufficient to process payments with tokens of some payment methods (e.g. Twint). More complex payment methods require you to specify some more details in their token subclasses (e.g. card payments, PostFinance, etc.). Please refer to the list below to see if you need to call an additional token subclass for your payments.
Easy payment methods: Swisscom Easypay, SEPA (ELV), Twint, Google Pay, Byjuno, SwissPass, Powerpay Invoice
Complex payment methods (requiring token subclass): Card payments, PayPal, PostFinance, Reka
Please refer to the Datatrans documentation to see if you can register a token during payment or require a dedicated registration.
Payment method type, e.g. PayPal or Twint.
The token that can be used to process recurring payments or fast checkouts.
Payment method type, e.g. Visa.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
This function returns the PaymentMethodType based on the Datatrans payment method identifier.
The payment method type, e.g. Visa
The payment method identifier from Datatrans
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method identifier based on the PaymentMethodType.
The payment method used during the transaction.
This constructor has to be used to initialize a PostFinance Card payment object.
Token for a PostFinance Card
Expiry date
The masked card number you can use to display that specific card in your app. The masked card number shows the last 4 digits of the card, e.g. **** 1234.
This class contains the token information about a PostFinance Card registration from a previously completed transaction. Just like any other PaymentMethodToken subclass, this class can be used to finalize a payment without user interaction or to show a selection of saved token payments to the user for fast checkouts. A token can be returned after completing a successful PostFinance Card payment or with a dedicated registration.
Token for a PostFinance Card
Expiry date
The masked card number you can use to display that specific card in your app. The masked card number shows the last 4 digits of the card, e.g. **** 1234.
This constructor has to be used to initialize a Reka payment object.
Token for a Reka card
Expiry date
The masked card number you can use to display that specific card in your app. The masked card number shows the first 6 digits and the last 4 digits of the card, e.g. 123456xxxxxxxxx1234.
This class contains the token information about a Reka card registration from a previously completed transaction. Just like any other PaymentMethodToken subclass, this class can be used to finalize a payment without user interaction or to show a selection of saved token payments to the user for fast checkouts. A token can be returned after completing a successful Reka payment or with a dedicated registration.
Token for a Reka card
Expiry date
The masked card number you can use to display that specific card in your app. The masked card number shows the first 6 digits and the last 4 digits of the card, e.g. 123456xxxxxxxxx1234.
This constructor has to be used with SEPA (ELV) tokens created before April 15th 2015. Please refer to the primary constructor for newer tokens.
Token for SEPA (ELV). This value was returned for tokens created before April 15th 2015.
A bank code (German: Bankleitzahl) is a unique identification code for a particular bank. This is required for tokens created before April 15th 2015.
A human readable title
For TalkBack this title is used instead of displayTitle.
This class contains the token information about a SEPA (ELV) registration from a previously completed transaction. Just like any other PaymentMethodToken subclass, this class can be used to finalize a payment without user interaction or to show a selection of saved token payments to the user for fast checkouts. A token can be returned after completing a successful SEPA payment or with a dedicated registration.
Token for SEPA (ELV)
Although the library automatically hides Samsung Pay if no cards are supported, this shows if Samsung Pay is available for the specified card acquirers.
True if Samsung Pay is available on the device, false if it is unavailable.
Android context
Supported card acquirers
True if running on sandbox, false otherwise. Default is false.
Supported card acquirers
The displayed merchant name
Class for transaction configurations for Samsung Pay payments.