Skip to main content

Checkout API Route

서버 route를 사용하여 Dodo Payments checkout을 Nuxt 앱에 통합합니다.

Customer Portal API Route

고객이 Nuxt 서버 route를 통해 구독 및 세부 정보를 관리할 수 있도록 합니다.

Webhooks API Route

Nuxt에서 Dodo Payments webhook 이벤트를 안전하게 수신하고 처리합니다.

개요

이 가이드에서는 공식 Nuxt 모듈을 사용하여 Dodo Payments을(를) Nuxt 애플리케이션에 통합하는 방법을 설명합니다. checkout, customer portal 및 webhook API route를 설정하고 환경 변수를 안전하게 관리하는 방법을 알아봅니다.

설치

1

Install the Nuxt module

프로젝트 루트에서 다음 명령을 실행합니다:
2

Register the module in nuxt.config.ts

@dodopayments/nuxtmodules 배열에 추가하고 다음과 같이 구성합니다:
nuxt.config.ts
.env 파일이나 secret을 version control에 절대 commit하지 마세요.

API Route Handler 예시

Nuxt의 모든 Dodo Payments 통합은 server/routes/api/ 디렉터리의 server route를 통해 처리됩니다.
이 handler를 사용하여 Dodo Payments checkout을 Nuxt 앱에 통합합니다. static (GET), dynamic (POST) 및 session (POST) 결제 flow를 지원합니다.
productId가 누락되었거나 유효하지 않으면 handler가 400 response를 반환합니다.

Checkout Route Handler

Dodo Payments은 웹사이트에 결제를 통합하기 위한 세 가지 결제 flow를 지원하며, 이 어댑터는 모든 유형의 결제 flow를 지원합니다.
  • Static Payment Links: 빠르고 no-code 결제 수집을 위해 즉시 공유할 수 있는 URL입니다.
  • Dynamic Payment Links: API 또는 SDK를 사용하여 사용자 지정 세부 정보가 포함된 결제 link를 programmatically 생성합니다.
  • Checkout Sessions: 사전 구성된 product cart 및 customer 세부 정보로 안전하고 사용자 지정 가능한 checkout experience를 생성합니다.

지원되는 Query Parameters

string
필수
Product identifier(예: ?productId=pdt_nZuwz45WAs64n3l07zpQR)입니다.
integer
Product의 수량입니다.
string
Customer의 전체 이름입니다.
string
Customer의 이름입니다.
string
Customer의 성입니다.
string
Customer의 email address입니다.
string
Customer의 국가입니다.
string
Customer의 address line입니다.
string
Customer의 도시입니다.
string
Customer의 state/province입니다.
string
Customer의 zip/postal code입니다.
boolean
전체 이름 field를 비활성화합니다.
boolean
이름 field를 비활성화합니다.
boolean
성 field를 비활성화합니다.
boolean
Email field를 비활성화합니다.
boolean
Country field를 비활성화합니다.
boolean
Address line field를 비활성화합니다.
boolean
City field를 비활성화합니다.
boolean
State field를 비활성화합니다.
boolean
Zip code field를 비활성화합니다.
string
결제 currency를 지정합니다(예: USD).
boolean
Currency selector를 표시합니다.
integer
결제 금액을 지정합니다(예: $10.00의 경우 1000).
boolean
Discount field를 표시합니다.
string
metadata_로 시작하는 모든 query parameter는 metadata로 전달됩니다.
productId가 누락되면 handler가 400 response를 반환합니다. 유효하지 않은 query parameter도 400 response를 반환합니다.

Response Format

Static checkout은 checkout URL이 포함된 JSON response를 반환합니다:

Response Format

Dynamic checkout은 checkout URL이 포함된 JSON response를 반환합니다:
Checkout sessions는 일회성 구매와 subscription 모두에 대해 전체 결제 flow를 처리하는 더욱 안전한 hosted checkout experience를 제공하며, 완전한 사용자 지정 제어 기능을 지원합니다.자세한 내용과 지원되는 field의 전체 목록은 Checkout Sessions Integration Guide를 참조하세요.

Response Format

Checkout sessions는 checkout URL이 포함된 JSON response를 반환합니다:

Customer Portal Route Handler

Customer Portal Route Handler를 사용하면 Dodo Payments customer portal을 Nuxt 애플리케이션에 원활하게 통합할 수 있습니다.

Query Parameters

string
필수
portal session의 customer ID입니다(예: ?customer_id=cus_123).
boolean
true로 설정하면 고객에게 portal link가 포함된 email을 보냅니다.
customer_id가 누락되면 400을 반환합니다.

Webhook Route Handler

  • Method: POST request만 지원됩니다. 다른 method는 405를 반환합니다.
  • Signature Verification: webhookKey를 사용하여 webhook signature를 확인합니다. verification에 실패하면 401을 반환합니다.
  • Payload Validation: Zod로 validation합니다. 유효하지 않은 payload에는 400을 반환합니다.
  • Error Handling:
    • 401: 유효하지 않은 signature
    • 400: 유효하지 않은 payload
    • 500: verification 중 internal error
  • Event Routing: payload type에 따라 적절한 event handler를 호출합니다.

지원되는 Webhook Event Handler


LLM용 Prompt

마지막 수정일 2026년 7월 31일