Մշակողներին / Public API

Հանրային API անվտանգ payment integrations-ի համար:

Օգտագործեք VPOS.am-ը որպես server-side integration layer payment sessions-ի, hosted checkout redirects-ի, status verification-ի եւ signed lifecycle events-ի համար: Այս էջը նկարագրում է միայն public merchant contracts-ը եւ դիտավորյալ չի ներառում console/admin API, internal provider credentials կամ operator workflows:

Public scope

Փաստաթղթավորված է

Merchant payment-session creation, payment status lookup, non-secret health status, webhooks եւ idempotent retries:

Այստեղ ներառված չէ

Console/admin endpoints, operator tokens, provider credentials, bank secrets, payout data եւ internal reconciliation controls:

Production access

Production credentials-ը տրամադրվում է միայն merchant onboarding-ից, domain review-ից, callback verification-ից եւ test payment flow-ից հետո:

Մի կանչեք merchant endpoints-ը browser code-ից կամ mobile apps-ից embedded secrets-ով: Bearer tokens-ը եւ webhook secrets-ը պահեք միայն trusted backend services-ում:

Quick start

Նվազագույն ինտեգրացիան ունի երեք server-side մաս. ստեղծել payment session, buyer-ին redirect անել hosted checkout, հետո final status-ը հաստատել status lookup-ով կամ signed webhook-ով:

curl -X POST https://api.vpos.am/v1/payment-sessions \
  -H "Authorization: Bearer <merchant_api_token>" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-1001-pay-attempt-1" \
  -d '{
    "merchantOrderId": "order-1001",
    "amountMinor": 15000,
    "currency": "AMD",
    "provider": "manual",
    "returnUrl": "https://merchant.example/payments/return",
    "customer": {
      "email": "buyer@example.com",
      "phone": "+37400000000",
      "name": "Test Buyer"
    },
    "metadata": {
      "source": "custom-backend"
    }
  }'

Browser return URL-ը payment proof չէ: Դա միայն UI event է: Fulfillment-ը պետք է սպասի server-side verification-ի կամ signed webhook event-ի:

Endpoints

GET /api/health

Վերադարձնում է non-secret runtime status monitoring-ի եւ integration checks-ի համար: JSON body-ում կարող են լինել readiness blockers, բայց client-ը դրանք չպետք է համարի stable contract:

StatusՆշանակություն
200Service-ը հասանելի է: Readiness-ը վերադարձվում է JSON body-ում:
405HTTP method-ը չի աջակցվում:
GET /v1/capabilities

Վերադարձնում է conservative provider capability matrix: Օգտագործեք այն PayLink, QR, refunds, fiscalization եւ tokenization UI-ը միայն պատրաստ route-երի համար միացնելու նպատակով:

FieldԿանոններ
providers[].capabilitiesBoolean support/enabled flags յուրաքանչյուր provider route-ի համար:
payment_links, qr_presentationEnabled է միայն երբ ընտրված route-ը կարող է ստեղծել payment sessions:
refund, capture, void, tokenization, subscriptionsPublic contracts-ը guarded է. execution-ը disabled է մինչեւ provider capabilities, idempotency եւ sandbox tests:
POST /v1/payment-links

Ստեղծում է idempotent payment link payment session-ի հիման վրա: QR payload-ը միայն URL presentation layer է. final payment status-ը գալիս է webhook-ով կամ reconciliation-ով:

FieldԿանոններ
Idempotency-KeyՊարտադիր header: Reuse արեք retries-ի ժամանակ duplicate payment link-ից խուսափելու համար:
amount, currencyMajor-unit amount եւ AMD/USD/EUR currency: AMD-ի համար միայն whole number:
descriptionՊարտադիր customer-facing payment description:
expiresAtOptional future ISO date/time: Expiry-ն payment outcome proof չէ:
providerRouteOptional provider route: Unsupported կամ not-ready route-ը rejected է:
POST /v1/payment-sessions

Ստեղծում է normalized payment session եւ վերադարձնում hosted checkout URL, եթե ընտրված provider-ը կարող է սկսել checkout:

FieldԿանոններ
merchantOrderIdՊարտադիր merchant-side order reference: Օգտագործեք stable value reconciliation-ի համար:
amountMinorՊարտադիր integer amount minor currency units-ով:
currencyPublic values: AMD, USD, EUR:
returnUrlAbsolute HTTPS URL, ուր buyer-ը վերադառնում է checkout-ից հետո:
customerOptional email, phone եւ name: Պահեք միայն այն, ինչ պետք է business process-ին:
POST /v1/payments/{id}/refunds · /capture · /void

