@ker-dtsmart/remote-pay-cloud-sdk
v0.0.4
Published
Cross-platform (Windows/Android/iOS) remote pay cloud SDK — device pairing over HTTP + SSE, framework-agnostic.
Readme
@ker-dtsmart/remote-pay-cloud-sdk
Cross-platform (Windows / Android / iOS) remote-pay cloud SDK. Pairs a POS
client with a payment host over HTTP (pairing + command exchange) and
SSE (EventSource) for live results — pure web standard APIs, so it runs in
any modern browser/WebView regardless of OS.
This is the framework-agnostic transport extracted from remote-pay-demo. It is
the cloud sibling of the native remote_pay bridge: same payment data flow, but
the transport is HTTP + SSE instead of a native Android bridge.
Install
# Local file dependency (current setup)
npm i @ker-dtsmart/remote-pay-cloud-sdk@file:../remote-pay-cloud-sdkUsage
import { PaymentPairingSdk, BrowserStorageAdapter } from '@ker-dtsmart/remote-pay-cloud-sdk';
const sdk = new PaymentPairingSdk({
apiBaseUrl: 'https://mdm.bamboopay-stage.com',
storage: new BrowserStorageAdapter(), // persist session in localStorage
debug: true,
});
// 1. Pair (auto-connects the SSE stream)
await sdk.pairDevice({ hostEpi, clientEpi, pairingCode, clientId });
// 2. Listen for results
sdk.on('payment_flow', (e) => { /* tip / card / signature / receipt steps */ });
sdk.on('payment_result', (r) => { /* final outcome */ });
sdk.on('transaction_response', (r) => { /* void / refund / get result */ });
// 3. Drive the order
await sdk.createOrder(orderData);
await sdk.finishOrder(orderData);
// 4. Post-payment ops
await sdk.voidTransaction({ requestId, transactionId });
await sdk.refundTransaction({ requestId, transactionId, amount });Build
npm install
npm run build # emits dist/index.js (ESM), dist/index.cjs (CJS), dist/index.d.tsPublic API
PaymentPairingSdk— pairing, SSE stream lifecycle, order + transaction commands.- Storage adapters:
BrowserStorageAdapter,MemoryStorage(+StorageAdapterinterface). - Errors:
PairingError,ApiError,StreamError,ValidationError,BaseError. - Types:
SdkConfig,PairingResponse,OrderData,OrderItem,PaymentResult,PairDataExchangeEvent,TransactionActionResponse,TransactionResultDto,GetTransactionRequest,VoidTransactionRequest,RefundTransactionRequest,CommandResponse,StreamInfo.
