public class

PMManager

extends Object
java.lang.Object
   ↳ com.paymill.android.service.PMManager

Class Overview

This class is the main entry point for all SDK calls.

Summary

Public Methods
static void addListener(PMNewDeviceIdListener listener)
Adds a strong reference of the specified listener to the SDK.
static void addListener(PMResetPaymentsListener listener)
Adds a strong reference of the specified listener to the SDK.
static void addListener(PMPaymentsAvailListener listener)
Adds a strong reference of the specified listener to the SDK.
static void addListener(PMGetPreauthListener listener)
Adds a strong reference of the specified listener to the SDK.
static void addListener(PMListTransListener listener)
Adds a strong reference of the specified listener to the SDK.
static void addListener(PMListNotConsPreauthsListener listener)
Adds a strong reference of the specified listener to the SDK.
static void addListener(PMPaymentSavedListener listener)
Adds a strong reference of the specified listener to the SDK.
static void addListener(PMGenerateTokenListener listener)
Adds a strong reference of the specified listener to the SDK.
static void addListener(PMPaymentDeletedListener listener)
Adds a strong reference of the specified listener to the SDK.
static void addListener(PMInitListener listener)
Adds a strong reference of the specified listener to the SDK.
static void addListener(PMConsumePreauthListener listener)
Adds a strong reference of the specified listener to the SDK.
static void addListener(PMListPaymentsListener listener)
Adds a strong reference of the specified listener to the SDK.
static void addListener(PMGetTransListener listener)
Adds a strong reference of the specified listener to the SDK.
static void addListener(PMListNotConsTransListener listener)
Adds a strong reference of the specified listener to the SDK.
static void addListener(PMTransListener listener)
Adds a strong reference of the specified listener to the SDK.
static void addListener(PMConsumeTransListener listener)
Adds a strong reference of the specified listener to the SDK.
static void addListener(PMListPreauthsListener listener)
Adds a strong reference of the specified listener to the SDK.
static void addListener(PMPreauthListener listener)
Adds a strong reference of the specified listener to the SDK.
static void arePaymentsAvailable(Context context)
Checks whether payments are available on the Safe Store.
static void consumePreauthorization(Context context, Preauthorization preauthorization)
Consume the given preauthorization.
static void consumePreauthorization(Context context, String preauthorizationId)
Consume the given preauthorization.
static void consumeTransaction(Context context, Transaction transaction)
Consume the given transaction.
static void consumeTransaction(Context context, String transactionId)
Consume the given transaction.
static void deletePayment(Context context, String paymentId, String password)
Deletes a payment from the Safe Store secured with the password provided.
static void deletePayment(Context context, Payment payment, String password)
Deletes a payment from the Safe Store secured with the password provided.
static void generateToken(Context context, PMPaymentMethod method, PMPaymentParams params)
Creates a new token.
static void generateToken(Context context, PMPaymentMethod method)
Creates a new token.
static void generateToken(Context context, PMPaymentMethod method, PMService.ServiceMode mode, String merchantPublicKey)
This is the preferred way to use the SDK.
static void generateToken(Context context, PMPaymentMethod method, PMPaymentParams params, PMService.ServiceMode mode, String merchantPublicKey)
This is the preferred way to use the SDK.
static PMBackgroundListener getBackgroundListener()
static String getDeviceId()
Returns the current device id.
static PMService.NotificationBuilder getForegroundNotificationBuilder()
The currently configured PMService.NotificationBuilder.
static void getNewDeviceId(Context context)
Create new device id.
static void getNotConsumedPreauthorizations(Context context)
Lists all preauthorizations for the configured deviceId.
static void getNotConsumedTransactions(Context context)
Lists not consumed transactions.
static void getPreauthorization(Context context, String preauthorizationId)
Get a specific preauthorization.
static void getTransaction(Context context, String transactionId)
Get a specific transaction.
static String getVersion()
Returns the SDK Version.
static void init(Context context, PMService.ServiceMode mode, String merchantPublicKey, PMBackgroundListener backgroundListener, String deviceId)
Initialize the SDK.
static boolean isForegroundEnabled()
Status of foreground mode of the PMService
static boolean isInit()
Status of the SDK
static void listPayments(Context context, String password)
Lists payments available on the Safe Store.
static void listPreauthorizations(Context context)
Lists all preauthorizations for the configured deviceId.
static void listTransactions(Context context)
Lists all transactions for the configured deviceId.
static void preauthorization(Context context, String token, PMPaymentParams parameters, boolean consumable)
Creates a new Preauthorization.
static void preauthorization(Context context, PMPaymentMethod method, PMPaymentParams parameters, boolean consumable)
Creates a new Preauthorization.
static void preauthorizationWithPayment(Context context, String paymentId, PMPaymentParams parameters, boolean consumable)
Creates a new Preauthorization.
static void preauthorizationWithPayment(Context context, Payment payment, PMPaymentParams parameters, boolean consumable)
Creates a new Preauthorization.
static void removeListener(PMGetTransListener listener)
Remove the specified listener from the SDK.
static void removeListener(PMTransListener listener)
Remove the specified listener from the SDK.
static void removeListener(PMPaymentsAvailListener listener)
Remove the specified listener from the SDK.
static void removeListener(PMListPreauthsListener listener)
Remove the specified listener from the SDK.
static void removeListener(PMResetPaymentsListener listener)
Remove the specified listener from the SDK.
static void removeListener(PMPreauthListener listener)
Remove the specified listener from the SDK.
static void removeListener(PMListPaymentsListener listener)
Remove the specified listener from the SDK.
static void removeListener(PMPaymentDeletedListener listener)
Remove the specified listener from the SDK.
static void removeListener(PMListTransListener listener)
Remove the specified listener from the SDK.
static void removeListener(PMListNotConsTransListener listener)
Remove the specified listener from the SDK.
static void removeListener(PMGetPreauthListener listener)
Remove the specified listener from the SDK.
static void removeListener(PMListNotConsPreauthsListener listener)
Remove the specified listener from the SDK.
static void removeListener(PMConsumePreauthListener listener)
Remove the specified listener from the SDK.
static void removeListener(PMGenerateTokenListener listener)
Remove the specified listener from the SDK.
static void removeListener(PMConsumeTransListener listener)
Remove the specified listener from the SDK.
static void removeListener(PMInitListener listener)
Remove the specified listener from the SDK.
static void removeListener(PMNewDeviceIdListener listener)
Remove the specified listener from the SDK.
static void removeListener(PMPaymentSavedListener listener)
Remove the specified listener from the SDK.
static void resetPayments(Context context)
Reset payments and password on the Safe Store.
static void savePayment(Context context, Payment payment, String password)
Saves a payment to the Safe Store secured with the password provided.
synchronized static void setBackgroundListener(PMBackgroundListener backgroundListener)
Sets the specified object as background listener.
static void setForegroundEnabled(boolean foregroundEnabled)
Configures the PMService to run in background.
static void setForegroundNotificationBuilder(PMService.NotificationBuilder foregroundNotificationBuilder)
static void transaction(Context context, String token, PMPaymentParams parameters, boolean consumable)
Creates a new Transaction.
static void transaction(Context context, PMPaymentMethod method, PMPaymentParams parameters, boolean consumable)
Creates a new Transaction.
static void transactionWithPayment(Context context, Payment payment, PMPaymentParams parameters, boolean consumable)
Creates a new Transaction.
static void transactionWithPayment(Context context, String paymentId, PMPaymentParams parameters, boolean consumable)
Creates a new Transaction.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static void addListener (PMNewDeviceIdListener listener)

