External API

Developer documentation

Integrate online and POS payments, query operations, and receive webhooks with the Avirato Payments external API.

Queries

Obtain payment detail

Returns complete information for an online payment session, including all payment attempts and, if the session is completed, the authorized payment reference (paymentReference).

This endpoint is the main way to obtain the paymentReference you need to perform modifications (refunds, captures, etc.).

Live: GET https://aviratopayments.com/external/v1/payment/session/{sessionId}?webcode={webcode}
Test: GET https://aviratopayments.com/external/v1/test/payment/session/{sessionId}?webcode={webcode}

Parameters

ParameterLocationTypeRequiredDescription
sessionIdPathstringYesThe sessionId returned when creating the session
webcodeQuerystringYesYour business identifier

Example

curl -X GET "https://aviratopayments.com/external/v1/payment/session/SHOP01-EXT-17195000001234?webcode=SHOP01" \
  -H "X-API-KEY: your_live_api_key"

Response (200) - Completed session

{
  "success": true,
  "data": {
    "sessionId": "SHOP01-EXT-17195000001234",
    "status": "completed",
    "amount": {
      "value": 15000,
      "currency": "EUR"
    },
    "countryCode": "ES",
    "shopperLocale": "es-ES",
    "deliverAt": "2026-07-15T14:00:00Z",
    "description": "Pedido #12345 - Servicio premium",
    "customReference": "ORD-2026-12345",
    "isPreAuth": false,
    "urlOk": "https://tu-sistema.com/pago-ok",
    "urlKo": "https://tu-sistema.com/pago-error",
    "createdAt": "2026-06-28 10:30:00",
    "paymentReference": "SHOP01-PXT-17195000005678",
    "completedAt": "2026-06-28 10:35:22",
    "paymentStatus": "AUTHORISED",
    "attempts": [
      {
        "paymentReference": "SHOP01-PXT-17195000003456",
        "status": "refused",
        "createdAt": "2026-06-28 10:32:00"
      },
      {
        "paymentReference": "SHOP01-PXT-17195000005678",
        "status": "authorised",
        "createdAt": "2026-06-28 10:34:00"
      }
    ]
  }
}

Response (200) - Pending session

When the session has not yet completed, it does not include paymentReference, completedAt, or paymentStatus:

{
  "success": true,
  "data": {
    "sessionId": "SHOP01-EXT-17195000001234",
    "status": "pending",
    "amount": {
      "value": 15000,
      "currency": "EUR"
    },
    "countryCode": "ES",
    "shopperLocale": "es-ES",
    "deliverAt": "2026-07-15T14:00:00Z",
    "description": "Pedido #12345 - Servicio premium",
    "customReference": "ORD-2026-12345",
    "isPreAuth": false,
    "urlOk": "https://tu-sistema.com/pago-ok",
    "urlKo": "https://tu-sistema.com/pago-error",
    "createdAt": "2026-06-28 10:30:00",
    "attempts": []
  }
}

Response fields

FieldAlways presentDescription
sessionIdYesUnique session identifier
statusYesSession status: pending, completed, failed, expired, cancelled
amountYesAmount and currency requested when creating the session
countryCodeYesConfigured country
shopperLocaleYesConfigured language
deliverAtYesDelivery date (may be null)
descriptionYesDescription (may be null)
customReferenceYesYour internal reference (may be null)
isPreAuthYesWhether it was created as pre-authorization
urlOk / urlKoYesConfigured return URLs
createdAtYesSession creation date and time
paymentReferenceOnly if completedAuthorized payment reference. Use this for modifications
completedAtOnly if completedDate when payment was authorized
paymentStatusOnly if completedPayment status at the processor (e.g. AUTHORISED). In Live this value can change over time if the processor notifies later events (chargeback, fraud, reversal). Check webhooks or call this endpoint again if you need the latest status.
attemptsYesInformational array with registered payment attempts. May be empty

Errors

CodeHTTPCause
12001400Missing webcode parameter
10404404Session not found
11008403Session does not belong to your webcode or environment

---

List payments

Lists all online payment sessions with filters and cursor-based pagination.

Live: GET https://aviratopayments.com/external/v1/payment/sessions?webcode={webcode}
Test: GET https://aviratopayments.com/external/v1/test/payment/sessions?webcode={webcode}

Query parameters

ParameterTypeRequiredDescription
webcodestringYesYour business identifier
statusstringNoFilter by status: pending, completed, failed, expired, cancelled
created_at_startstringNoStart date (filter)
created_at_endstringNoEnd date (filter)
cursorstringNoPagination cursor (from previous response)
takeintegerNoResults per page (1-100, default: 20)
orderstringNoResult order: asc or desc (default: asc)

Example

curl -X GET "https://aviratopayments.com/external/v1/payment/sessions?webcode=SHOP01&status=completed&take=10" \
  -H "X-API-KEY: your_live_api_key"

Response (200)

{
  "success": true,
  "data": {
    "payments": [
      {
        "sessionId": "SHOP01-EXT-17195000001234",
        "status": "completed",
        "amount": { "value": 15000, "currency": "EUR" },
        "description": "Pedido #12345",
        "customReference": "ORD-2026-12345",
        "isPreAuth": false,
        "createdAt": "2026-06-28 10:30:00",
        "completedAt": "2026-06-28 10:35:22",
        "paymentReference": "SHOP01-PXT-17195000005678",
        "paymentStatus": "AUTHORISED"
      }
    ],
    "meta": {
      "cursor": "eyJpZCI6NDJ9",
      "hasMore": true,
      "total": 89
    }
  }
}

Fields for each session in the listing

FieldDescription
sessionIdSession identifier
statusCurrent status
amountAmount and currency
descriptionDescription (may be null)
customReferenceYour internal reference (may be null)
isPreAuthWhether it is pre-authorization
createdAtCreation date and time
completedAtCompletion date (may be null)
paymentReferenceAuthorized payment reference (may be null if not completed)
paymentStatusPayment status: AUTHORISED, FAILED, REFUNDED, PARTIALLYREFUNDED, CANCELED, ACTIVEDEPOSIT (may be null). In Live the value can evolve after later webhooks (see Webhooks).

Cursor pagination

Pagination works with opaque cursors (not page numbers):

# First page
GET .../payment/sessions?webcode=SHOP01&take=20

# Next page (using cursor from meta.cursor)
GET .../payment/sessions?webcode=SHOP01&take=20&cursor=eyJpZCI6NDJ9

# Repeat until meta.hasMore == false

Cursors are opaque strings. Do not try to decode or build them manually; simply pass the value of meta.cursor as-is.

---

List modifications for a payment

Lists all modification operations (refund, capture, cancel, extend) associated with an online payment session.

Live: GET https://aviratopayments.com/external/v1/payment/session/{sessionId}/modifications?webcode={webcode}
Test: GET https://aviratopayments.com/external/v1/test/payment/session/{sessionId}/modifications?webcode={webcode}

Parameters

ParameterLocationTypeRequiredDescription
sessionIdPathstringYesThe payment session sessionId
webcodeQuerystringYesYour business identifier
typeQuerystringNoFilter by type: refund, capture, cancel, extend
cursorQuerystringNoPagination cursor
takeQueryintegerNoResults per page (1-100, default: 20)
orderQuerystringNoOrder: asc or desc (default: asc)

Example

curl -X GET "https://aviratopayments.com/external/v1/payment/session/SHOP01-EXT-17195000001234/modifications?webcode=SHOP01" \
  -H "X-API-KEY: your_live_api_key"

Response (200)

{
  "success": true,
  "data": {
    "modifications": [
      {
        "operationReference": "SHOP01-RFX-17195100001234",
        "operationType": "refund",
        "paymentReference": "SHOP01-PXT-17195000005678",
        "sessionId": "SHOP01-EXT-17195000001234",
        "status": "success",
        "requestedAt": "2026-06-29 14:00:00",
        "createdAt": "2026-06-29 14:00:00",
        "resolvedAt": "2026-06-29 14:00:05",
        "amount": {
          "value": 5000,
          "currency": "EUR"
        },
        "reason": "CUSTOMER REQUEST"
      }
    ],
    "meta": {
      "cursor": null,
      "hasMore": false,
      "total": 1
    }
  }
}

Fields for each modification

FieldAlways presentDescription
operationReferenceYesUnique operation reference
operationTypeYesType: refund, capture, cancel, extend
paymentReferenceYesOriginal payment reference the operation was performed on
sessionIdYesAssociated payment session
statusYesStatus: pending, success, failed
requestedAtYesWhen the operation was requested
createdAtYesRecord creation date and time
resolvedAtYesWhen it completed (or failed). null if pending
amountOnly refund and captureOperation amount
reasonOnly refundRefund reason

---

List POS payment modifications

Lists all modification operations associated with a specific POS payment.

Live: GET https://aviratopayments.com/external/v1/pos/payment/{posPaymentId}/modifications?webcode={webcode}
Test: GET https://aviratopayments.com/external/v1/test/pos/payment/{posPaymentId}/modifications?webcode={webcode}

Parameters

ParameterLocationTypeRequiredDescription
posPaymentIdPathstringYesThe POS payment posPaymentId
webcodeQuerystringYesYour business identifier
typeQuerystringNoFilter by type: refund, capture, cancel, extend
cursorQuerystringNoPagination cursor
takeQueryintegerNoResults per page (1-100, default: 20)
orderQuerystringNoOrder: asc or desc (default: asc)

Example

