Jump to content

Render Money $ instead of tokens


phseven

Recommended Posts

We know that the processor api and system on the script is token based but  I think there is the possibility to have tokens on the back ground but render dollars to users.

Like this 

$1 dollar is 100 cents  so each token will be 1 cents

100 tokens = $1 dollar this way calculation will be easier.

Is there a easy way to implement this?

 

 

Link to comment
Share on other sites

Yes, anywhere where you display tokens you have to do a template conversion like this:

for example $data.tokens_required variable contains 123 number
you need to divide it to 100, then format to a decimal form with 2 decimals, and finally add a dollar sign before it

{{assign var="tokens_required_in_usd" value=$data.tokens_required/100|number_format:2:".":""}}
{{assign var="tokens_required_in_usd" value="\$`$tokens_required_in_usd`"}}

now $tokens_required_in_usd variable should contain $1.23

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...