Adds a strong reference of the specified listener to the SDK. Always remove the listener in onDestroy() of your UI elements.

Parameters
listener the listener.

public static void addListener (PMResetPaymentsListener listener)

Adds a strong reference of the specified listener to the SDK. Always remove the listener in onDestroy() of your UI elements.

Parameters
listener the listener.

public static void addListener (PMPaymentsAvailListener listener)

Adds a strong reference of the specified listener to the SDK. Always remove the listener in onDestroy() of your UI elements.

Parameters
listener the listener.

public static void addListener (PMGetPreauthListener listener)

Adds a strong reference of the specified listener to the SDK. Always remove the listener in onDestroy() of your UI elements.

Parameters
listener the listener.

public static void addListener (PMListTransListener listener)

Adds a strong reference of the specified listener to the SDK. Always remove the listener in onDestroy() of your UI elements.

Parameters
listener the listener.

public static void addListener (PMListNotConsPreauthsListener listener)

Adds a strong reference of the specified listener to the SDK. Always remove the listener in onDestroy() of your UI elements.

Parameters
listener the listener.

public static void addListener (PMPaymentSavedListener listener)

Adds a strong reference of the specified listener to the SDK. Always remove the listener in onDestroy() of your UI elements.

Parameters
listener the listener.

public static void addListener (PMGenerateTokenListener listener)

