Contents
On this page
Adjust Coins - Plugixa Stream
POST /plugixa-stream/v1/admin/viewers/{id}/coins
Give coins to an account or take them away, with a reason that shows in their coin history.
Needs a user with the plugixa_stream_manage_settings capability (signed in with an Application Password or the login cookie). Administrators hold it; other roles only when you grant it.
Request
POST https://your-site.example/wp-json/plugixa-stream/v1/admin/viewers/7/coins
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The user id |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
coins |
integer |
Yes | Positive to grant, negative to remove. Not 0. |
kind |
string |
No | bonus (the default) or paid. |
note |
string |
Yes | The reason, shown to the viewer. |
Removing never takes the balance below zero.
{
"coins": 100,
"kind": "bonus",
"note": "Sorry for the outage on Sunday"
}
Responses
200 OK.
{
"success": true,
"data": {
"balance": {
"paid": 300,
"bonus": 145,
"total": 445
}
}
}
| Field | Type | Meaning |
|---|---|---|
data.balance.paid |
integer |
Coins bought |
data.balance.bonus |
integer |
Coins given: check-in rewards, pack bonuses, grants |
data.balance.total |
integer |
Both |
Errors
| Status | Code | When |
|---|---|---|
401 / 403 |
plugixa_stream_forbidden |
The caller lacks the capability. |
422 |
plugixa_stream_invalid |
coins is 0, the user does not exist, or note is empty. |
500 |
plugixa_stream_wallet |
The wallet could not be updated. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-stream/v1/admin/viewers/7/coins" \
-u "$WP_USER:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"coins":100,"kind":"bonus","note":"Sorry for the outage on Sunday"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-stream/v1/admin/viewers/7/coins');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'coins' => 100,
'kind' => 'bonus',
'note' => 'Sorry for the outage on Sunday',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-stream/v1/admin/viewers/7/coins', {
method: 'POST',
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ coins: 100, kind: 'bonus', note: 'Sorry for the outage on Sunday' }),
});
const { data } = await response.json();
Quick Links
Share