dashed-slug.net › Forums › General discussion › examples of withdraw php-api › Reply To: examples of withdraw php-api
Hello,
Do not attempt to edit the plugin code. To see why, check the FAQ under “I want to do changes to the plugin’s code.” If you wanted to provide alternative knockout templates, you’d use the wallets_views_dir
filter to specify another directory on your server where you could copy and modify all the knockout views. However, there is no need to do all this in your case:
Instead, design your own HTML form in any way you like. Then, make it so that when it is submitted, you use JavaScript to call the JSON API yourself. The JSON API is documented in the accompanying PDF documentation, under APIs -> Wallets JSON API -> Withdraw funds to an external address. To see how the plugin does the calls: https://github.com/dashed-slug/wallets/blob/4.2.0/assets/scripts/wallets-ko.js#L717-L753
Just make sure to pass the correct fields to the call, and you will get a JSON response indicating success/failure. For the _wpnonce
field, just pass the value of wp.wallets.viewModels.wallets.nonces()['do_withdraw']
Please let me know if you need any help with any of this.
with regards