• PXM Price Books/
    Currencies/
    Currencies API/
    Update a Currency

    Update a Currency

    PUT Update a Currency by ID

    https://api.moltin.com/v2/currencies/:id
    

    Parameters

    Path parameters

    NameRequiredTypeDescription
    idRequiredstringThe ID for the requested Currency.

    Headers

    NameRequiredTypeDescription
    AuthorizationRequiredstringThe Bearer token required to get access to the API.

    Body

    NameRequiredTypeDescription
    typeRequiredstringRepresents the object being returned. Always currency.
    codeOptionalstringSpecifies the currency code. Example: YEN.
    enabledOptionalbooleanSpecifies if this currency is available for products. Either true or false
    defaultOptionalbooleanSpecifies whether this is the default currency or not. Either true or false
    decimal_placesOptionalintegerIndicates how many decimal places the currency is formatted to.
    thousand_separatorOptionalstringIndicates the thousand separator character. Example: ,
    decimal_pointOptionalstringIndicates the decimal point character. Example: .
    formatOptionalstringSpecifies how the price currency is displayed. Example: "¥{price}".
    exchange_rateOptionalnumberSpecifies the exchange rate from the default currency.

    Request Examples

    When an organization creates a new currency or if there is a mismatch between the store currencies and organization currencies, pass an empty request body on a store-level currency to invalidate the cache. This will ensure that the store currencies are updated with the new organization currency.

    Curl

    curl -X PUT https://api.moltin.com/v2/currencies/:id \
         -H "Authorization: Bearer XXXX" \
         -H "Content-Type: application/json" \
         -d $'{
           "data": {
             "default": true
           }
         }'
    

    JavaScript SDK

    const currencyId = "25617d3e-14a6-434c-bfab-3fda87517aaf";
    const currency = {
        exchange_rate: 1.5,
    };
    
    
    // Where `EPCC` is an authenticated client
    await EPCC.Currencies.Update(currencyId, currency);
    

    Response Example

    200 OK

    {
      "data": {
        "id": "190c3e9e-8006-4231-8c29-833fb4f6bff0",
        "type": "currency",
        "code": "YEN",
        "exchange_rate": 1.5,
        "format": "¥{price}",
        "decimal_point": ",",
        "thousand_separator": ".",
        "decimal_places": 2,
        "default": false,
        "enabled": true,
        "links": {
          "self":
            "https://api.moltin.com/currencies/190c3e9e-8006-4231-8c29-833fb4f6bff0"
        },
        "meta": {
          "timestamps": {
            "created_at": "2018-05-02T09:01:56.303640168Z",
            "updated_at": "2018-05-02T09:01:56.303641068Z"
          }
        }
      }
    }
    

    Was this helpful?

    Previous
    Create a Currency