This is a Vue 3-based demo application that demonstrates how to integrate the Cobo Checkout SDK.
This project simulates how a customer/PSP integrates Cobo Checkout through iframe. Main features include:
- Direct OAuth authentication API calls from frontend
- Automatic token expiration and refresh logic handling
- Embedding locally running Checkout application through iframe
- Using postMessage for iframe communication
- Complete demonstration of order creation and status change process
Before running this demo, please ensure:
- Frontend has correctly configured Checkout SDK environment (please modify iframeUrl in
src/views/CheckoutDemo.vue
) - Backend has implemented logic to obtain token through API Key (can temporarily mock data in
src/services/authService.ts
)
# Install dependencies
pnpm install
# Start development server
npm run dev
- 【demo】Enter transaction amount and order number (or use auto-generated ones)
- 【demo】Click "Start Checkout" button to initiate checkout process (involves iframe communication, passing order-related information to SDK)
- 【sdk】After iframe initialization is complete, it will request demo to get token (involves iframe communication, passing token to SDK)
- 【sdk】Complete payment process in iframe
src/services/authService.ts
- Authentication service, handles token acquisition and refreshsrc/services/iframeService.ts
- iframe communication servicesrc/types/index.ts
- Type definitionssrc/views/CheckoutDemo.vue
- Main demo component