Contents
On this page
Create Payment Link - Plugixa POS for WooCommerce
POST /plugixa-pos/v1/pay-links/payments
Ask the provider for a payment page for this amount. Show the url as a QR code (the Pro customer display can), then poll Get Payment Link 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/pay-links/payments
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
register_id |
integer |
Yes | The register. |
provider |
string |
Yes | An enabled provider id. |
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,
"provider": "stripe",
"amount": "29.00",
"attempt_id": "5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9"
}
Responses
201 Created.
{
"success": true,
"data": {
"payment_intent": "pl4f8a2c9e1b7d3f6a05",
"url": "https://checkout.stripe.com/c/pay/cs_test_a1B2c3D4",
"provider": "Stripe",
"amount": "29.00",
"test_mode": true
}
}
| Field | Type | Meaning |
|---|---|---|
data.payment_intent |
string |
The link’s id, for the status and cancel routes |
data.url |
string |
The provider’s payment page |
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_link_off |
The provider is not set up. |
409 |
plugixa_pos_link_error |
The provider did not return a payment page. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-pos/v1/pay-links/payments" \
-u "$WP_USER:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"register_id":1,"provider":"stripe","amount":"29.00","attempt_id":"5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/pay-links/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,
'provider' => 'stripe',
'amount' => '29.00',
'attempt_id' => '5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-pos/v1/pay-links/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, provider: 'stripe', amount: '29.00', attempt_id: '5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9' }),
});
const { data } = await response.json();
Quick Links
Share