Search Overlay

Transfers

asdf

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()
import PaysafeWallet

let transferService = Wallet.instance.transferService

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

Parameter Data type Description Example
amount Int Required parameter for amount of transfer in minor units. 100
currencyCode String Required parameter for currency of the transfer. Format ISO 4217. "USD"
recipient CustomerTransferRecipient Contains transfer recipient information. CustomerTransferRecipient(...)
merchantRefNum String Optional parameter for merchant reference number. "19481996"
fxQuote String FX Quote ID for the transfer in case currency conversion is required. If not passed currency conversion is not performed. 404679be-ccbf-4528-b880-e14cc5041753
transferDetails TransferDetails Required parameter containing transfer reason and description. TransferDetails(...)

CustomerTransferRecipient

Parameter Data type Description Example
customerId String The unique identifier of the recipient. "5435323362"
email String The email address of the recipient. user@example.com

TransferDetails

Parameter Data type Description Example
reason String The actual purpose of the transfer. TransferReason.PEER_TRANSFER / .peerTransfer
description String Optional 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())
}
let transferRequest = Wallet.TransferRequest(amount: 100,
                                             currencyCode: "USD",
                                             recipient: .init(email: "user@example.com"),
                                             merchantRefNum: "2b01127a-4929-4d0e-b9cb-a29a8d1c499c",
                                             fxQuote: "404679be-ccbf-4528-b880-e14cc5041753",
                                             transferDetails: .init(reason: .peerTransfer,
                                                                    description: "Transfer money")

transferService.preview(transferRequest: transferRequest, completion: { result in
    switch result {
    case .success(let transferPreview):
        // Handle transferPreview
    case .failure(let error):
        // Handle error
    }
})

Create Transfer

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

TransferCreate

Parameter Data type Description Example
id String Required parameter for id of the transfer. "urn:transfer:01HNDA4FJJTN4TK66WK4251SWH"
val transferCreate = TransferCreate(id = "urn:transfer:01HNDA4FJJTN4TK66WK4251SWH")

try {
    val transfer = transferService.create(transferCreate)
    Log.d(TAG, transfer.toString())
} catch (exception: Exception) {
    Log.d(TAG, exception.toString())
}
let transferCreate = TransferCreate(id: "urn:transfer:01HNDA4FJJTN4TK66WK4251SWH")

transferService.create(transferCreate: transferCreate, completion: { result in
    switch result {
    case .success(let transfer):
        // Handle transfer
    case .failure(let error):
        // Handle error
    }
})

Confirm Transfer

Use confirm method to confirm the transfer. Pass the id from the Transfer object returned by the create method.

TransferConfirm

Parameter Data type Description Example
id String Required parameter for id of the transfer. "urn:transfer:01HNDA4FJJTN4TK66WK4251SWH"
val transferConfirm = TransferConfirm(id = "urn:transfer:01HNDA4FJJTN4TK66WK4251SWH")

try {
    val transfer = transferService.confirm(transferConfirm)
    Log.d(TAG, transfer.toString())
} catch (exception: Exception) {
    Log.d(TAG, exception.toString())
}
let transferConfirm = TransferConfirm(id: "urn:transfer:01HNDA4FJJTN4TK66WK4251SWH")

transferService.confirm(transferConfirm: transferConfirm, completion: { result in
    switch result {
    case .success(let transfer):
        // Handle transfer
    case .failure(let error):
        // Handle error
    }
})

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

Parameter Data type Description Example
limit Int Optional parameter for the maximum number of customer transfers to return. 10
merchantRefNum String Optional parameter for merchant reference number of the customer transfers. "2b01127a-4929-4d0e-b9cb-a29a8d1c499c"
offset Int Optional parameter used to get customer transfers from a specific starting point. 10
slipId String Optional 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())
}
let parameters = Wallet.GetTransferParameters(limit: 10, 
                                              merchantRefNum: "2b01127a-4929-4d0e-b9cb-a29a8d1c499c",
                                              offset: 10,
                                              slipID: "123")

transferService.getAll(getTransferParameters: parameters, completion: { result in
    switch result {
    case .success(let transferList):
        // Handle transferList
    case .failure(let error):
        // Handle error
    }
})

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())
}
let transferId = "urn:transfer:01HNDA4FJJTN4TK66WK4251SWH"

transferService.get(id: transferId, completion: { result in
    switch result {
    case .success(let transfer):
        // Handle transfer
    case .failure(let error):
        // Handle error
    }
})
On this Page