Univapay Integration: Implementation Plan
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Integrate Univapay as a marketplace payment provider with per-content control and automated onboarding.
Architecture: A multi-tenant “Connect” model using a central Laravel trait for API communication. It allows suppliers to enable Univapay for specific services, mirroring the existing Stripe Connect architecture.
Tech Stack: Laravel (Backend), Next.js (Frontend), Univapay PHP SDK & JS Widget.
Task 1: Backend Foundation & SDK Setup
Files:
Modify:
yoyacoo_be/common/composer.jsonCreate:
yoyacoo_be/common/config/univapay.phpStep 1: Add Univapay SDK
Add"univapay/univapay-php": "^1.0"to therequiresection ofyoyacoo_be/common/composer.json.Step 2: Run composer update
Runcomposer update univapay/univapay-phpin theyoyacoo_be/commondirectory.Step 3: Add configuration
Createconfig/univapay.phpto map environment variables for Platform ID and Secret Key.
Task 2: Database Migrations
Files:
Create:
yoyacoo_be/common/database/migrations/YYYY_MM_DD_create_user_payment_univapays_table.phpModify:
yoyacoo_be/common/database/migrations/YYYY_MM_DD_add_univapay_columns_to_orders_table.phpStep 1: Create
user_payment_univapaystable
Define schema:id,user_id(foreign),store_id,api_key,secret_key,charges_enabled(bool),status.Step 2: Update
orderstable
Addunivapay_charge_id(string, nullable) andunivapay_status(string, nullable).Step 3: Run migrations
Runphp artisan migrate.
Task 3: Core API Trait (UnivapayPlatform)
Files:
Create:
yoyacoo_be/common/src/Base/Traits/UnivapayPlatform.phpModify:
yoyacoo_be/common/src/Models/UserPaymentSetting.phpStep 1: Implement
createSubStore
Logic to call Univapay’s Store creation endpoint using platform credentials.Step 2: Implement
createCharge
Logic to initiate a charge targeting the user’s specificstore_id.Step 3: Implement
refundCharge
Logic to handle refunds via the Univapay SDK.
Task 4: Supplier Onboarding UI & API
Files:
Create:
yoyacoo_be/user/app/Domains/Account/Usecase/ConnectUnivapayInteractor.phpCreate:
yoyacoo_fe/supplier/src/components/organisms/accounts/index/UnivapayConnectInfo.tsxModify:
yoyacoo_fe/supplier/src/pages/accounts/payment/index.tsxStep 1: Create Backend Onboarding Interactor
Handle the “One-Click Connect” logic: callcreateSubStoreand save credentials.Step 2: Create Frontend Connection Component
BuildUnivapayConnectInfomirroring the existingStripeConnectInfo.tsxlayout.Step 3: Integrate into Settings Page
Place the new component in the main Payment Settings layout.
Task 5: Per-Content Payment Control
Files:
Modify:
yoyacoo_be/common/src/Models/ServicePaymentMethod.phpModify:
yoyacoo_fe/supplier/src/components/organisms/services/ServiceForm.tsxStep 1: Add “Univapay” to allowed payment types
Update Enums and Model logic to recognizeunivapayas a valid payment option.Step 2: Update Service Form UI
Add the “Enable Univapay” checkbox to the service creation/edit form.Step 3: Implement Disabled State Logic
If the user hasn’t connected Univapay in Settings, the checkbox should be disabled with a hint: “Connect Univapay in Settings to enable”.
Task 6: Customer Checkout & Webhooks
Files:
Create:
yoyacoo_be/customer/app/Http/Controllers/UnivapayWebhookController.phpModify:
yoyacoo_fe/customer/src/components/organisms/reservation/PaymentSelection.tsxStep 1: Implement Univapay Widget
Load the Univapay JS SDK and mount the widget when Univapay is selected at checkout.Step 2: Create Webhook Handler
Processcharge.finishedevents. Verify the signature and update the internalOrderstatus.Step 3: Final Verification
Test the complete flow from onboarding to content enablement and customer checkout.