Skip to main content

Tích hợp API

Tất cả HTTP calls nằm trong src/services/api.ts.

Base URL: {REACT_APP_API_BASE_URL} — mặc định http://localhost:3001/api

Auth header: Authorization: Bearer {shop_auth_token}

401 handling: Axios interceptor dispatch auth:unauthorized → logout.


Auth & Account

MethodEndpointFunctionMục đích
POST/portal-auth/loginportalLoginLogin shop (hoặc cashier — bị chặn trên UI)
POST/shop-auth/loginloginWithUsernameOrEmailLogin shop (legacy)
POST/shop-auth/verify-otpverifyPortalLoginOtpXác minh OTP login
POST/shop-auth/forgot-password/request-otprequestForgotPasswordOtpBước 1 quên mật khẩu
POST/shop-auth/forgot-password/verify-otpverifyForgotPasswordOtpBước 2 quên mật khẩu
POST/shop-auth/forgot-password/confirmconfirmForgotPasswordResetBước 3 đặt mật khẩu mới
GET/shop/mefetchShopMeProfile shop
PATCH/shop/settings/two-factorpatchPortalTwoFactorBật/tắt 2FA
PATCH/shop/settings/low-balance-warningpatchShopLowBalanceWarningCảnh báo số dư thấp
POST/shop/verify/send-otpsendShopVerificationOtpGửi OTP xác minh shop
POST/shop/verify/confirmconfirmShopVerificationOtpXác nhận OTP shop

Dashboard & Credits

MethodEndpointFunctionMục đích
GET/shop/dashboardfetchDashboardSố dư, player count, flags
POST/shop/credits/purchasepurchaseShopCreditsMua credits (redirect payment)
POST/shop/convert-balance-to-creditsconvertBalanceToCreditsUSD → credits
GET/shop/payments/zeroxprocessing/static-walletslistZeroxStaticWalletsDanh sách ví crypto tĩnh
POST/shop/payments/zeroxprocessing/static-wallets/initinitZeroxStaticWalletsKhởi tạo ví crypto

Players

MethodEndpointFunctionMục đích
GET/shop/playersfetchShopPlayersDanh sách player
POST/shop/playerscreateShopPlayerTạo player mới
GET/shop/players/:idfetchShopPlayerChi tiết player
GET/shop/players/lookuplookupPlayerByPhoneLookup theo phone
POST/shop/players/register-initiateregisterPlayerInitiateĐăng ký OTP — bước 1
POST/shop/players/register-resendresendPlayerRegistrationOtpGửi lại OTP đăng ký
POST/shop/players/register-verifyverifyPlayerRegistrationĐăng ký OTP — bước 2
POST/shop/players/:id/creditspostShopPlayerCreditsDeposit/deduct credits
POST/shop/players/:id/banbanShopPlayerBan player
POST/shop/players/:id/unbanunbanShopPlayerUnban player
POST/shop/players/:id/credentials/reissuepostShopPlayerReissueCredentialsCấp lại credentials
POST/shop/players/:id/send-verificationsendPlayerVerificationGửi OTP player
POST/shop/players/:id/verifyverifyPlayerVerificationXác minh OTP player
GET/shop/players/:id/transactionsfetchPlayerTransactionsLịch sử giao dịch player

Transactions & Ledger

MethodEndpointFunctionMục đích
GET/shop/transactionsfetchShopWalletTransactionsCredit ledger
GET/shop/transactions/:idfetchShopCreditTransactionByIdChi tiết giao dịch credits
GET/shop/transactions/exportexportShopWalletTransactionsExport CSV credits
GET/shop/online-balance/ledgerfetchShopOnlineBalanceLedgerUSD ledger
GET/shop/online-balance/ledger/:idfetchShopUsdLedgerEntryByIdChi tiết USD entry
GET/shop/online-balance/ledger/exportexportShopOnlineBalanceLedgerExport CSV USD

Withdrawals

Player withdrawals (shop duyệt)

