@proximuslabs/sdk-payments-web2
v0.2.0-alpha.5
Published
Proximus payments-web2 API integration SDK - alpha
Maintainers
Readme
Proximus Web2 payments SDK
Review card and bank payment requests before calling your payment provider. Create an API key in your PROXIMUS dashboard, install the SDK and connect to the hosted API.
Install
Install the SDK in your application:
npm install @proximuslabs/[email protected]A direct public download is also available:
npm install https://www.proximus.sh/sdk/proximuslabs-sdk-payments-web2-0.2.0-alpha.5.tgzCreate an API key in your PROXIMUS dashboard and pass it to the client. The SDK connects to https://api.proximus.sh by default. Customers do not deploy the security engine.
Server quickstart
import { createPaymentsClient, requireAllow } from "@proximuslabs/sdk-payments-web2";
const client = createPaymentsClient({
apiKey: process.env.PROXIMUS_API_KEY,
baseUrl: process.env.PROXIMUS_BASE_URL,
});
const review = await client.reviewPayment({
requestId: "order_123_review_1",
origin: "https://merchant.example",
kind: "card",
amountMinor: "1000",
currency: "USD",
paymentReference: "provider_payment_reference",
merchantReference: "your_merchant_reference",
});
requireAllow(review); // Throws on challenge/block. Errors also pause execution.
console.log(review.verdict);Protected payment execution
Build the payment from an authenticated backend order and provider record. Amounts are exact integer strings in the currency's minor unit. The provider remains responsible for authorization, settlement, refunds and reconciliation. Use provider references, never PANs, CVVs, PINs or signing secrets.
import { paymentAction } from "@proximuslabs/sdk-payments-web2";
const action = paymentAction(payment);
const { result, claim } = await client.protectAndExecute(action, async (reviewed, claim) => {
return yourPaymentProvider.confirm({
reference: reviewed.payload.payment_reference,
amountMinor: reviewed.payload.amount_minor,
currency: reviewed.payload.currency,
idempotencyKey: claim.execution_id,
});
}, { executionId: order.executionId });
await client.reportExecution(claim.execution_id, "submitted", result.id);payment, order and yourPaymentProvider are your backend records and adapter. The protected workflow requires security:execute in addition to review scopes. A reused claim never invokes the callback again. A timeout does not release the claim, reconcile with the provider before another attempt. The older reviewAndPay helper remains available for compatibility and does not provide server execution claims.
This guard does not automatically collect the security fee. Native-chain fee quotes and settlement verification use the separate explicit fee flow. PSP application fees require a provider adapter.
Protect an action
Use protectAndExecute in JavaScript or TypeScript, protect_and_execute in Python or Rust, or ProtectAndExecute in Go to review an action before calling your signer or payment provider. The SDK proceeds only when the action is allowed, its required checks completed and its execution authorization is current. Blocked, incomplete and expired reviews stop execution.
Use the returned execution ID for your provider's idempotency key. Retrieve the provider result before retrying an uncertain payment.
See the integration guide for setup, examples and supported checks. Each review shows which checks completed and whether the action can proceed.
Shared configuration and errors
apiKey: scoped server-side API key.review:writefor review submission,security:executefor execution authorization,reviews:readfor retrieval and capabilities. monitoring additionally needsmonitor:writeand a linked integration.baseUrl: defaults tohttps://api.proximus.sh. Set your own HTTPS gateway URL for self-hosting. Loopback HTTP is allowed locally. A base path such ashttps://app.example/securityis supported when your proxy mounts the contract there. The SDK does not follow redirects or send browser cookies.fetch: optional compatible implementation for your runtime.timeoutMs: default 15000, maximum 120000. Pass{ signal }to each request.- Supply an immutable
requestId. Reuse it with the identical body for retries. The SDK never retries or charges automatically.requestId()generates a secure UUID wherecrypto.randomUUIDis available. ProximusErrorexposescode,statusandretryAfter; it never includes your secret key or raw error response. 401/403 require configuration fixes, 402 is a hosted credit limit, 409 is a conflict/in-progress request, 429 is a rate limit and 503 is unavailable analysis. First retrieve uncertain reviews before deciding to submit another ID.client.getReview(requestId)returns the backend's stored review record. Hosted and reference-gateway storage shapes may differ; use the submitted review response for immediate execution gating.reviewAndExecuteand wallet/payment guards require an exact, unexpired action binding and a fresh execution claim. On your backend, callclient.authorize(action)to produce this response. Use a durable execution ID and wallet or payment-provider idempotency. A claimed attempt must be reconciled before retrying.- No telemetry, private-key custody, background scanning or direct database access is performed by these SDKs.
Use client.capabilities() to read the current supported networks, checks and behavior-model availability. Solana protection includes external_state by default, so unavailable chain simulation pauses execution.
Platforms
The transport and action builders are TypeScript with ESM/CommonJS outputs. Payment fee calculations use decimal.js for decimal arithmetic. Node 22+ is the tested server target. Browser, React Native and Electron frontends use the action builders/guards with a reviewer calling their own authenticated backend; createClient rejects known browser/React Native environments to reduce accidental secret exposure. This runtime check is a guardrail, not a substitute for secure application architecture.
examples/browser-reviewer.ts, examples/BackendReviewer.swift and examples/BackendReviewer.kt demonstrate that backend boundary. Swift and Kotlin examples are not published native SDKs. React Native may need fetch, AbortController, TextEncoder and secure UUID polyfills; compatibility depends on runtime version. Do not put long-lived API keys in mobile or desktop binaries.
Your backend must authenticate the app user, verify their ownership/permissions, derive the exact action, validate origin/CSRF where applicable, enforce quotas and apply decisions. A client can bypass its own UI guard.
Language packages
All six SDK products are available in TypeScript, Go, Python and Rust under Apache 2.0. The TypeScript package stays at the repository root. Each language has typed feature inputs, guarded execution, exact amounts, hosted/self-hosted URLs, examples and loopback HTTP tests.
| Language | Package and setup | | --- | --- | | TypeScript | This directory - ESM, CommonJS and declarations | | Go | go/README.md - standard library, context cancellation | | Python | python/README.md - Python 3.10+, standard library, typed inputs | | Rust | rust/README.md - blocking reqwest, serde types |
Public release packages are available through the installation guide. Python uses the equivalent version 0.2.0a5. The guide selects a verified registry release or a direct PROXIMUS package URL for each language.
Platform APIs
Use the platform SDK for chat, agents, testing and workspace APIs. This specialized package retains its review contract and execution guards. See the API reference for current public operations and required scopes.
Contributing
Bug reports, examples and pull requests are welcome. Read CONTRIBUTING.md to get started and SECURITY.md to report a vulnerability.
License
Copyright 2026 PROXIMUS Research Labs Foundation. The SDK is licensed under Apache 2.0, which permits integration, modification and commercial use subject to its terms. The license grants permission to use the code, it does not transfer copyright or grant rights to PROXIMUS trademarks. Hosted services have separate access and pricing terms. See LICENSE and NOTICE.
Payment fee estimates
Use estimatePaymentFees to calculate the PROXIMUS curve, partner fees and a network-cost reserve in exact atomic units. prepareAndExecutePayment calls your existing provider to prepare the complete unsigned payment, reviews that final action and invokes execution once after authorization. Include every fee recipient and amount before review.
The same workflow is available as estimate_payment_fees and prepare_and_execute_payment in Python and Rust, and EstimatePaymentFees and PrepareAndExecutePayment in Go. Amounts use integer strings. The estimate does not sign a transaction or collect a payment.
See payment integration for arguments, return values, examples and supported execution responsibilities.
