{
    "componentChunkName": "component---src-templates-article-page-template-js",
    "path": "/ftw/how-to-set-up-currency-in-ftw/",
    "result": {"data":{"markdownRemark":{"frontmatter":{"title":"How to set up currency in FTW","slug":"how-to-set-up-currency-in-ftw","updated":"2019-07-17T00:00:00.000Z","category":"ftw-configuration","ingress":"Flex Template for Web (FTW) uses USD as the default currency. This guide will help you to change currency and edit other configurations related to it.","skills":null},"htmlAst":{"type":"root","children":[{"type":"element","tagName":"h2","properties":{"id":"1-change-the-currency","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#1-change-the-currency","ariaLabel":"1 change the currency permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"1. Change the currency"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"At the moment FTW uses Stripe as the only payment provider so before\nchanging the currency, make sure it's supported in Stripe. See the\nStripe documentation for\n"},{"type":"element","tagName":"a","properties":{"href":"https://stripe.com/docs/currencies","target":"_blank","rel":["noopener","noreferrer"]},"children":[{"type":"text","value":"supported currencies"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Environment variable "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"REACT_APP_SHARETRIBE_MARKETPLACE_CURRENCY"}]},{"type":"text","value":" is used\nfor the currency. For local development you can add the variable in the\nGitignored "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":".env"}]},{"type":"text","value":" file in the project root:"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"bash"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-bash"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","assign-left","variable"]},"children":[{"type":"text","value":"REACT_APP_SHARETRIBE_MARKETPLACE_CURRENCY"}]},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"="}]},{"type":"text","value":"your-currency"}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"You can also change the configuration with the command line tool by\nrunning"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"bash"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-bash"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","function"]},"children":[{"type":"text","value":"yarn"}]},{"type":"text","value":" run config"}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Remember to restart the application after editing the environment\nvariable!"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Note:"}]},{"type":"text","value":" If you already created listings before changing the currency,\nlistings using old currency will not show the price when a new currency\nis in use. Currently, FTW doesn't support changing the currency of the\nlisting so the price cannot be edited after the currency used in the\napplication is changed."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"2-edit-listing-minimum-price","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#2-edit-listing-minimum-price","ariaLabel":"2 edit listing minimum price permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"2. Edit listing minimum price"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"In the "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"config.js"}]},{"type":"text","value":" file, search for variable\n"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"listingMinimumPriceSubUnits"}]},{"type":"text","value":" and give a minimum price in currency's\nsubunits (e.g. cents). By default, FTW uses value 0 which means there is\nno restriction to the price but we recommend that the listing minimum\nprice should be at least the same amount as\n"},{"type":"element","tagName":"a","properties":{"href":"https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts","target":"_blank","rel":["noopener","noreferrer"]},"children":[{"type":"text","value":"Stripe fee"}]},{"type":"text","value":"\nin the country you are operating. If the listing price is lower, Stripe\nwill not process the payment and the booking fails."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"3-check-the-currency-configjs-file","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#3-check-the-currency-configjs-file","ariaLabel":"3 check the currency configjs file permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"3. Check the currency-config.js file"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"See the\n"},{"type":"element","tagName":"a","properties":{"href":"https://github.com/sharetribe/ftw-daily/blob/master/src/currency-config.js","target":"_blank","rel":["noopener","noreferrer"]},"children":[{"type":"text","value":"currency-config.js"}]},{"type":"text","value":"\nfile and make sure the currency is added to the "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"subUnitDivisors"}]},{"type":"text","value":" array.\nMost common currencies are already added to the file. If the currency is\n"},{"type":"element","tagName":"a","properties":{"href":"https://stripe.com/docs/currencies#zero-decimal","target":"_blank","rel":["noopener","noreferrer"]},"children":[{"type":"text","value":"zero-decimal currency"}]},{"type":"text","value":"\n(e.g. JPY) use value 1. Otherwise, the value is usually 100."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"extrainfo","properties":{"title":"FTW-product has moved config files into a different location"},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"shell"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-shell"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-shell"]},"children":[{"type":"text","value":"└── src\n    └── config\n        ├── config.js\n        └── currency-config.js"}]}]}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"why-subunits","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#why-subunits","ariaLabel":"why subunits permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Why subunits?"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"All API requests to Stripe expects amounts to be provided in a\ncurrency’s smallest unit. It's also better to calculate using integers\nthan floats to avoid rounding errors."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"4-optional-format-values","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#4-optional-format-values","ariaLabel":"4 optional format values permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"4. Optional: Format values"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Formatting money is done by using\n"},{"type":"element","tagName":"a","properties":{"href":"https://github.com/yahoo/react-intl","target":"_blank","rel":["noopener","noreferrer"]},"children":[{"type":"text","value":"React Intl"}]},{"type":"text","value":". Component\n"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"FieldCurrencyInput"}]},{"type":"text","value":" converts user input to a formatted message and adds\nthe Money object to price attribute of a listing. "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"currency-config.js"}]},{"type":"text","value":"\nfile affects how prices are formatted by determining how the subunits\nare converted to the actual unit (e.g. from cents to USD)."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"5-optional-calculate-the-price-in-client-app-side","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#5-optional-calculate-the-price-in-client-app-side","ariaLabel":"5 optional calculate the price in client app side permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"5. Optional: Calculate the price in client app side"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"If you need to calculate the price on client app side use\n"},{"type":"element","tagName":"a","properties":{"href":"https://github.com/MikeMcl/decimal.js/","target":"_blank","rel":["noopener","noreferrer"]},"children":[{"type":"text","value":"Decimal.js"}]},{"type":"text","value":" library. Currently,\nthere are two places in FTW where prices are calculated:"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"a","properties":{"href":"https://github.com/sharetribe/ftw-daily/blob/master/server/api-util/lineItemHelpers.js","target":"_blank","rel":["noopener","noreferrer"]},"children":[{"type":"text","value":"server/api-util/lineItemHelpers.js"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"a","properties":{"href":"https://github.com/sharetribe/flex-template-web/blob/master/src/forms/BookingDatesForm/EstimatedBreakdownMaybe.js","target":"_blank","rel":["noopener","noreferrer"]},"children":[{"type":"text","value":"EstimatedBreakdownMaybe.js"}]},{"type":"text","value":"\n(which is refactored as\n"},{"type":"element","tagName":"a","properties":{"href":"https://github.com/sharetribe/flex-template-web/blob/master/src/components/OrderPanel/EstimatedCustomerBreakdownMaybe.js","target":"_blank","rel":["noopener","noreferrer"]},"children":[{"type":"text","value":"EstimatedCustomerBreakdownMaybe.js"}]},{"type":"text","value":"\non FTW-product)"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"your-saunatime-test-listings","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#your-saunatime-test-listings","ariaLabel":"your saunatime test listings permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Your Saunatime test listings"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"If you just started, you likely have a few test Saunatime listings in\nyour Console. These listings use EUR as their currency. Configuring a\ncurrency different than EUR will result in an error as the FTW cannot\nconvert the currency of existing listings. You can ignore this error by\nclosing these listings in your Console, which will remove them from the\nsearch page as well, and creating new listings."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"ftw-and-multiple-currencies","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#ftw-and-multiple-currencies","ariaLabel":"ftw and multiple currencies permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"FTW and multiple currencies"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"You can have multiple currencies inside a single marketplace, since Flex\nitself is currency agnostic. There are, however, some caveats that you\nneed to take into account. The default FTW template implementation\nlimits currency to a single currency because of the caveats listed\nbelow. This just made things simpler to develop. You can of course\nchange currency handling in your marketplace if you take these caveats\ninto account."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"First, a single listing can have only a single price. If you wish to\noffer the same listing in two different currencies, you need to create\ntwo listings with the same content but different currency and price,\nwhich means storing the secondary currency price in e.g. public data."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Second, filtering by price becomes problematic. The price filtering is\nbased on the amount only and does not take the currency into account.\nThis can lead into problems if you want to compare prices. You might,\nfor example, have dollars and yens in the same marketplace. One USD is\n110 Yen, so the default price filtering will not easily find equally\npriced items if they are in different currencies."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Third, currency conversions may cause complexity. If most of your users\nhave a credit card in one currency but listings are in a different\ncurrency, some conversion costs will take effect."}]}],"data":{"quirksMode":false}},"headings":[{"value":"1. Change the currency","depth":2},{"value":"2. Edit listing minimum price","depth":2},{"value":"3. Check the currency-config.js file","depth":2},{"value":"Why subunits?","depth":3},{"value":"4. Optional: Format values","depth":2},{"value":"5. Optional: Calculate the price in client app side","depth":2},{"value":"Your Saunatime test listings","depth":2},{"value":"FTW and multiple currencies","depth":2}]}},"pageContext":{"slug":"how-to-set-up-currency-in-ftw","category":"ftw-configuration"}},
    "staticQueryHashes": ["3794076007","439097193","717698143"]}