Открыта бета 1С:ПредприятияОставить заявку
Cybersource logo

Cybersource

Платёжный провайдер CyberSource для Medusa v2 с Flex Microform (PCI DSS SAQ-A)

npm install medusa-payment-cybersource
Категория
Создано
Сервис
Версия
1.1.1
Последнее обновление
8 месяцев назад
Ежемесячные загрузки
Загрузка данных

Medusa Payment Cybersource for Medusa

CyberSource payment plugin for Medusa.js v2, built on Flex Microform v2 (PCI DSS SAQ-A compliant).

Features

  • Flex Microform v2 — card data is tokenized directly at CyberSource; it never touches your server
  • Device Fingerprint (ThreatMetrix) — fraud scoring via device profiling before payment
  • Authorization + manual capture from the Medusa admin dashboard
  • Auto-capture (sale mode) for instant settlement
  • Partial and full refunds
  • Zero-amount orders — 100% discounts and free orders are handled automatically (no gateway call)
  • Admin widget — CyberSource transaction details panel injected into order detail view

Requirements

Medusa.jsv2 ()
Node.js18+
CyberSourceBusiness Center account

Installation

Environment Variables

Add these to your :

Where to find these values: CyberSource Business Center → Account Management → Transaction Security Keys → Security Keys for the HTTP Signature Security Policy

Configuration

In , add the plugin to both (for the API route) and (for the payment provider):

Plugin Options

OptionTypeDescription
Required. Your CyberSource Merchant ID
Required. Shared key ID (HTTP Signature)
Required. Shared secret key (HTTP Signature)
or . Default:
Auto-capture on authorization (sale mode). Default:
Card networks for Flex. Default:

Payment Flow

Frontend Integration

1. Load Flex Microform

2. Load Device Fingerprint Script

When the user selects CyberSource as payment method, generate a unique session ID and load the ThreatMetrix script. The same ID must be sent in the authorize request.

3. Initialize Flex

4. Tokenize and Pre-authorize

Call this before :

— Request / Response

Request body:

FieldRequiredDescription
YesMedusa payment session ID
YesJWT from
NoSession ID used in the ThreatMetrix script URL
NoBilling address object for AVS/fraud checks

Success response (200):

Declined response (402):

Device Fingerprint

The plugin sends and to the CyberSource Payments API. The flag is required so that CyberSource looks up ThreatMetrix using the raw session ID (your UUID) instead of the default composite key — which would cause a mismatch with what the frontend script registered.

You can verify fingerprint collection is working by checking a transaction in CyberSource Business Center. A successful integration shows a hash under Device Fingerprint ID instead of "Not Submitted".

Capture Modes

Manual Capture (default)

CyberSource authorizes the card on order placement. You capture the funds from the Medusa Admin → Orders → Payment panel. Authorization expires in 5–7 days if not captured.

Auto-Capture (sale mode)

Set . CyberSource processes authorization and capture together; the payment is marked as captured immediately on order placement.

Admin Widget

The plugin injects a CyberSource panel into the order detail page of the Medusa admin (). It shows:

FieldDescription
Status badgeDerived display status (see table below)
Transaction IDCyberSource authorization ID
Capture IDOnly shown if different from Transaction ID (manual capture)
Reconciliation IDCyberSource reconciliation ID
CardCard brand + last 4 digits
Last Refund IDID of the last refund issued
Last Refund AmountAmount of the last refund

Status badge logic:

ConditionBadge
is set🔵 REFUNDED
+ set (auto-capture)🟢 CAPTURED
(no capture ID)🟠 AUTHORIZED
🟢 CAPTURED
⚫ VOIDED
🔴 DECLINED

Admin Refund Route

Medusa's default refund UI has a validation that can block refunds in some edge cases. Add this route to your Medusa store for a direct refund bypass:

Create in your Medusa project:

Call it from your admin UI or custom dashboard:

Development

Linking to a local Medusa store with yalc

After any plugin change, re-run in the plugin directory, then fully restart the Medusa server (yalc updates , hot-reload won't pick it up).

CyberSource Resources

License

MIT