Contents
On this page

Start Adyen Payment - Plugixa POS for WooCommerce

POST /plugixa-pos/v1/adyen-terminal/payments

Send the amount to the register’s terminal. Then poll Get Adyen Payment Status until it is no longer pending.

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/adyen-terminal/payments

Request body

Content type: application/json

Field Type Required Description
register_id integer Yes The register.
amount string Yes Amount, decimal, above zero.
attempt_id string Yes Your id for this payment attempt, 8 to 64 letters, digits and dashes. Resending the same id does not charge twice.
{
  "register_id": 1,
  "amount": "26.00",
  "attempt_id": "8b2d4f60-1a3c-4e5f-9071-a2b3c4d5e6f7"
}

Responses

201 Created. payment_intent holds the service id.

{
  "success": true,
  "data": {
    "payment_intent": "25238425f2",
    "amount": "26.00",
    "test_mode": true
  }
}

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).
422 plugixa_pos_invalid_amount The amount is zero.
409 plugixa_pos_adyen_no_terminal No terminal linked to the register.
502 plugixa_pos_adyen_unreachable Adyen 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/adyen-terminal/payments" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"register_id":1,"amount":"26.00","attempt_id":"8b2d4f60-1a3c-4e5f-9071-a2b3c4d5e6f7"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/adyen-terminal/payments');
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,
        'amount'      => '26.00',
        'attempt_id'  => '8b2d4f60-1a3c-4e5f-9071-a2b3c4d5e6f7',
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-pos/v1/adyen-terminal/payments', {
  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, amount: '26.00', attempt_id: '8b2d4f60-1a3c-4e5f-9071-a2b3c4d5e6f7' }),
});
const { data } = await response.json();

Quick Links

Share