Closed LanceJenkinZA closed 3 years ago
Hello @LanceJenkinZA ,
SDK provides functionality in retrieve($currency, $onBehalfOf = null)
under BalancesEntryPoint
, also please see in the API schema:
or filter if target currency is in the list of balances.
Thanks @gergelykovacs, but the retrieve
method has side effects which I don't want - that is, it will create a new balance if the balance is not already associated with the account.
I'm working with SPARK accounts if that helps.
With reference to the direct-demo platform;
retrieve("DKK)
Danish Krone will show up in this list.My XY Problem is I would like to know if the user already has the currency associated with their account before I associate the currency with their account.
That way I can show the message "You already have a $currencyCode account".
@LanceJenkinZA , you can use the BalancesEntryPoint::find
(api: /balances/find
) to see balances per currency and filter the list to the currency you are interested in (https://www.php.net/array_filter), also you can use the on-behalf-of option to perform the same search for sub-accounts. If the list does not contain the currency you are interested in you can act accordingly. Filtering an array in your code equal to what you would get with providing a specific currency code to the SDK method. SDK method and API does not provide it.
Thanks @gergelykovacs.
I see I miss-read the documentation. When testing with Postman the query did work:
But I see that filtering by currency is not documented.
Hi @LanceJenkinZA , I close this issue, further related documentation can be found here:
Good day,
Currently, there is no way to specify the currency when using the
BalancesEntryPoint::find
method:The use case is to check if a user already has a specific currency set up on their account before attempting to create the currency.
For example
Thanks