Guarded operation contracts refunds, capture, void, fiscal retry, tokenization եւ subscriptions-ի համար: Պահանջում են Idempotency-Key եւ չեն կատարվում մինչ provider capabilities-ը չմիացվեն ու չթեստավորվեն:

FieldԿանոններ
Idempotency-KeyՊարտադիր է money-moving կամ lifecycle operation-ի համար:
refundՊահանջում է verified paid/partially_refunded payment, amountMinor, matching currency եւ reason:
capture, voidՊահանջում են authorized payment: Browser return-ը proof չէ:
tokenizationRaw card data-ն rejected է. պետք է provider-hosted token lifecycle եւ consent:
subscriptionsՊահանջում են provider token եւ failed-renewal behavior tests մինչ execution enable-ը:
GET /v1/payments?paymentId=<id>

Վերադարձնում է արդեն ստեղծված session-ի current normalized payment state-ը:

StatusՄշակման կանոն
created, pending_*, authorizedFulfillment չանել: Շարունակեք polling կամ սպասեք webhook-ին:
paidFulfillment-ը կարելի է անել amount, currency եւ order reference match-ից հետո:
failed, cancelled, expiredՑույց տվեք failure state կամ ստեղծեք նոր payment attempt:
refunded, partially_refunded, reversed, disputedSync արեք accounting, CRM եւ customer support workflows:

Webhooks

Webhook delivery-ն կարգավորվում է յուրաքանչյուր merchant-ի համար onboarding-ի ընթացքում: Ձեր endpoint-ը պետք է verify անի HMAC signature-ը, պահի event id-ն, արագ պատասխանի եւ business side effects-ը տեղափոխի queue:

{
  "id": "evt_01hxxexample",
  "type": "payment.status_changed",
  "createdAt": "2026-05-25T08:00:00.000Z",
  "payment": {
    "id": "pay_01hxxexample",
    "merchantOrderId": "order-1001",
    "amountMinor": 15000,
    "currency": "AMD",
    "status": "paid"
  }
}

Signature header format: X-VPOS-Signature: sha256=<hex_hmac_sha256>: HMAC-ը հաշվվում է raw request body-ի վրա merchant webhook secret-ով:

Idempotency

Օգտագործեք Idempotency-Key retryable operations-ի համար, օրինակ payment-session creation: Պահեք key-ը order-ի եւ payment attempt-ի հետ: Network retry-ն չպետք է ստեղծի երկրորդ payable order կամ invoice:

  • Օգտագործեք deterministic key յուրաքանչյուր order payment attempt-ի համար, ոչ թե random key յուրաքանչյուր retry-ի համար:
  • Տարբեր user-initiated attempts-ի համար պահեք տարբեր keys:
  • Միասին log արեք VPOS payment id, merchant order id, amount եւ currency:

Errors

HTTP statusՆշանակությունIntegrator action
401Merchant bearer token-ը բացակայում է կամ սխալ է:Մի retry արեք blind ձեւով: Rotate կամ reissue credentials:
403Request origin-ը trusted չէ:Օգտագործեք server-to-server requests կամ register արեք backend origin-ը:
422Validation failed:Ուղղեք request data-ն մինչ retry:
429Rate limited:Կատարեք backoff եւ retry jitter-ով:
503Provider, storage կամ authentication dependency-ն պատրաստ չէ:Retry later կամ դիմեք support-ին, եթե դա block է production-ի համար:

Security rules

  • Երբեք մի բացեք merchant bearer tokens, webhook secrets կամ provider credentials frontend code-ում:
  • Օգտագործեք միայն HTTPS եւ verify արեք server certificates backend clients-ում:
  • Payment-ը final համարեք միայն server-side status confirmation-ից հետո:
  • Validate արեք amount, currency եւ merchant order id մինչ order, CRM կամ ERP state փոփոխելը:
  • Պահեք webhook event ids եւ reject արեք duplicate side effects:
  • Log արեք failed signature checks եւ unexpected status transitions առանց unnecessary personal data պահելու:

Այս public page-ը դիտավորյալ չի ներառում production tokens, internal console routes, private provider callbacks, database details կամ bank credentials:

Access request

Pilot կամ production access-ի համար ուղարկեք company name, website, integration type, expected provider, currencies, callback URL եւ contact person info@vpos.am հասցեին:

Production-ից առաջ VPOS.am-ը ստուգում է merchant identity, domain ownership, callback security, test payment results, refund եւ reconciliation process, support ownership: