Ignitech Modules - Payment and Checkout Components
npm install @ignitech/modules-paymentbash
npm install @ignitech/modules-payment @ignitech/modules-utils
`
Lưu ý: @ignitech/modules-utils là dependency bắt buộc.
Sử dụng
$3
`tsx
import { PaymentMethod } from '@ignitech/modules-payment';
orderId="order-123"
websiteId="website-123"
apiBaseUrl="https://api.example.com"
onSuccess={(paymentCode) => console.log('Success:', paymentCode)}
/>
`
$3
`tsx
import { CheckoutFlow } from '@ignitech/modules-payment';
websiteId="website-123"
apiBaseUrl="https://api.example.com"
currency="VND"
onComplete={(data) => console.log('Checkout complete:', data)}
/>
`
Components
- PaymentMethod - Payment method selection và processing
- CheckoutFlow - Complete checkout flow (one-page)
- ShippingAddress - Shipping address form
- ShippingMethod - Shipping method selection
- CartItemsList - Cart items display
- OrderSummary - Order summary display
Hooks
- usePayment - Hook để quản lý payment state
- useVietnameseAddress - Hook để lấy địa chỉ Việt Nam
Services
- PaymentService - Service để xử lý payment
- OrderService - Service để quản lý orders
Dependencies
- @ignitech/modules-utils: Shared utilities và types
- zod: ^3.22.4
Peer Dependencies
- react: ^18.0.0
- react-dom`: ^18.0.0