Contents
On this page

Email Receipt - Plugixa POS for WooCommerce

POST /plugixa-pos/v1/orders/{id}/send-receipt

Send the sale’s receipt by email, through WooCommerce’s emails.

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 be allowed to use the register of the sale (register access).

Request

POST https://your-site.example/wp-json/plugixa-pos/v1/orders/4464/send-receipt

Path parameters

Name Type Description
id integer The order’s id

Request body

Content type: application/json

Field Type Required Description
email string Yes Where to send it, up to 190 characters.
{
  "email": "camille.martin@example.com"
}

Responses

200 OK.

{
  "success": true,
  "data": {
    "sent": true
  }
}

Errors

Status Code When
404 plugixa_pos_not_found Not a register order.
403 plugixa_pos_register_forbidden The register is missing or archived, or the user may not use it.
422 plugixa_pos_email_invalid The address is not valid.
429 plugixa_pos_email_limit This receipt was already sent several times. Try again later.
500 plugixa_pos_email_unavailable WooCommerce emails are not available.
502 plugixa_pos_email_failed The site could not send the email.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-pos/v1/orders/4464/send-receipt" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"email":"camille.martin@example.com"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/orders/4464/send-receipt');
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([
        'email' => 'camille.martin@example.com',
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-pos/v1/orders/4464/send-receipt', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ email: 'camille.martin@example.com' }),
});
const { data } = await response.json();

Quick Links

Share