Adds a strong reference of the specified listener to the SDK. Always remove the listener in onDestroy() of your UI elements.

Parameters
listener the listener.

public static void addListener (PMPaymentDeletedListener listener)

Adds a strong reference of the specified listener to the SDK. Always remove the listener in onDestroy() of your UI elements.

Parameters
listener the listener.

public static void addListener (PMInitListener listener)

Adds a strong reference of the specified listener to the SDK. Always remove the listener in onDestroy() of your UI elements.

Parameters
listener the listener.

public static void addListener (PMConsumePreauthListener listener)

Adds a strong reference of the specified listener to the SDK. Always remove the listener in onDestroy() of your UI elements.

Parameters
listener the listener.

public static void addListener (PMListPaymentsListener listener)

Adds a strong reference of the specified listener to the SDK. Always remove the listener in onDestroy() of your UI elements.

Parameters
listener the listener.

public static void addListener (PMGetTransListener listener)

Adds a strong reference of the specified listener to the SDK. Always remove the listener in onDestroy() of your UI elements.

Parameters
listener the listener.

public static void addListener (PMListNotConsTransListener listener)

Adds a strong reference of the specified listener to the SDK. Always remove the listener in onDestroy() of your UI elements.

Parameters
listener the listener.

public static void addListener (PMTransListener listener)

Adds a strong reference of the specified listener to the SDK. Always remove the listener in onDestroy() of your UI elements.

Parameters
listener the listener.

public static void addListener (PMConsumeTransListener listener)

Adds a strong reference of the specified listener to the SDK. Always remove the listener in onDestroy() of your UI elements.

Parameters
listener the listener.

public static void addListener (PMListPreauthsListener listener)

Adds a strong reference of the specified listener to the SDK. Always remove the listener in onDestroy() of your UI elements.

Parameters
listener the listener.

public static void addListener (PMPreauthListener listener)

Adds a strong reference of the specified listener to the SDK. Always remove the listener in onDestroy() of your UI elements.

Parameters
listener the listener.

public static void arePaymentsAvailable (Context context)

Checks whether payments are available on the Safe Store.
You should first add a foreground listener to receive a callback on the UI thread or set a background listener to receive a callback on a separate Thread.

Parameters
context the application context.
Throws
IllegalArgumentException if the context is null or the manifest file is not configured correctly.

public static void consumePreauthorization (Context context, Preauthorization preauthorization)

Consume the given preauthorization. After successful consumption, the preauthorization will no longer appear in the list of not consumed.
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Parameters
preauthorization the preauthorization
Throws
IllegalArgumentException if the context or the preauthorization is null or the manifest file is not configured correctly.

public static void consumePreauthorization (Context context, String preauthorizationId)

Consume the given preauthorization. After successful consumption, the preauthorization will no longer appear in the list of not consumed.
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Parameters
context the application context.
preauthorizationId the id of the preauthorization.
Throws
IllegalArgumentException if the context is null or the preauthorizationId is null or the manifest file is not configured correctly.

public static void consumeTransaction (Context context, Transaction transaction)

Consume the given transaction. After successful consumption, the transaction will no longer appear in the list of not consumed.
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Parameters
context the application context.
transaction the transaction.
Throws
IllegalArgumentException if the context or the transaction is null or the manifest file is not configured correctly.

public static void consumeTransaction (Context context, String transactionId)

Consume the given transaction. After successful consumption, the transaction will no longer appear in the list of not consumed.
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Parameters
context the application context.
transactionId the id of the transaction.
Throws
IllegalArgumentException if the context is null or the transactionId is null or the manifest file is not configured correctly.

public static void deletePayment (Context context, String paymentId, String password)

Deletes a payment from the Safe Store secured with the password provided.
You should first add a foreground listener to receive a callback on the UI thread or set a background listener to receive a callback on a separate Thread.

Parameters
context the application context.
paymentId a paymentId of the object which is to be deleted.
password The password securing the payments.
Throws
IllegalArgumentException if the context is null or the paymentId is null or the password is null or the manifest file is not configured correctly.

public static void deletePayment (Context context, Payment payment, String password)

Deletes a payment from the Safe Store secured with the password provided.
You should first add a foreground listener to receive a callback on the UI thread or set a background listener to receive a callback on a separate Thread.

Parameters
context the application context.
payment a payment object which is to be deleted.
password The password securing the payments.
Throws
IllegalArgumentException if the context is null or the payment is null or the password is null or the manifest file is not configured correctly.

