Contents
On this page
Save Stripe Keys - Plugixa POS for WooCommerce
POST /plugixa-pos/v1/stripe-terminal/keys
Save the keys. A new secret key is tested against Stripe first and stored encrypted; changing account clears the location and reader links.
Needs a user with the plugixa_pos_manage_settings capability (signed in with an Application Password, or the login cookie with an X-WP-Nonce header). Administrators hold it; other roles only when you grant it.
Request
POST https://your-site.example/wp-json/plugixa-pos/v1/stripe-terminal/keys
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
secret_key |
string |
No | sk_test_..., sk_live_... or a restricted rk_ key. Empty keeps the saved one. |
webhook_secret |
string |
No | whsec_.... Empty keeps the saved one. |
{
"secret_key": "sk_test_51ExampleKeyDoNotUse0000000000",
"webhook_secret": "whsec_ExampleSecret000000000000"
}
Responses
200 OK. data is the setup, as in Get Stripe Terminal Setup.
Errors
| Status | Code | When |
|---|---|---|
422 |
plugixa_pos_stripe_key |
Not a Stripe secret key, or Stripe refused it. |
422 |
plugixa_pos_stripe_webhook |
Not a webhook signing secret. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-pos/v1/stripe-terminal/keys" \
-u "$WP_USER:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"secret_key":"sk_test_51ExampleKeyDoNotUse0000000000","webhook_secret":"whsec_ExampleSecret000000000000"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/stripe-terminal/keys');
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([
'secret_key' => 'sk_test_51ExampleKeyDoNotUse0000000000',
'webhook_secret' => 'whsec_ExampleSecret000000000000',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-pos/v1/stripe-terminal/keys', {
method: 'POST',
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ secret_key: 'sk_test_51ExampleKeyDoNotUse0000000000', webhook_secret: 'whsec_ExampleSecret000000000000' }),
});
const { data } = await response.json();
Quick Links
Share