MethodEndpointFunctionMục đích
GET/shop/withdrawals/pendingfetchPendingWithdrawalsForApprovalDanh sách chờ duyệt
GET/shop/withdrawalsfetchShopWithdrawalsLịch sử rút tiền
POST/shop/withdrawals/:id/approveapproveShopWithdrawalDuyệt
POST/shop/withdrawals/:id/rejectrejectShopWithdrawalTừ chối

Shop USD withdrawal

MethodEndpointFunctionMục đích
GET/shop/online-balance/withdrawals/otp/eligibilityfetchShopWithdrawalOtpEligibilityKiểm tra OTP
POST/shop/online-balance/withdrawals/otp/sendsendShopWithdrawalOtpGửi OTP
POST/shop/online-balance/withdrawals/otp/verifyverifyShopWithdrawalOtpXác minh OTP
POST/shop/online-balance/withdrawalscreateShopOnlineBalanceWithdrawalTạo rút USD
GET/shop/online-balance/withdrawals/feefetchShopOnlineBalanceWithdrawalFeePreview phí
GET/shop/portal-withdrawal-limitsfetchShopPortalWithdrawalLimitsGiới hạn rút

Provider fees & Payment

MethodEndpointFunctionMục đích
GET/shop/provider-feesfetchProviderFeeConfigsCấu hình phí shop
PUT/shop/provider-feesupsertShopProviderFeeConfigsCập nhật phí
GET/payment/provider-fee-rategetProviderFeeRateTỷ lệ phí
GET/payment/supported-methodsfetchSupportedMethodsPhương thức hỗ trợ (public)

Cashiers & Fraud

MethodEndpointFunctionMục đích
GET/shop/cashiersfetchShopCashiersDanh sách cashier
POST/shop/cashierscreateShopCashierTạo cashier
PATCH/shop/cashiers/:id/suspendsuspendShopCashierSuspend
PATCH/shop/cashiers/:id/terminateterminateShopCashierTerminate
GET/shop/cashiers/:id/reportfetchCashierReportBáo cáo
GET/shop/cashiers/:id/shiftsfetchCashierShiftsLịch sử shifts
GET/shop/fraud-indicatorsfetchFraudIndicatorsFraud cashier
GET/shop/player-fraud-indicatorsfetchPlayerFraudIndicatorsFraud player (list)
GET/shop/player-fraud-indicators/:idfetchPlayerFraudIndicatorDetailChi tiết
GET/shop/player-fraud-indicators/transaction/:id/profit-analysisfetchPlayerFraudWithdrawalAnalysisPhân tích profit
POST/shop/player-fraud-indicators/:id/resolveresolvePlayerFraudIndicatorResolve indicator

Communication & Domain

MethodEndpointFunctionMục đích
GET/shop/broadcastsfetchShopBroadcastsDanh sách broadcast
POST/shop/broadcasts/:id/ackackShopBroadcastAcknowledge broadcast
POST/shop/broadcastscreateShopBroadcastGửi broadcast
GET/shop/in-app-popups/unseenfetchShopInAppPopupsUnseenPopup chưa xem
POST/shop/in-app-popups/:id/seenmarkShopInAppPopupSeenĐánh dấu đã xem
POST/shop/in-app-popups/:id/never-againmarkShopInAppPopupNeverAgainKhông hiện lại
POST/shop/in-app-popupscreateShopInAppPopupGửi popup
GET/shop/kiosk-domainfetchShopKioskDomainLấy subdomain
POST/shop/kiosk-domaincreateShopKioskDomainTạo subdomain
PATCH/shop/kiosk-domainpatchShopKioskDomainSửa subdomain

Cashier API (client riêng)

cashierClient dùng token cashier_auth_token. Các function này tồn tại trong api.ts nhưng không phải flow chính của Shop Portal — cashier dùng Cashier App.

MethodEndpointFunction
POST/cashier-auth/logincashierLogin
GET/cashier/mefetchCashierMe
POST/cashier/shifts/opencashierOpenShift
POST/cashier/shifts/closecashierCloseShift
GET/cashier/playerscashierFetchPlayers
POST/cashier/playerscashierCreatePlayer
POST/cashier/players/:id/depositcashierDepositCredits
POST/cashier/players/:id/redeemcashierRedeemCredits