public static void generateToken (Context context, PMPaymentMethod method, PMPaymentParams params)

Creates a new token.
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Learn more about tokens in the PayMill documentation.

Parameters
context the application context.
method created with the PMFactory .
params created with the PMFactory . May be null.
Throws
IllegalArgumentException if the context is null or the mode is null or the manifest file is not configured correctly.

public static void generateToken (Context context, PMPaymentMethod method)

Creates a new token.
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Learn more about tokens in the PayMill documentation.

Parameters
context the application context.
method created with the PMFactory .
Throws
IllegalArgumentException if the context is null or the manifest file is not configured correctly.

public static void generateToken (Context context, PMPaymentMethod method, PMService.ServiceMode mode, String merchantPublicKey)

This is the preferred way to use the SDK.
Generate a token using this method and use it in your backend to process transactions, preauthorizations or any other future available trough the PayMill API.
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Learn more about tokens in the PayMill documentation.

Note: This method does not require an init and you don't need to have your account enabled for mobile.

Parameters
context the application context.
method created with the PMFactory .
mode LIVE or TEST mode.
merchantPublicKey your PayMill public key for LIVE or TEST mode, depending on the previous parameter.
Throws
IllegalArgumentException if the context is null or the method is null or the merchantPublicKey is null or the mode is null or the manifest file is not configured correctly.

public static void generateToken (Context context, PMPaymentMethod method, PMPaymentParams params, PMService.ServiceMode mode, String merchantPublicKey)

This is the preferred way to use the SDK.
Generate a token using this method and use it in your backend to process transactions, preauthorizations or any other future available trough the PayMill API.
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Learn more about tokens in the PayMill documentation.

Note: This method does not require an init and you don't need to have your account enabled for mobile.

Parameters
context the application context.
method created with the PMFactory .
params created with the PMFactory . May be null.
mode LIVE or TEST mode.
merchantPublicKey your PayMill public key for LIVE or TEST mode, depending on the previous parameter.
Throws
IllegalArgumentException if the context is null or the method is null or the merchantPublicKey is null or the mode is null or the manifest file is not configured correctly.

public static PMBackgroundListener getBackgroundListener ()

Returns
  • the current background listener or null if not set.

public static String getDeviceId ()

Returns the current device id.

Returns
  • the id or null if none is set.

public static PMService.NotificationBuilder getForegroundNotificationBuilder ()

The currently configured PMService.NotificationBuilder.

Returns

public static void getNewDeviceId (Context context)

Create new device id.
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Parameters
context the application context.
Throws
IllegalArgumentException if the context is null or the manifest file is not configured correctly.

public static void getNotConsumedPreauthorizations (Context context)

Lists all preauthorizations for the configured deviceId.
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Parameters
context the application context.
Throws
IllegalArgumentException if the context is null or the manifest file is not configured correctly.

public static void getNotConsumedTransactions (Context context)

Lists not consumed transactions.
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Parameters
context the application context.
Throws
IllegalArgumentException if the context is null or the manifest file is not configured correctly.

public static void getPreauthorization (Context context, String preauthorizationId)

Get a specific preauthorization.
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Parameters
preauthorizationId the id of the preauthorization.
Throws
IllegalArgumentException if the context is null or the preauthorizationId is null or the manifest file is not configured correctly.

public static void getTransaction (Context context, String transactionId)

Get a specific transaction.
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Parameters
context the application context.
transactionId the id of the transaction.
Throws
IllegalArgumentException if the context is null or the transactionId is null or the manifest file is not configured correctly.

public static String getVersion ()

Returns the SDK Version.

Returns
  • the current SDK version.

public static void init (Context context, PMService.ServiceMode mode, String merchantPublicKey, PMBackgroundListener backgroundListener, String deviceId)

Initialize the SDK. This should always be the first call you make, when you use the SDK. You should first add a foreground listener to receive a callback on the UI thread.

Note: If a background listener is set, it will receive the list of not consumed preauthorizations and transactions.

Parameters
mode LIVE or TEST mode.
merchantPublicKey your PayMill public key for LIVE or TEST mode, depending on the previous parameter.
backgroundListener an optional background listener.
deviceId an optional deviceID.
Note: You cannot specify an arbitrary string. The device ID must have been generated by the SDK, for example with getNewDeviceId(Context) . You can use this parameter to associate end users in your applications with SDK deviceIDs.If you don't specify a device ID, the SDK will generate one and save it for later use.
Throws
IllegalArgumentException if the context is null or the merchantPublicKey is null or the mode is null the manifest file is not configured correctly.

