Lee ChanyangBackend Engineer

Language

← Back to project list

Video Payments & Subscriptions

LiveGlobal

Individual Video Purchases & Subscriptions

This service connects language, currency, Korean and international payment gateways, and viewing access in one backend flow so existing offline customers and online users can buy and subscribe to content in the same video center. By reusing the order, payment, and access models and payment gateway/Outbox patterns validated in a preceding platform, I deployed the video center's payment and subscription backend to production within 3 weeks of receiving the requirements document.

Company
Korea Institute of Psychological Education
Service
Video Center
Period
June–July 2026 · 3 weeks
Role
Backend Engineer
Responsibility
User/Admin API · DB · Async/Batch · AWS Ops
Team
BE 1 · FE 2 · Designer 1 · PM/Ops 1
  • NestJS
  • TypeScript
  • PostgreSQL
  • Prisma
  • BullMQ
  • Redis
  • Outbox
  • AWS
  • NICEPAY · Payletter (PG)
  • Claude · Codex

Project Overview

I brought existing offline and online customers into one video center service

The core challenge was connecting an offline-centered customer base and a separate online usage flow into one video content service.

With foreign users also making up part of the customer base, this transition required a service structure designed for a global audience from the outset, beyond simply adding payments for users in Korea.

By reusing the order, payment, and access models and payment gateway/Outbox patterns validated in a preceding platform, I deployed the video center's payment and subscription backend to production within 3 weeks of receiving the requirements document.

I owned the backend end to end, building the flow from video discovery to viewing through individual purchases or monthly subscriptions. Detailed responsibilities and the constraints that needed to be addressed first are summarized below under Ownership / Constraints, with implementation evidence organized by phase in the Implementation Timeline.

Ownership

My direct responsibilities

  • Refined product, pricing, and subscription policies with product planning and operations, and shared payment and subscription contracts with the frontend through Swagger/OpenAPI
  • Designed models for video and subscription products, localized display and pricing currencies, individual-video entitlements, and viewing access
  • Implemented order, billing, payment, and access use cases for individual purchases and monthly subscriptions
  • Implemented NICEPAY and Payletter integration, initial payments, renewals, retries, plan changes, end-of-period cancellation, and resumption
  • Established recovery paths for internal failures after payment gateway approval without charging again, and configured the PostgreSQL, Redis, and AWS operating environment

Constraints

Constraints to address first

  • Because one video was the content unit, reusing the existing course/section hierarchy would have made products, purchases, and viewing access unnecessarily complex.
  • Users in Korea and abroad shared the service, so localized display, pricing currencies, product codes, access rights, and payment state could not be mixed into one model.
  • Individual purchases and monthly subscriptions differed in purchase history, billing history, and the criteria for granting and ending access, so they could not be merged into one flow.
  • NICEPAY and Payletter differed in approval and callback behavior, but the service needed to handle them with the same internal payment states and processing criteria.
  • Duplicate billing and internal finalization failures after payment gateway approval needed recoverable states that did not require charging users again.

Implementation Timeline

The implementation sequence for extending existing customers into online video purchases and subscriptions

Considering offline customers, existing online users, and international users together, I divided the work into video models, language and currency display, individual purchases, initial subscriptions, renewal recovery, and change/cancellation policies. Select a phase to see the problem identified at that stage and how it led to the architecture and verification criteria.

Phase 01 · Video Products & Access Policies

Video Products & Access Policies

Phase 01

I reframed video products around “Can I watch this now?” rather than treating them as items for sale

Because a single video was the service's content unit, reusing the existing course hierarchy would have made products, purchases, and viewing access overly complex. I separated video products, subscription products, translation records, and access policies so viewing eligibility could be evaluated at each request.

Video Access Policy RelationshipsMermaid

Rendering the diagram.

  1. 01

    Requirements Analysis

    I used one video as the content unit and separated free, subscription, and special access types, localized display names, and video-length conditions for each subscription product into distinct requirements.

    • The user's question was closer to “Can I watch this video now?” than “What tier is this product?”
    • Even for the same video, the product name, subtitle, description, category, and keywords needed to vary by requested language, while access decisions had to remain independent of translated wording.
    • Subscription guidance in a listing and actual playback permission are evaluated at different request times, so I did not use the same response value as the authoritative source of access rights.
  2. 02

    Domain Modeling

    I separated video and subscription products under a shared product header, with language-specific product, category, and keyword records responsible for display text.

    • Video products retain length, category, and access type; subscription products represent monthly subscription offerings and their pricing and billing relationships.
    • Category codes remain authoritative while localized names reside in separate records, allowing URLs, filters, and banner targets to use stable codes while the interface uses translated text.
    • For keywords, I separated canonical search terms from localized display names and aliases rather than mixing tag display and user-query mapping in one model.
    • Access is evaluated through video-length policy rules rather than subscription product names or tier names.
  3. 03

    Architecture Decisions

    Instead of bulk-updating user subscription data when policies change, the system reevaluates the currently active policy for each list, detail, and playback request.

    • Operators can change access conditions without bulk-migrating existing subscription records.
    • I documented the tradeoff that historical auditing of policy changes would require separate policy versions or evaluation logs.
  4. 04

    Implementation & Verification

    I verified the subscription access evaluator, user-state assembly in list/detail responses, localized product/category/keyword responses, and access revalidation before recording viewing progress through code and tests.

    • Video-length conditions use an Evaluator that compares the duration policy value with the current video's length.
    • Detail responses assemble product text, categories, and keyword display text in the current requested language.
    • Subscription products without an active access policy are excluded from public offerings, and internal duration-limit values are not directly exposed in responses.
  5. 05

    Operations & Recovery

    Access inquiries are investigated by checking video access type, active subscriptions, individual-video entitlements, active access policies, and viewing progress records in order.

    • Separate policy-correction commits from July 2026 verify that access decisions were adjusted again after requirements changed.
    • I do not report operational metrics such as exact access-decision failure rates because publicly shareable original logs are unavailable.

Project Infrastructure

I separated shared infrastructure into API, Worker, database, Redis, and external payment gateway boundaries

I separately documented the execution boundaries and deployment checkpoints needed to operate payments and subscriptions.

Payment & Subscription Infrastructure ArchitectureMermaid

Rendering the diagram.

  • I separated the API from renewal and Outbox Workers, assigning order, billing, payment, and access state to PostgreSQL and asynchronous execution and retries to Redis and BullMQ.
  • GitHub Actions creates deployment artifacts, with S3, CodeDeploy, and PM2 updating API and Worker processes.
  • External gateway calls run outside database transactions, while internal state finalization uses short transactions and Worker reprocessing boundaries.
  • After deployment, readiness and the core paths for individual purchases, initial subscriptions, and renewal Workers served as verification criteria.

Outcome

Verifiable outcomes

  • Separated video access policies from individual-video entitlements so the server determines viewing eligibility at request time
  • Connected NICEPAY and Payletter individual payments and initial subscriptions through shared order, payment, and subscription models
  • Implemented the subscription lifecycle spanning initial payments, renewals, plan changes, end-of-period cancellation, and resumption
  • Protected against duplicate charges for the same billing cycle through row locks, cycle claims, and uniqueness constraints
  • Implemented activation and renewal reprocessing paths that recover from internal finalization failures after gateway approval without another gateway call

Limitations

Limitations and unimplemented scope

  • Full refunds for individual purchases are implemented, but concurrent refund claims and automatic recovery from internal finalization failure after successful gateway cancellation need additional hardening.
  • Partial refunds and subscription refunds were outside the implementation scope.
  • The policy model contains a structure for calculating price differences, but it was not applied in the final product policy.
  • Uncertain states such as lost Payletter webhooks or gateway approval request timeouts require provider retransmission or manual verification. An automatic reconciliation layer remains a separate improvement candidate.
  • I do not report gateway-specific operational success rates or throughput as quantitative outcomes because publicly shareable operational evidence is unavailable.