Contents
On this page

Refund Unmatched Card Payment - Plugixa POS for WooCommerce

POST /plugixa-pos/v1/stripe-terminal/unmatched/{intent}/refund

Refund what is left of an unmatched card payment, through Stripe. A payment that pays a sale is refused: refund the sale instead.

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. It also needs plugixa_pos_refund.

Request

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

Path parameters

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

Responses

201 Created.

{
  "success": true,
  "data": {
    "refund_id": "re_3UdVCnPfpjsL7fG11b0WxYzA",
    "amount": "12.50"
  }
}

Errors

Status Code When
409 plugixa_pos_stripe_nothing Nothing left to refund.
409 plugixa_pos_stripe_matched The payment pays a sale.
409 plugixa_pos_stripe_refund Stripe did not make the refund.
502 plugixa_pos_stripe_unreachable Stripe could not be reached.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-pos/v1/stripe-terminal/unmatched/pi_3UdVCnPfpjsL7fG11ZgTLneO/refund" \
  -u "$WP_USER:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/stripe-terminal/unmatched/pi_3UdVCnPfpjsL7fG11ZgTLneO/refund');
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-site.example/wp-json/plugixa-pos/v1/stripe-terminal/unmatched/pi_3UdVCnPfpjsL7fG11ZgTLneO/refund', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
  },
});
const { data } = await response.json();

Quick Links

Share