public static boolean isForegroundEnabled ()

Status of foreground mode of the PMService

Returns
  • true if the service is configured to run in foreground, false otherwise.

public static boolean isInit ()

Status of the SDK

Returns
  • true if the SDK has been successfully initialized, false otherwise

public static void listPayments (Context context, String password)

Lists payments available on the Safe Store.
You should first add a foreground listener to receive a callback on the UI thread or set a background listener to receive a callback on a separate Thread.

Parameters
context the application context.
password The password securing the payments.
Throws
IllegalArgumentException if the context is null or the password is null or the manifest file is not configured correctly.

public static void listPreauthorizations (Context context)

Lists all preauthorizations for the configured deviceId.
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Parameters
context the application context.
Throws
IllegalArgumentException if the context is null or the manifest file is not configured correctly.

public static void listTransactions (Context context)

Lists all transactions for the configured deviceId.
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Parameters
context the application context.
Throws
IllegalArgumentException if the context is null.

public static void preauthorization (Context context, String token, PMPaymentParams parameters, boolean consumable)

Creates a new Preauthorization.
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Note: If you set consumable to false, the preauthorization will never appears in the list of not consumed preauthorizations.

Parameters
context the application context.
token a previously generated token.
parameters created with the PMFactory .
consumable true if you want to consume the preauthorization later, false otherwise.
Throws
IllegalArgumentException if the context is null or the token is null or the parameters are null or the manifest file is not configured correctly.

public static void preauthorization (Context context, PMPaymentMethod method, PMPaymentParams parameters, boolean consumable)

Creates a new Preauthorization.
This is a convenience method, which generates a token in the background
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Note: If you set consumable to false, the preauthorization will never appears in the list of not consumed preauthorizations.

Parameters
context the application context.
method created with the PMFactory .
parameters created with the PMFactory .
consumable true if you want to consume the preauthorization later, false otherwise.
Throws
IllegalArgumentException if the context is null or the method is null or the parameters are null or the manifest file is not configured correctly.

public static void preauthorizationWithPayment (Context context, String paymentId, PMPaymentParams parameters, boolean consumable)

Creates a new Preauthorization.
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Note: If you set consumable to false, the preauthorization will never appears in the list of not consumed preauthorizations.

Parameters
context the application context.
paymentId the id of a previously created payment.
parameters created with the PMFactory .
consumable true if you want to consume the preauthorization later, false otherwise.
Throws
IllegalArgumentException if the context is null or the paymentId is null or the parameters are null or the manifest file is not configured correctly.

public static void preauthorizationWithPayment (Context context, Payment payment, PMPaymentParams parameters, boolean consumable)

Creates a new Preauthorization.
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Note: If you set consumable to false, the preauthorization will never appears in the list of not consumed preauthorizations.

Parameters
context the application context.
payment a previously created payment.
parameters created with the PMFactory .
consumable true if you want to consume the preauthorization later, false otherwise.
Throws
IllegalArgumentException if the context is null or the payment is null or parameters are null or the manifest file is not configured correctly.

public static void removeListener (PMGetTransListener listener)

Remove the specified listener from the SDK.

Parameters
listener the listener.

public static void removeListener (PMTransListener listener)

Remove the specified listener from the SDK.

Parameters
listener the listener.

public static void removeListener (PMPaymentsAvailListener listener)

Remove the specified listener from the SDK.

Parameters
listener the listener.

public static void removeListener (PMListPreauthsListener listener)

Remove the specified listener from the SDK.

Parameters
listener the listener.

public static void removeListener (PMResetPaymentsListener listener)

Remove the specified listener from the SDK.

Parameters
listener the listener.

public static void removeListener (PMPreauthListener listener)

Remove the specified listener from the SDK.

Parameters
listener the listener.

public static void removeListener (PMListPaymentsListener listener)

Remove the specified listener from the SDK.

Parameters
listener the listener.

public static void removeListener (PMPaymentDeletedListener listener)

Remove the specified listener from the SDK.

Parameters
listener the listener.

public static void removeListener (PMListTransListener listener)

Remove the specified listener from the SDK.

Parameters
listener the listener.

public static void removeListener (PMListNotConsTransListener listener)

Remove the specified listener from the SDK.

Parameters
listener the listener.

public static void removeListener (PMGetPreauthListener listener)

