01
Authorization
Authorization: api-key=<YOUR_API_KEY>
Content-Type: application/json
02
Sandbox
sandbox.venta.network
Production
api.venta.network
| Visa | 4242 4242 4242 4242 | |
| Mastercard | 5555 5555 5555 4444 | |
| Amex | 3782 822463 10005 | |
| Visa (3DS) | 4000 0000 0000 3220 | |
| Declined | 4000 0000 0000 0002 |
03
npm
npm install @venta/hyper-js
npm install @venta/react-hyper-js
checkout.js
import { loadHyper } from "@venta/hyper-js";
// 使用 Publishable Key 初始化(前端安全)
const hyperPromise = loadHyper("YOUR_PUBLISHABLE_KEY");
server.js
const response = await fetch("https://sandbox.venta.network/payments", {
method: "POST",
headers: {
"Content-Type": "application/json",
"api-key": "YOUR_API_KEY",
},
body: JSON.stringify({
amount: 10000,
currency: "USD",
customer_id: "cus_123",
confirm: false, // 由前端 SDK 负责确认
capture_method: "automatic",
return_url: "https://example.com/complete",
}),
});
// 响应中的 client_secret 用于前端渲染收银台与确认支付
CheckoutForm.jsx
import { HyperElements, UnifiedCheckout } from "@venta/react-hyper-js";
function CheckoutForm({ clientSecret }) {
return (
<HyperElements hyper={hyperPromise} options={{ clientSecret }}>
<UnifiedCheckout />
</HyperElements>
);
}
confirm.js
const { error, status } = await hyper.confirmPayment({
elements,
confirmParams: {
return_url: "https://example.com/complete",
},
});
if (error) {
// 展示错误信息,例如卡片被拒绝
} else if (status) {
// 处理支付状态(succeeded / requires_capture ...)
}
GET /payments/{payment_id}
curl https://sandbox.venta.network/payments/pay_123 \
-H "api-key: YOUR_API_KEY"
ExpressCheckout.jsx
import { loadHyper } from "@venta/hyper-js";
import { HyperElements, ExpressCheckout } from "@venta/react-hyper-js";
const hyperPromise = loadHyper("YOUR_PUBLISHABLE_KEY");
function ExpressPay({ clientSecret }) {
return (
<HyperElements hyper={hyperPromise} options={{ clientSecret }}>
{/* 一行 Apple Pay / G Pay 按钮,点一下弹钱包授权 */}
<ExpressCheckout />
</HyperElements>
);
}
wallet callbacks
<ExpressCheckout
onSDKHandleClick={() => {
// 客户点击钱包按钮后触发(须在 1 秒内完成,否则 Apple Pay 可能失败)
}}
onPaymentComplete={() => {
// 支付完成、跳转 return_url 前触发,可在此更新订单状态
}}
/>
// 注意:ExpressCheckout 会自动完成 confirm,无需像 UnifiedCheckout 那样手动调 confirmPayment
04
Hyper.init(publishableKey, options) | |
hyper.initPaymentSession({ clientSecret }) | |
paymentSession.getCustomerSavedPaymentMethods() | |
paymentMethodSession.getCustomerDefaultSavedPaymentMethodData() | |
paymentMethodSession.getCustomerLastUsedPaymentMethodData() | |
paymentMethodSession.confirmWithCustomerDefaultPaymentMethod(payload) | |
paymentMethodSession.confirmWithLastUsedPaymentMethod(payload) | |
<CardCVCElement id="..." /> | |
useHyper() |
headless.js
<script src="https://cdn.venta.network/hyper.js"></script>
hyper = Hyper.init("YOUR_PUBLISHABLE_KEY", {
// 可选:自定义后端代理地址,统一转发 session / payments / confirm 请求
customBackendUrl: "https://your-backend.example.com",
});
server.js
// 服务端创建 PaymentIntent,返回 clientSecret
// 切勿将 API Key 暴露给客户端
const payment = await createPayment({
amount: 10000,
currency: "USD",
customer_id: "cus_123",
});
// 返回给前端: { client_secret }
session.js
paymentSession = hyper.initPaymentSession({
clientSecret: client_secret,
});
methods.js
// 获取客户已保存的支付方式,渲染自定义 UI
paymentMethodSession = await paymentSession.getCustomerSavedPaymentMethods();
if (paymentMethodSession.error) {
// 处理无默认支付方式的情况
} else {
// 读取默认 / 最近使用的支付方式数据,用于渲染您的卡片列表
const defaultPm = paymentMethodSession.getCustomerDefaultSavedPaymentMethodData();
const lastUsedPm = paymentMethodSession.getCustomerLastUsedPaymentMethodData();
}
pay.js
// 使用默认支付方式发起支付
const { error, status } =
await paymentMethodSession.confirmWithCustomerDefaultPaymentMethod({
confirmParams: { return_url: "https://example.com/complete" },
redirect: "if_required", // always / if_required,默认 always
id: "card-cvc-element", // 采集 CVC 的 CardCVCElement id(可选)
});
// 或使用最近一次使用的支付方式
await paymentMethodSession.confirmWithLastUsedPaymentMethod({
confirmParams: { return_url: "https://example.com/complete" },
redirect: "if_required",
});
CvcElement.jsx
import { CardCVCElement, useHyper } from "@venta/react-hyper-js";
function CvcField() {
const hyper = useHyper();
return (
<div>
{/* 安全 iframe 采集 CVC,数据不经过你的服务器 */}
<CardCVCElement id="card-cvc-element" />
<button onClick={handleSubmit}>立即支付</button>
</div>
);
}
05
POST /payments
curl https://sandbox.venta.network/payments \
-H "Content-Type: application/json" \
-H "api-key: YOUR_API_KEY" \
-d '{
"amount": 10000,
"currency": "USD",
"customer_id": "cus_123",
"payment_method": "card",
"payment_method_data": {
"card": {
"number": "4242424242424242",
"exp_month": 12,
"exp_year": 2029,
"cvc": "123"
}
},
"billing": {
"address": {
"line1": "1467",
"city": "San Francisco",
"state": "CA",
"zip": "94122",
"country": "US"
}
},
"confirm": false,
"capture_method": "automatic",
"return_url": "https://example.com/complete"
}'
Response — 201 Created
{
"payment_id": "pay_8f7e6d5c4b3a2a1b",
"merchant_id": "merchant_1745244120",
"status": "requires_confirmation",
"amount": 10000,
"currency": "USD",
"client_secret": "pay_8f7e6d5c4b3a2a1b_secret_8Kx2Lm9Q",
"created": "2026-08-12T10:14:52.000Z"
}
POST /payments/{payment_id}/confirm
curl https://sandbox.venta.network/payments/pay_8f7e6d5c4b3a2a1b/confirm \
-H "Content-Type: application/json" \
-H "api-key: YOUR_API_KEY" \
-d '{ "confirm": true }'
Response — 200 OK
{
"payment_id": "pay_8f7e6d5c4b3a2a1b",
"status": "processing",
"amount": 10000,
"currency": "USD",
"connector": "stripe",
"connector_transaction_id": "993672945374576J"
}
POST /payments/{payment_id}/capture
curl https://sandbox.venta.network/payments/pay_8f7e6d5c4b3a2a1b/capture \
-H "Content-Type: application/json" \
-H "api-key: YOUR_API_KEY" \
-d '{ "amount_to_capture": 10000 }'
Response — 200 OK
{
"payment_id": "pay_8f7e6d5c4b3a2a1b",
"status": "succeeded",
"amount_received": 10000,
"amount_capturable": 0
}
GET /payments/{payment_id}
curl https://sandbox.venta.network/payments/pay_8f7e6d5c4b3a2a1b \
-H "api-key: YOUR_API_KEY"
Response — 200 OK
{
"payment_id": "pay_8f7e6d5c4b3a2a1b",
"status": "succeeded",
"amount": 10000,
"amount_received": 10000,
"currency": "USD",
"connector": "stripe",
"created": "2026-08-12T10:14:52.000Z",
"modified_at": "2026-08-12T10:15:30.000Z"
}
requires_confirmation
→
processing
→
succeeded
│
requires_capture
→
succeeded
│
failed
POST /payment-method-session
curl https://sandbox.venta.network/payment-method-session \
-H "Content-Type: application/json" \
-H "api-key: YOUR_API_KEY" \
-d '{
"profile_id": "YOUR_PROFILE_ID",
"customer_id": "cus_123",
"storage_type": "long_term"
}'
// 响应返回 sdk_authorization(临时会话凭证),
// 供前端 SDK 初始化与安全采集卡号,请勿泄露
vault-form.js
// ① 调用您自己的后端端点拿到 sdk_authorization
const res = await fetch("/api/payment-method-session");
const { sdk_authorization } = await res.json();
// ② 用 sdk_authorization 初始化 SDK(注意:不是 Publishable Key)
const hyper = loadHyper(sdk_authorization);
// ③ 挂载卡片采集 / 管理表单(iframe),客户在此输入或选择卡片
hyper.paymentMethodsManagement().mount("#pmm-container");
tokenize.js
// 客户在表单中填好卡后,调用确认代币化
const { error, payment_method_id } = await hyper.confirmTokenization({
return_url: "https://example.com/vault-complete",
});
if (error) { /* 展示错误,例如卡片被拒 */ return; }
// ★ payment_method_id 在此返回,先到前端
// 请将它 POST 回您的后端,长期保存(Vault-Then-Pay)
await fetch("/api/save-payment-method", {
method: "POST",
body: JSON.stringify({ payment_method_id, customer_id: "cus_123" }),
});
POST /payments
{
"amount": 10000,
"currency": "USD",
"customer_id": "cus_123",
"payment_method": "card",
"payment_token": "payment_method_id_from_vault",
"confirm": true
}
POST /refunds
curl https://sandbox.venta.network/refunds \
-H "Content-Type: application/json" \
-H "api-key: YOUR_API_KEY" \
-d '{
"payment_id": "pay_8f7e6d5c4b3a2a1b",
"amount": 6540,
"refund_type": "instant",
"reason": "Customer requested refund"
}'
Response — 201 Created
{
"refund_id": "ref_8f7e6d5c4b3a2a1b",
"payment_id": "pay_8f7e6d5c4b3a2a1b",
"amount": 6540,
"currency": "USD",
"status": "succeeded",
"connector": "stripe",
"created_at": "2026-08-12T10:16:00.000Z",
"updated_at": "2026-08-12T10:16:01.000Z"
}
GET /refunds/{refund_id}
curl https://sandbox.venta.network/refunds/ref_8f7e6d5c4b3a2a1b \
-H "api-key: YOUR_API_KEY"
Response — 200 OK
{
"refund_id": "ref_8f7e6d5c4b3a2a1b",
"payment_id": "pay_8f7e6d5c4b3a2a1b",
"amount": 6540,
"currency": "USD",
"status": "succeeded",
"connector": "stripe"
}
pre_dispute | |
dispute | |
pre_arbitration | |
arbitration | |
dispute_reversal |
dispute_opened | |
dispute_challenged | |
dispute_expired | |
dispute_cancelled | |
dispute_accepted | |
dispute_won | |
dispute_lost |
GET /disputes/list
curl "https://sandbox.venta.network/disputes/list?dispute_status=dispute_opened&limit=20" \
-H "api-key: YOUR_API_KEY"
Response — 200 OK
[
{
"dispute_id": "dp_8f7e6d5c4b3a2a1b",
"payment_id": "pay_8f7e6d5c4b3a2a1b",
"amount": "12500",
"currency": "USD",
"dispute_stage": "dispute",
"dispute_status": "dispute_opened",
"connector": "stripe",
"connector_reason": "fraudulent",
"challenge_required_by": "2026-08-19T10:20:00.000Z"
}
]
GET /disputes/{dispute_id}
curl https://sandbox.venta.network/disputes/dp_8f7e6d5c4b3a2a1b \
-H "api-key: YOUR_API_KEY"
Response — 200 OK
{
"dispute_id": "dp_8f7e6d5c4b3a2a1b",
"payment_id": "pay_8f7e6d5c4b3a2a1b",
"attempt_id": "attempt_123",
"amount": "12500",
"currency": "USD",
"dispute_stage": "dispute",
"dispute_status": "dispute_opened",
"connector": "stripe",
"connector_reason": "fraudulent",
"connector_reason_code": "10.4",
"challenge_required_by": "2026-08-19T10:20:00.000Z",
"profile_id": "prof_8e1f2a3b4c5d",
"merchant_connector_id": "mca_5c4d3e2f1a0b"
}
06
| POST | /payments | |
| POST | /payments/{id} | |
| POST | /payments/{id}/confirm | |
| POST | /payments/{id}/capture | |
| POST | /payments/{id}/cancel | |
| GET | /payments/{id} | |
| GET | /payments | |
| POST | /customers | |
| GET | /customers/{id} | |
| POST | /payment-methods | |
| GET | /customers/{id}/payment_methods | |
| POST | /payment-method-session | |
| POST | /refunds | |
| GET | /refunds/{id} | |
| GET | /disputes/list | |
| GET | /disputes/{id} | |
| POST | /disputes/accept/{id} | |
| POST | /disputes/evidence | |
| POST | /api/analytics/v1/merchant/report/{type} |
07
Webhook Endpoint
# Sandbox
https://sandbox.venta.network/webhooks/{merchant_id}/{merchant_connector_id}
# Production
https://api.venta.network/webhooks/{merchant_id}/{merchant_connector_id}
x-webhook-signature-512 | string | ||
x-webhook-id | string | ||
x-webhook-timestamp | integer | ||
Content-Type | string | application/json |
merchant_id | string | ||
event_id | string | ||
event_type | string | ||
timestamp | string | ||
processor_merchant_id | string | ||
content | object |
payment_succeeded — Payload Example
payment_succeeded — Payload Example
{
"merchant_id": "merchant_1745244120",
"event_id": "evt_9f2c1b3a4d5e6f7a",
"event_type": "payment_succeeded",
"timestamp": "2026-08-12T10:15:30.000Z",
"processor_merchant_id": "M1234567",
"content": {
"type": "payment_details",
"object": {
"payment_id": "pay_8f7e6d5c4b3a2a1b",
"merchant_id": "merchant_1745244120",
"status": "succeeded",
"amount": 12500,
"net_amount": 12500,
"amount_received": 12500,
"currency": "USD",
"connector": "stripe",
"client_secret": "pay_8f7e6d5c4b3a2a1b_secret_8Kx2Lm9Q",
"created": "2026-08-12T10:14:52.000Z",
"modified_at": "2026-08-12T10:15:30.000Z",
"payment_method": "card",
"payment_method_type": "credit_card",
"payment_method_data": {
"card": {
"last4": "4242",
"exp_month": 12,
"exp_year": 2029,
"brand": "visa"
}
},
"profile_id": "prof_8e1f2a3b4c5d",
"merchant_connector_id": "mca_5c4d3e2f1a0b",
"connector_transaction_id": "993672945374576J"
}
}
}
Signature Verification
// 1. 将请求体编码为 JSON 字符串
// 2. 使用 payment_response_hash_key 生成 HMAC-SHA512 签名
// 3. 与请求头 x-webhook-signature-512 比对
const crypto = require("crypto");
const expected = crypto
.createHmac("sha512", payment_response_hash_key)
.update(JSON.stringify(body))
.digest("hex");
if (expected !== req.headers["x-webhook-signature-512"]) {
throw new Error("Invalid webhook signature");
}
report_generation.completed
Success Payload Example
{
"event_type": "report_generation.completed",
"status": "success",
"org_id": "org_MZMfl5gFJ7LksZC3rua2",
"merchant_id": "merchant_1773034629",
"data": {
"report_type": "payment_report",
"start_date_utc": "2026-06-15",
"end_date_utc": "2026-07-15",
"download_url": "https://s3.venta.network/reports/payment_20260715.csv?X-Amz-...",
"expires_in_hours": 48
}
}
report_generation.failed
Failure Payload Example
{
"event": "report_generation.failed",
"org_id": "org_MZMfl5gFJ7LksZC3rua2",
"merchant_id": "merchant_1773034629",
"data": {
"code": "internal_server_error",
"message": "Could not generate the report. Please try again."
}
}
event_type | string | ||
event | string | ||
status | string | ||
org_id | string | ||
merchant_id | string | ||
data.report_type | string | ||
data.start_date_utc | string | ||
data.end_date_utc | string | ||
data.download_url | string | ||
data.expires_in_hours | integer | ||
data.code | string | ||
data.message | string |
payment_id | |
attempt_id | |
status | |
amount | |
currency | |
connector | |
connector_transaction_id | |
amount_to_capture | |
customer_id | |
created_at | |
order_details | |
error_message | |
capture_method | |
authentication_type | |
mandate_id | |
payment_method | |
payment_method_type | |
metadata | |
setup_future_usage | |
statement_descriptor_name | |
description | |
off_session | |
business_country | |
business_label | |
business_sub_label | |
allowed_payment_method_types | |
payment_method_data | |
card_network | |
fingerprint_id | |
modified_at | |
error_code | |
payment_method_id | |
card_holder_name | |
merchant_order_reference_id | |
profile_id |
internal_reference_id | |
refund_id | |
payment_id | |
connector_transaction_id | |
connector | |
connector_refund_id | |
external_reference_id | |
refund_type | |
total_amount | |
currency | |
refund_amount | |
refund_status | |
sent_to_gateway | |
refund_error_message | |
refund_arn | |
attempt_id | |
description | |
refund_reason | |
refund_error_code | |
created_at | |
modified_at | |
profile_id |
dispute_id | |
dispute_amount | |
currency | |
dispute_stage | |
dispute_status | |
payment_id | |
attempt_id | |
connector_status | |
connector_dispute_id | |
connector_reason | |
connector_reason_code | |
challenge_required_by | |
connector_created_at | |
connector_updated_at | |
created_at | |
modified_at | |
connector | |
evidence | |
profile_id | |
merchant_connector_id |
payout_id | |
payout_attempt_id | |
customer_id | |
address_id | |
profile_id | |
payout_method_id | |
payout_type | |
amount | |
destination_currency | |
source_currency | |
description | |
recurring | |
auto_fulfill | |
return_url | |
entity_type | |
metadata | |
created_at | |
last_modified_at | |
attempt_count | |
status | |
connector | |
connector_payout_id | |
is_eligible | |
error_message | |
error_code | |
business_country | |
business_label | |
merchant_connector_id |
authentication_id | |
authentication_connector | |
connector_authentication_id | |
authentication_data | |
payment_method_id | |
authentication_type | |
authentication_status | |
authentication_lifecycle_status | |
created_at | |
modified_at | |
error_message | |
error_code | |
connector_metadata | |
maximum_supported_version | |
threeds_server_transaction_id | |
cavv | |
authentication_flow_type | |
message_version | |
eci | |
trans_status | |
acquirer_bin | |
acquirer_merchant_id | |
three_ds_method_data | |
three_ds_method_url | |
acs_url | |
challenge_request | |
acs_reference_number | |
acs_trans_id | |
acs_signed_content | |
profile_id | |
payment_id | |
merchant_connector_id | |
ds_trans_id | |
directory_server_id | |
acquirer_country_code | |
mcc | |
amount | |
currency | |
merchant_country | |
billing_country | |
shipping_country | |
issuer_country | |
earliest_supported_version | |
latest_supported_version | |
whitelist_decision | |
device_manufacturer | |
platform | |
device_type | |
device_brand | |
device_os | |
device_display | |
browser_name | |
browser_version | |
issuer_id | |
scheme_name | |
exemption_requested | |
exemption_accepted |
Signature Verification (same as standard webhooks)
// Report webhooks use the same HMAC-SHA512 verification
// Key: payment_response_hash_key (same as standard webhooks)
// Sign the raw body, compare with X-Webhook-Signature-512 header
const crypto = require("crypto");
const expected = crypto
.createHmac("sha512", payment_response_hash_key)
.update(JSON.stringify(body))
.digest("hex");
if (expected !== req.headers["x-webhook-signature-512"]) {
throw new Error("Invalid report webhook signature");
}
08
@venta/node
@venta/react-hyper-js
@venta/android
@venta/ios
@venta/react-native
@venta/flutter