Materializing a request for funds, a collection, this object contains a collection link as well as a QRCode that can be scanned using a smartphone's camera. Once created, you can access the encashment link via the securePay.link
field, and you can access the url pointing to the QRCode image via the securePay.qrCode.src
field.
You can control the message displayed to the user by submitting a value for the h1
field when creating the FundRequest
object. If you add 2 languages, the user will be able to change language and see the message inviting him to pay in his native language.
Once you've sent this link to your user, or presented them with the QRCode, they'll be taken to a page inviting them to pay, as shown in the following figure:
cancel
Cancel and then Returns an object FundRequest
found by an identifier
.
You can use a unique ID specific to your system. To use your own ID instead of the one generated by FPay, you need to specify the foreignId
field when creating the object. This will enable you to retrieve the object via the foreignId
field, which must be unique for all FundRequest
objects.
Here are all the fields whose values can be used as identifiers for this operation:
id
foreignId
FundRequest
object that has already been cancelled, either successfully or unsuccessfully.const fundRequestPromise = fPay.fundRequest.cancel("identifier");
create
Create a new FundRequest
object and return the newly created object.
This operation takes the following parameters as input:
CreateFundRequestForm
amount
AmountForm
currency
string
value
string
description
string | undefined
destination
DestinationForm | undefined
DestinationForm.MultipleDestinationForm
MultipleDestinationForm
DestinationForm.SingleDestinationForm
SingleDestinationForm
account
MoneyAccountForm
country
string
identifier
string
id
identifierproviderKey
string
expire
string | undefined
<after><space><$number><$timeUnit>
<on><space><$iso8601Datetime>
never
FundRequest
object, the value never
is the default value if none specified.QuasiTransfer
object, the value 24h
is the default value if none specified."after 15m"
"after 90s"
"after 1h"
"after 2d"
"after 1w"
"on 2028-05-19T01:13Z"
"on 2028-05-19"
"on 15:30"
fees
FeesForm | undefined
payer
string
foreignData
string | undefined
foreignId
string | undefined
h1
H1DescriptorForm | undefined
en
string | undefined
fr
string | undefined
onFailure
OnFundRequestCompletedForm | undefined
redirectUserTo
string | undefined
onSuccess
OnFundRequestCompletedForm | undefined
redirectUserTo
string | undefined
Here's an example of code for creating a FundRequest
object:
const fundRequestPromise =
fPay.fundRequest.create({
amount: {
currency: "XOF",
value: "10_000"
},
description: "My description",
destination: {
_type: "Single",
account: {
country: "CI",
identifier: "123456789",
providerKey: "FPay"
}
},
expire: "after 12h",
fees: {
payer: "CounterPart"
},
foreignData: "{\"myKey\": 19, \"myOtherKey\": \"myOtherValue\"}",
foreignId: "123456789",
h1: {
en: "Payment description",
fr: "Description du paiement"
},
onFailure: {
redirectUserTo: "https://you-server.com/ui/failure"
},
onSuccess: {
redirectUserTo: "https://you-server.com/ui/success"
}
});
get
Returns an object FundRequest
found by an identifier
.
You can use a unique ID specific to your system. To use your own ID instead of the one generated by FPay, you need to specify the foreignId
field when creating the object. This will enable you to retrieve the object via the foreignId
field, which must be unique for all FundRequest
objects. Here are all the fields whose values can be used as identifiers for this operation:
id
foreignId
const fundRequestPromise = fPay.fundRequest.get("identifier");
list
Returns a collection of FundRequest
objects, possibly filtered and/or sorted. Here are the parameters supported by this operation.
NAME | TYPE | DESCRIPTION | DEFAULT VALUE |
---|---|---|---|
filter | string | undefined | Condition to be met by any object returned in this collection |
|
sortBy | string | undefined | Specify the field and the order (ascending or descending) by which returned objects will be sorted |
|
limit | number | undefined | Total number of results to return in this collection |
|
Here are a few examples of code to execute a listing to return a collection of FundRequest
objects:
const fundRequestsCollectionPromise = fPay.fundRequest.listAll();
const fundRequestsCollectionPromise =
fPay.fundRequest.list({
sortBy: "id:ASC"
});
const fundRequestsCollectionPromise =
fPay.fundRequest.list({
limit: 5
});
const fundRequestsCollectionPromise =
fPay.fundRequest.list({
filter: "id in {'31234', '5678', '9990'}"
});
const fundRequestsCollectionPromise =
fPay.fundRequest.list({
filter: "createdTime isBefore Yesterday",
sortBy: "foreignId:DESC"
});
const fundRequestsCollectionPromise =
fPay.fundRequest.list({
filter: "id startsWith abcd",
sortBy: "createdTime:ASC",
limit: 25
});
fetchPage
When you fetch a list of FundRequest
, the results returned by the server can be paginated, i.e. they will be arranged on several pages. This fetchPage
function allows you to navigate from page to page, iterating over all the elements. Consequently, this function returns a collection of FundRequest
.
Let's say you've retrieved a collection of FundRequest
with the following code:
const fundRequestsCollectionPromise = fPay.fundRequest.listAll();
If the result is spread over several pages, to go to the next page, you should do:
fundRequestsCollectionPromise.then(fundRequestCollection => {
if(fundRequestCollection.hasNextPage()) {
const nextFundRequestPromise = fPay.fundRequest.fetchPage(fundRequestCollection.pagination.nextPage);
}
});
send
Sends funds to a fund request identified by an identifier
and returns an Attempt
symbolizing an attempt to send.
Here are all the fields whose values can be used as identifiers for this operation:
id
foreignId
SendFundRequestForm
id
string
source
SourceForm
SourceForm.MultipleSourceForm
MultipleSourceForm
SourceForm.SingleSourceForm
SingleSourceForm
account
MoneyAccountForm
country
string
identifier
string
providerKey
string
Here's an example of code for send money in response to a FundRequest
object:
const attemptPromise =
fPay.fundRequest.send({
id: "123456789",
source: {
_type: "Single",
account: {
country: "CI",
identifier: "+2250500000000",
providerKey: "MtnMoney"
}
}
});
update
Modify a FundRequest
object and return the modified version.
Here are all the fields whose values can be used as identifiers for this operation:
id
foreignId
FundRequest
objects:NAME | TYPE | DESCRIPTION |
---|---|---|
description | string | undefined | Can be updated Can be Deleted |
foreignData | string | undefined | Can be updated Can be Deleted |
Here are a few examples of code to execute an update:
fundRequestPromise =
fPay.fundRequest.update({
id: "<id | foreignId>",
change: {
description: "<new value>",
foreignData: "<new value>"
}
});
fundRequestPromise =
fPay.fundRequest.update({
id: "<id | foreignId>",
change: {
description: "<new value>"
},
'remove': ['foreignData']
});
fundRequestPromise =
fPay.fundRequest.update({
id: "<id | foreignId>",
'remove': ['description', 'foreignData']
});
When you retrieve a list, here are the fields you can use for filtering and sorting. as well as sorting.
NAME | TYPE | DESCRIPTION |
---|---|---|
amount.currency.code | string | |
amount.value | number | |
completedTime | string | |
completedTime.iso8601 | string | |
completedTime.timestamp.milliseconds | number | |
completedTime.timestamp.seconds | number | |
createdTime | string | |
createdTime.iso8601 | string | |
createdTime.timestamp.milliseconds | number | |
createdTime.timestamp.seconds | number | |
creator | string | |
creator._type | string | |
creator.accountId | string | |
creator.authAccessId | string | |
creator.personId | string | |
description | string | |
destination | string | |
destination._type | string | |
destination.account.balanceType | string | |
destination.account.identifier._type | string | |
destination.account.identifier.value | string | |
destination.account.provider.country.iso3166.alpha2 | string | |
destination.account.provider.country.iso3166.alpha3 | string | |
destination.account.provider.country.name | string | |
destination.account.provider.key | string | |
destination.account.provider.name | string | |
destination.amount.currency.code | string | |
destination.amount.value | number | |
expire.delay | string | |
expire.time | string | |
expire.time.iso8601 | string | |
expire.time.timestamp.milliseconds | number | |
expire.time.timestamp.seconds | number | |
fees.amount.currency.code | string | |
fees.amount.value | number | |
fees.payer | string | |
fees.value.fixe | number | |
fees.value.percent | number | |
foreignId | string | |
h1Descriptor.en | string | |
h1Descriptor.fr | string | |
id | string | |
onFailure.redirectUserTo | string | |
onSuccess.redirectUserTo | string | |
securePay.link | string | |
securePay.purpose.label | string | |
securePay.qrCode.src | string | |
sending | string | |
source | string | |
source._type | string | |
source.account.balanceType | string | |
source.account.identifier._type | string | |
source.account.identifier.value | string | |
source.account.provider.country.iso3166.alpha2 | string | |
source.account.provider.country.iso3166.alpha3 | string | |
source.account.provider.country.name | string | |
source.account.provider.key | string | |
source.account.provider.name | string | |
source.amount.currency.code | string | |
source.amount.value | number | |
status | string | |
status._type | string | |
status.cancelled.afterTimeout | boolean | |
status.reason.en | string | |
status.reason.fr | string |
Code examples are available on the Audit & Dashboard page
FundRequest
amount
Amount | undefined
currency
AmountCurrency
code
string
unit
string
value
number
completedTime
UTCDateTime | undefined
iso8601
string
timestamp
Timestamp
milliseconds
number
seconds
Double
createdTime
UTCDateTime
iso8601
string
timestamp
Timestamp
milliseconds
number
seconds
Double
creator
Creator
Creator.Api
Api
_type
string
accountId
string
authAccessId
string
Creator.Ui
Ui
_type
string
accountId
string
personId
string
description
string | undefined
destination
Destination
Destination.Multiple
Multiple
_type
string
Destination.Single
Single
_type
string
account
MoneyAccount
balanceType
string
identifier
MoneyAccountIdentifier
_type
string
value
string
provider
MoneyAccountProvider
country
Country
iso3166
Iso3166Country
alpha2
string
alpha3
string
name
string
key
string
name
string
amount
Amount
currency
AmountCurrency
code
string
unit
string
value
number
expire
Expire | undefined
delay
Duration
iso8601
string
milliseconds
Double
seconds
Double
time
UTCDateTime
iso8601
string
timestamp
Timestamp
milliseconds
number
seconds
Double
fees
Fees
amount
Amount
currency
AmountCurrency
code
string
unit
string
value
number
payer
string | undefined
value
FeesValue
fixe
number
percent
number
foreignData
string | undefined
foreignId
string | undefined
h1Descriptor
H1Descriptor | undefined
en
string | undefined
fr
string | undefined
id
string
onFailure
OnFundRequestCompleted | undefined
redirectUserTo
string | undefined
onSuccess
OnFundRequestCompleted | undefined
redirectUserTo
string | undefined
securePay
SecurePay
link
string
purpose
SecurePayPurpose
SecurePayPurpose.Purchase
Purchase
_type
string
label
string
SecurePayPurpose.Receive
Receive
_type
string
SecurePayPurpose.Send
Send
_type
string
qrCode
QrCode
src
string
sending
string
source
Source | undefined
Source.Multiple
Multiple
_type
string
Source.Single
Single
_type
string
account
MoneyAccount
balanceType
string
identifier
MoneyAccountIdentifier
_type
string
value
string
provider
MoneyAccountProvider
country
Country
iso3166
Iso3166Country
alpha2
string
alpha3
string
name
string
key
string
name
string
amount
Amount
currency
AmountCurrency
code
string
unit
string
value
number
status
FundRequestStatus
FundRequestStatus.Failure
Failure
_type
string
cancelled
Cancelled | undefined
afterTimeout
boolean
reason
LocalizedText
en
string
fr
string
FundRequestStatus.Processing
Processing
_type
string
reason
LocalizedText
en
string
fr
string
FundRequestStatus.Started
Started
_type
string
FundRequestStatus.Starting
Starting
_type
string
FundRequestStatus.Successful
Successful
_type
string
FundRequestStatus.WaitingToStart
WaitingToStart
_type
string
url
string