Remove the specified listener from the SDK.

Parameters
listener the listener.

public static void removeListener (PMListNotConsPreauthsListener listener)

Remove the specified listener from the SDK.

Parameters
listener the listener.

public static void removeListener (PMConsumePreauthListener listener)

Remove the specified listener from the SDK.

Parameters
listener the listener.

public static void removeListener (PMGenerateTokenListener listener)

Remove the specified listener from the SDK.

Parameters
listener the listener.

public static void removeListener (PMConsumeTransListener listener)

Remove the specified listener from the SDK.

Parameters
listener the listener.

public static void removeListener (PMInitListener listener)

Remove the specified listener from the SDK.

Parameters
listener the listener.

public static void removeListener (PMNewDeviceIdListener listener)

Remove the specified listener from the SDK.

Parameters
listener the listener.

public static void removeListener (PMPaymentSavedListener listener)

Remove the specified listener from the SDK.

Parameters
listener the listener.

public static void resetPayments (Context context)

Reset payments and password on the Safe Store.
You should first add a foreground listener to receive a callback on the UI thread or set a background listener to receive a callback on a separate Thread.

Parameters
context the application context.
Throws
IllegalArgumentException if the context is null or the manifest file is not configured correctly.

public static void savePayment (Context context, Payment payment, String password)

Saves a payment to the Safe Store secured with the password provided.
You should first add a foreground listener to receive a callback on the UI thread or set a background listener to receive a callback on a separate Thread.

Parameters
context the application context.
payment a payment object which is to be saved.
password The password securing the payments - cannot be null or missing.
Throws
IllegalArgumentException if the context is null or the payment is null or the password is null or the manifest file is not configured correctly.

public static synchronized void setBackgroundListener (PMBackgroundListener backgroundListener)

Sets the specified object as background listener. This listener will receive all SDK callbacks on a separate thread, which is protected by the PMService (which always runs in foreground mode).

public static void setForegroundEnabled (boolean foregroundEnabled)

Configures the PMService to run in background. Note, the default setting is true.

Parameters
foregroundEnabled true if you want the service to run in foreground mode, false otherwise

public static void setForegroundNotificationBuilder (PMService.NotificationBuilder foregroundNotificationBuilder)

Configures the PMService.NotificationBuilder. Note: This will have no effect if the service is not configured to run in foreground mode.

Parameters
foregroundNotificationBuilder a notification builder or null if you want to use the default one.

public static void transaction (Context context, String token, PMPaymentParams parameters, boolean consumable)

Creates a new Transaction.
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Note: If you set consumable to false, the transaction will never appears in the list of not consumed transactions.

Parameters
context the application context.
token a previously generated token.
parameters created with the PMFactory .
consumable true if you want to consume the transaction later, false otherwise.
Throws
IllegalArgumentException if the context is null or the token is null or the parameters are null or the manifest file is not configured correctly.

public static void transaction (Context context, PMPaymentMethod method, PMPaymentParams parameters, boolean consumable)

Creates a new Transaction.
This is a convenience method, which generates a token in the background
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Note: If you set consumable to false, the transaction will never appears in the list of not consumed transactions.

Parameters
context the application context.
method created with the PMFactory .
parameters created with the PMFactory .
consumable true if you want to consume the transaction later, false otherwise.
Throws
IllegalArgumentException if the context is null or the method is null or the parameters are null or the manifest file is not configured correctly.

public static void transactionWithPayment (Context context, Payment payment, PMPaymentParams parameters, boolean consumable)

Creates a new Transaction.
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Note: If you set consumable to false, the transaction will never appears in the list of not consumed transactions.

Parameters
context the application context.
payment a previously created payment.
parameters created with the PMFactory .
consumable true if you want to consume the transaction later, false otherwise.
Throws
IllegalArgumentException if the context is null or the payment is null or the parameters are null or the manifest file is not configured correctly.

public static void transactionWithPayment (Context context, String paymentId, PMPaymentParams parameters, boolean consumable)

Creates a new Transaction.
You should first add a foreground listener to receive a callback on the UI thread or a set a background listener to receive a callback on a separate Thread.

Note: If you set consumable to false, the transaction will never appears in the list of not consumed transactions.

Parameters
context the application context.
paymentId the id of a previously created payment.
parameters created with the PMFactory .
consumable true if you want to consume the transaction later, false otherwise.
Throws
IllegalArgumentException if the context is null or the paymentId is null or the parameters are null or the manifest file is not configured correctly.