Contents
On this page

Simulate Card Tap - Plugixa POS for WooCommerce

POST /plugixa-pos/v1/stripe-terminal/payments/{intent}/simulate

With test keys, tap a test card on the simulated reader, approved or declined. The answer is the payment status.

Needs a user with the plugixa_pos_sell 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. The user must also be allowed to use the register (register access).

Request

POST https://your-site.example/wp-json/plugixa-pos/v1/stripe-terminal/payments/pi_3UdVCnPfpjsL7fG11ZgTLneO/simulate

Path parameters

Name Type Description
intent string The Stripe PaymentIntent id, pi_...

Request body

Content type: application/json

Field Type Required Description
register_id integer Yes The register.
decline boolean No Use a card that is declined.
{
  "register_id": 1,
  "decline": false
}

Responses

200 OK. data is the status, as in Get Card Payment Status.

Errors

Status Code When
403 plugixa_pos_forbidden The user may not use this register (this route answers with this code rather than plugixa_pos_register_forbidden).
409 plugixa_pos_stripe_test_only A live key.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-pos/v1/stripe-terminal/payments/pi_3UdVCnPfpjsL7fG11ZgTLneO/simulate" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"register_id":1,"decline":false}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/stripe-terminal/payments/pi_3UdVCnPfpjsL7fG11ZgTLneO/simulate');
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([
        'register_id' => 1,
        'decline'     => false,
    ]),
]);
$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/payments/pi_3UdVCnPfpjsL7fG11ZgTLneO/simulate', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ register_id: 1, decline: false }),
});
const { data } = await response.json();

Quick Links

Share