Update a Currency

Last updated 7 months ago

put
Update a Currency by ID

https://api.moltin.com
/v2/currencies/:id
Request
Response
Path Parameters
id
required
string
The ID for the requested Currency
Headers
Authorization
required
string
The Bearer token to grant access to the API
Body Parameters
type
required
string
The type represents the object being returned. Always currency
code
optional
string
The currency code. Example: YEN
enabled
optional
boolean
Is this currency available for products? true or false
default
optional
boolean
Is this the default currency? true or false
decimal_places
optional
integer
How many decimal places the currency is formatted to
thousand_separator
optional
string
The thousand separator character. Example: ,
decimal_point
optional
string
The decimal point character. Example: .
format
optional
string
Specify how the price currency is displayed. Example: "¥{price}"
exchange_rate
optional
string
The exchange rate from the default currency
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"
}
}
}
}
cURL
JavaScript SDK
curl -X PUT https://api.moltin.com/v2/currencies/:id \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": {
"type": "currency",
"exchange_rate": 1.5
}
}'
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X',
client_secret: 'X'
})
const id = 'XXXX'
const currency = {
exchange_rate: 1.5
}
Moltin.Currencies.Update(id, currency).then(currency => {
// Do something
})