@seoulcommerce/korea-checkout-sdk
v0.1.1
Published
Browser SDK for SeoulCommerce Korea Checkout payment sessions and Inicis launch flows.
Downloads
19
Maintainers
Readme
@seoulcommerce/korea-checkout-sdk
Browser and application SDK for the SeoulCommerce Korea Checkout payment session flow.
This package gives merchants a small client for:
- creating payment sessions
- resolving launch contracts
- fetching Inicis launch payloads
- launching the Inicis browser flow
- polling for normalized terminal payment state
Install
npm install @seoulcommerce/korea-checkout-sdkQuick Start
import {
HttpPaymentSdkClient,
prepareInicisPaymentFlow,
launchInicisInBrowser,
waitForTerminalResult,
} from '@seoulcommerce/korea-checkout-sdk'
const client = new HttpPaymentSdkClient('https://your-payment-api.example.com')
const { session, connectorLaunch } = await prepareInicisPaymentFlow(client, {
merchantId: 'merchant-id',
storeId: 'store-id',
idempotencyKey: `checkout-${Date.now()}`,
platform: {
type: 'magento',
cartId: 'masked-cart-id',
},
customer: {
email: '[email protected]',
},
amount: {
value: 1000,
currency: 'KRW',
},
paymentSelection: {
gateway: 'inicis',
method: 'inipay_gateway',
},
returnUrls: {
success: 'https://store.example.com/checkout/success',
failure: 'https://store.example.com/checkout/failure',
cancel: 'https://store.example.com/checkout/cancel',
},
device: {
channel: 'web',
isMobile: false,
userAgent: navigator.userAgent,
},
})
await launchInicisInBrowser(client, connectorLaunch)
const terminalResult = await waitForTerminalResult(client, session.paymentSessionId)
console.log(terminalResult)Main Exports
HttpPaymentSdkClientprepareInicisPaymentFlow()launchPaymentSession()pollPaymentSessionUntilTerminal()waitForTerminalResult()launchInicisInBrowser()installInicisBrowserHelpers()installInicisOverlayStyle()loadExternalScriptOnce()
Notes
- The SDK expects a SeoulCommerce payment API backend that implements the payment session and Inicis connector endpoints.
launchInicisInBrowser()is intended for browser environments.- The package includes its public request/response types, so consumers do not need a separate contracts package.
