Skip to main content

Transfers

Introduction

A transfer is the movement of funds between two wallet accounts. The Transfer service exposes features for managing transfers:

  • Preview, Create and Confirm a Transfer.
  • Get Transfers List.
  • Get Single Transfer.

Transfer requires the following parameters:

  • amount - The amount in minor units.
  • currencyCode - Currency of the amount
  • email or customerId of the recipient.
  • reason for the transfer.

For successful transfer the following conditions must be met:

  • Customer should have enough balance in the requested currency.
  • Recipient customer must exist in the system and must not be restricted.

Use the following code to obtain an instance of TransferService:

val transferService = Wallet.getInstance().getTransferService()

Preview Transfer

Transfer is created in PREVIEW state, which can be used to determine the recipient and FX amount (if applicable). Transfers in PREVIEW state do not create actual transaction in Paysafe Wallet system.

TransferRequest

ParameterData typeDescriptionExample
amountIntRequired parameter for amount of transfer in minor units.100
currencyCodeStringRequired parameter for currency of the transfer. Format ISO 4217."USD"
recipientCustomerTransferRecipientContains transfer recipient information.CustomerTransferRecipient(...)
merchantRefNumStringOptional parameter for merchant reference number."19481996"
fxQuoteStringFX Quote ID for the transfer in case currency conversion is required. If not passed currency conversion is not performed.404679be-ccbf-4528-b880-e14cc5041753
transferDetailsTransferDetailsRequired parameter containing transfer reason and description.TransferDetails(...)

CustomerTransferRecipient

ParameterData typeDescriptionExample
customerIdStringThe unique identifier of the recipient."5435323362"
emailStringThe email address of the recipient.user@example.com

TransferDetails

ParameterData typeDescriptionExample
reasonStringThe actual purpose of the transfer.TransferReason.PEER_TRANSFER / .peerTransfer
descriptionStringOptional human readable description for the transfer."Holiday Gift!"
val transferRequest = CustomerTransferRequest(
amount = 200,
currencyCode = "USD",
recipient = CustomerTransferRecipient(
customerId = null,
email = "user@example.com"
),
merchantRefNum = "2b01127a-4929-4d0e-b9cb-a29a8d1c499c",
fxQuote = "404679be-ccbf-4528-b880-e14cc5041753",
transferDetails = TransferDetails(
reason = TransferReason.PEER_TRANSFER,
description = "Transfer money"
)
)

try {
val transferPreview = transferService.preview(transferRequest)
Log.d(TAG, transferPreview.toString())
} catch (exception: Exception) {
Log.d(TAG, exception.toString())
}

Create Transfer

Use create method to perform the required validations and move the transfer in PENDING state. Pass the transferId from the Transfer object returned by the preview method.

TransferCreate

ParameterData typeDescriptionExample
transferIdStringRequired parameter for id of the transfer."urn:transfer:01HNDA4FJJTN4TK66WK4251SWH"
paymentPropertiesList/ArrayParameter reserved for future use. Currently has no usage.null/nil
val transferCreate = TransferCreate(transferId = "urn:transfer:01HNDA4FJJTN4TK66WK4251SWH")

try {
val transfer = transferService.create(transferCreate)
Log.d(TAG, transfer.toString())
} catch (exception: Exception) {
Log.d(TAG, exception.toString())
}

Confirm Transfer

Use confirm method to confirm the transfer. Utilize the id from the CustomerTransfer object returned by the create method.

info

This operation might require Strong Customer Authentication (SCA). Please read Strong Customer Authentication for more information on the process.

note

If the CustomerTransfer object returned by confirm has action: PaymentCompletionAction.SCA, the scaDetails will contain the SCA authentication properties needed to complete the process. Follow the steps outlined in Submit the SCA Authentication to confirm the event. After the SCA event is accepted, invoke confirm method again, providing scaDetails in the TransferConfirm parameter.

TransferConfirm

ParameterData typeDescriptionExample
transferIdStringRequired parameter for id of the transfer."urn:transfer:01HNDA4FJJTN4TK66WK4251SWH"
paymentPropertiesList/ArrayParameter reserved for future use. Currently has no usage.null/nil
scaDetailsScaAuthenticationEventRequestSCA authentication properties used to complete the process.ScaAuthenticationEventRequest(eventId: "7cebe19b-4a96-4d7b-badd-c07eaee786fc", walletOperationID: "03f44a74-937d-430d-b06e-09b42b0f2b0e")
val transferConfirm = TransferConfirm(transferId = "urn:transfer:01HNDA4FJJTN4TK66WK4251SWH")

try {
val transfer = transferService.confirm(transferConfirm)
Log.d(TAG, transfer.toString())
} catch (exception: Exception) {
Log.d(TAG, exception.toString())
}

Get Transfer List

Use getAll method to retrieve a list of transfers by passing the GetTransferParameters. If no parameters are passed, last 10 transfers will be returned.

GetTransferParameters

ParameterData typeDescriptionExample
limitIntOptional parameter for the maximum number of customer transfers to return.10
merchantRefNumStringOptional parameter for merchant reference number of the customer transfers."2b01127a-4929-4d0e-b9cb-a29a8d1c499c"
offsetIntOptional parameter used to get customer transfers from a specific starting point.10
slipIdStringOptional parameter for payment slip id."123"
val parameters = GetTransferParameters(
limit = 10,
merchantRefNum = "2b01127a-4929-4d0e-b9cb-a29a8d1c499c",
offset = 10,
slipId = "123"
)

try {
val transferList = transferService.getAll(parameters)
Log.d(TAG, transferList.toString())
} catch (exception: Exception) {
Log.d(TAG, exception.toString())
}

Get Single Transfer

Use get method to retrieve a customer transfer by passing its id.

val transferId = "urn:transfer:01HNDA4FJJTN4TK66WK4251SWH"

try {
val transfer = transferService.get(transferId)
Log.d(TAG, transfer.toString())
} catch (exception: Exception) {
Log.d(TAG, exception.toString())
}