Fields
Currency Field
The Currency Field allows for capturing a monetary value in a specific currency.
The supported currency codes are based on the ISO 4217 standard.
Basic usage
Adds a currency
field to the fields of an action.
Result
Parameters
See fields for common field parameters like validation and conditional rendering.
params
Show child attributes
currency
The specific currency to be used.
For example, can be set to 'USD'
or 'EUR'
or any ISO 4217 currency code.
If unset, the user will be able to select the currency from a list of all available currencies after considering the whitelist and blacklist.
currency_whitelist
Limits the available currencies to the ones in the list.
For example, can be set to ['USD', 'EUR']
to only allow US Dollars and Euros.
currency_blacklist
Excludes the currencies in the list from the available currencies.
For example, can be set to ['AUD', 'GBP']
to exclude Australian Dollars and British Pounds.
Result Data
The data that will be added into stub.data
will be as follows:
string
donation_amount This will be the field name as defined in the field definition. The result is the value as input into the field as string.
string
donation_amount_details This is an object that contains meta data about the currency as selected in the field.
Consists of the field name with _details
appended to the end of it:
eg. field name is donation_amount
so this object will be donation_amount_details
.
Show child attributes
string
currencycode Gives the currency code of the selected currency, eg. USD, ZAR
string
currencysymbol Gives the currency symbol of the selected currency, eg. $, R
integer
cents Gives the value of the fields input in cents as integer, eg. $ 15 = 1500
integer
amount Gives the value of the fields input as integer, eg. 15