Contents
On this page
Apply Held Rate - Plugixa Multi Currency for WooCommerce
POST /plugixa-multi-currency/v1/pro/rates/{id}/apply
Use a rate from the history: approve a held rate, or go back to an earlier applied one. Other rates still held for that currency are rejected.
Needs a user with the plugixa_multi_currency_manage_settings capability (signed in with an Application Password, or the login cookie with an X-WP-Nonce header). Administrators hold it; see Capabilities.
Note. Pro only: on the free plugin this route answers
404rest_no_route.
Request
POST https://your-store.example/wp-json/plugixa-multi-currency/v1/pro/rates/431/apply
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The history line, from held in Get Rate Alerts or from Rate History |
Request body
Content type: application/json
No body.
Responses
200 OK.
{
"success": true,
"data": {
"currency": "INR",
"rate": "95.4012"
}
}
The currency now uses this rate, with the line’s provider as its source. Going back to an earlier rate adds a new applied line to the history.
Errors
| Status | Code | When |
|---|---|---|
401 / 403 |
rest_forbidden |
The caller lacks the capability: Sorry, you are not allowed to do that. |
404 |
plugixa_multi_currency_rate_not_found |
No applied or held line with that id: This rate is not in the history. Or the currency was removed or is the store currency: This currency is no longer set up. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-store.example/wp-json/plugixa-multi-currency/v1/pro/rates/431/apply" \
-u "$WP_USER:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-store.example/wp-json/plugixa-multi-currency/v1/pro/rates/431/apply');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-store.example/wp-json/plugixa-multi-currency/v1/pro/rates/431/apply', {
method: 'POST',
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
},
});
const { data } = await response.json();
Quick Links
Share