Formatting Currency (Money)

  • Updated
  • Overview

    Zingtree provides a simple Webhook for taking numeric input, and converting it to a nicely formatted currency value. Like in these examples:

    • 1234567 -> $1,234,567
    • 123456 -> $123,456
    • 123.00 -> $123
    • 123.45 -> $123.45


    Setup

    In this example, we'll assume your tree has a variable named amount, and you want to convert it to a variable called dollars that displays nicely.

    First of all, create a webhook to call the currency converter.

    1. Go to Account Settings, My Apps
    2. Click on Add Webhook
    3. Give the webhook a name, and enter this into the URL:
      https://webhooks.zingtree.com/zingtree/v1/make_currency
      It will look like this:
    4. Add the Webhook.


    Next, go into your tree, and add the webhook to a node after the amount variable has been set.

    1. Edit the node, and click Apps/Webhooks
    2. Pick the new Webhook you created from the list. Ours is called "Currency Formatter".
    3. Add these parameters to the message data:

      &value=#amount#&return=dollars
      It looks like this:
    4. Now insert #dollars# into the content area to display the result.


    Parameter Reference

    In the Message Data, you can include these parameters:2022-04-28_14-35-43.png

    • value= (the numeric value to convert)
    • return= (the variable that gets the formatted currency)
    • currency= (The currency, i.e. USD, EUR, etc.) USD is the default.
    • locale= (How to format the number returned by region.) Default is USA (en_US). German would be de_DE, etc.

  • Overview

    Zingtree provides a simple Webhook for taking numeric input, and converting it to a nicely formatted currency value. Like in these examples:

    • 1234567 -> $1,234,567
    • 123456 -> $123,456
    • 123.00 -> $123
    • 123.45 -> $123.45


    Setup

    In this example, we'll assume your tree has a variable named amount, and you want to convert it to a variable called dollars that displays nicely.

    First of all, create a webhook to call the currency converter.

    1. Go to Account, My Apps
    2. Click on Add Webhook
    3. Give the webhook a name, and enter this into the URL:
      https://webhooks.zingtree.com/zingtree/v1/make_currency
      It will look like this:
    4. Save the Webhook.


    Next, go into your tree, and add the webhook to a node after the amount variable has been set.

    1. Edit the node, and click Apps/Webhooks
    2. Pick the new Webhook you created from the list. Ours is called "Currency Formatter".
    3. Add these parameters to the message data:

      &value=#amount#&return=dollars
      It looks like this:
    4. Now insert #dollars# into the content area to display the result.

     

    Try this Demo Gallery tree to see how it works and examine how it's built.


    Parameter Reference

    In the Message Data, you can include these parameters:

    • value= (the numeric value to convert)
    • return= (the variable that gets the formatted currency)
    • currency= (The currency, i.e. USD, EUR, etc.) USD is the default.
    • locale= (How to format the number returned by region.) Default is USA (en_US). German would be de_DE, etc.
  • Throughout 2022 Zingtree will be upgrading customers to our new faster and more modern user experience! Here's how to tell which experience your Zingtree Authors are currently using.

    Log in to your Zingtree Author account and navigate to My Trees. How does your current My Trees page look?

    Zingtree Classic

    2022-02-25_12-24-51.png

    New User Experience

    mceclip0.png

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request