curl -X GET "https://aviratopayments.com/external/v1/pos/payment/SHOP01-POSX-17195300001234/modifications?webcode=SHOP01" \
  -H "X-API-KEY: your_live_api_key"

Response (200)

{
  "success": true,
  "data": {
    "modifications": [
      {
        "operationReference": "SHOP01-RFX-17195400001234",
        "operationType": "refund",
        "paymentReference": "SHOP01-POSX-17195300001234",
        "sessionId": "SHOP01-POSX-17195300001234",
        "status": "success",
        "requestedAt": "2026-06-30 10:00:00",
        "createdAt": "2026-06-30 10:00:00",
        "resolvedAt": "2026-06-30 10:00:03",
        "amount": {
          "value": 2000,
          "currency": "EUR"
        },
        "reason": "CUSTOMER REQUEST"
      }
    ],
    "meta": {
      "cursor": null,
      "hasMore": false,
      "total": 1
    }
  }
}

Response fields are identical to List modifications for a payment.

Errors

CodeHTTPCause
12001400Missing webcode parameter
10404404POS payment not found
11008403POS payment does not belong to your webcode or environment

---

List all modifications

Lists all modification operations for your business, regardless of which payment they belong to. Allows filtering by type, status, date, and free text.

Live: GET https://aviratopayments.com/external/v1/modifications?webcode={webcode}
Test: GET https://aviratopayments.com/external/v1/test/modifications?webcode={webcode}

Query parameters

ParameterTypeRequiredDescription
webcodestringYesYour business identifier
typestringNoFilter by type: refund, capture, cancel, extend
statusstringNoFilter by status: pending, success, failed
dateFromstringNoStart date (format YYYY-MM-DD)
dateTostringNoEnd date (format YYYY-MM-DD)
searchstringNoFree-text search (references, reasons, etc.)
cursorstringNoPagination cursor
takeintegerNoResults per page (1-100, default: 20)
orderstringNoOrder: asc or desc (default: asc)

Example

curl -X GET "https://aviratopayments.com/external/v1/modifications?webcode=SHOP01&type=refund&status=success&take=10" \
  -H "X-API-KEY: your_live_api_key"

Response (200)

{
  "success": true,
  "data": {
    "modifications": [
      {
        "operationReference": "SHOP01-RFX-17195100001234",
        "operationType": "refund",
        "paymentReference": "SHOP01-PXT-17195000005678",
        "sessionId": "SHOP01-EXT-17195000001234",
        "status": "success",
        "requestedAt": "2026-06-29 14:00:00",
        "createdAt": "2026-06-29 14:00:00",
        "resolvedAt": "2026-06-29 14:00:05",
        "amount": {
          "value": 5000,
          "currency": "EUR"
        },
        "reason": "CUSTOMER REQUEST"
      },
      {
        "operationReference": "SHOP01-RFX-17195400001234",
        "operationType": "refund",
        "paymentReference": "SHOP01-POSX-17195300001234",
        "sessionId": "SHOP01-POSX-17195300001234",
        "status": "success",
        "requestedAt": "2026-06-30 10:00:00",
        "createdAt": "2026-06-30 10:00:00",
        "resolvedAt": "2026-06-30 10:00:03",
        "amount": {
          "value": 2000,
          "currency": "EUR"
        },
        "reason": "CUSTOMER REQUEST"
      }
    ],
    "meta": {
      "cursor": "eyJpZCI6NDJ9",
      "hasMore": false,
      "total": 2
    }
  }
}

This endpoint returns modifications from all payments (online and POS). You can identify payment type by reference: -PXT- (online Live), -PXTT- (online Test), -POSX- (POS Live), -POSXT- (POS Test).

---

Pagination

All listing endpoints use cursor-based pagination. Cursors are opaque strings representing the current position in the result set.

How it works

  1. First request: Call the endpoint without the cursor parameter. You will receive the first results and a meta.cursor
  2. Next page: If meta.hasMore is true, use the value of meta.cursor as the cursor parameter on the next request
  3. End: When meta.hasMore is false, there are no more results

meta fields

FieldDescription
cursorCursor to get the next page. null if there are no more
hasMoretrue if more results are available
totalTotal number of records matching the filters
# Page 1
curl ".../payment/sessions?webcode=SHOP01&take=10"
# meta: { "cursor": "eyJpZCI6MTB9", "hasMore": true, "total": 45 }

# Page 2
curl ".../payment/sessions?webcode=SHOP01&take=10&cursor=eyJpZCI6MTB9"
# meta: { "cursor": "eyJpZCI6MjB9", "hasMore": true, "total": 45 }

# Page 3
curl ".../payment/sessions?webcode=SHOP01&take=10&cursor=eyJpZCI6MjB9"
# meta: { "cursor": null, "hasMore": false, "total": 45 }

Important: Cursors are opaque. Do not try to decode, modify, or build them manually. Simply pass the value exactly as you receive it.