> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dodopayments.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Close CRM

> Dodo Payments 데이터를 Close CRM과 동기화하여 리드를 추적하고 판매 파이프라인을 관리합니다.

## 소개

결제 데이터를 Close CRM에 직접 연결하여 원활한 리드 관리 및 판매 추적을 수행하세요. 성공적인 결제로부터 자동으로 연락처와 기회를 생성하여 판매 팀이 수익 창출 활동에 대한 정보를 유지할 수 있도록 합니다.

<Info>
  이 통합을 사용하려면 적절한 권한이 있는 Close CRM API 키가 필요합니다.
</Info>

## 시작하기

<Steps>
  <Step title="Open the Webhook Section">
    Dodo Payments 대시보드에서 <b>Webhooks → + Add Endpoint</b>로 이동하고 통합 드롭다운을 확장합니다.

    <Frame>
      <img src="https://mintcdn.com/dodopayments/slbAEdrLLwKHfaRf/images/integrations/close-crm.png?fit=max&auto=format&n=slbAEdrLLwKHfaRf&q=85&s=bd462e078ea95d7853eb066cdbaebb0f" alt="Add Endpoint and integrations dropdown" style={{ maxHeight: '500px', width: 'auto' }} width="1710" height="948" data-path="images/integrations/close-crm.png" />
    </Frame>
  </Step>

  <Step title="Select Close CRM">
    <b>Close CRM</b> 통합 카드를 선택하세요.
  </Step>

  <Step title="Enter API Key">
    구성에서 Close CRM API 키를 입력하세요.
  </Step>

  <Step title="Configure Transformation">
    결제 데이터를 Close CRM 객체에 매핑하도록 변환 코드를 수정하세요.
  </Step>

  <Step title="Test & Create">
    샘플 페이로드로 테스트한 후 동기화를 활성화하려면 <b>Create</b>를 클릭하세요.
  </Step>

  <Step title="Done!">
    🎉 결제 이벤트가 이제 Close CRM에서 레코드를 자동으로 생성/업데이트합니다.
  </Step>
</Steps>

## 변환 코드 예제

### 결제에서 연락처 생성

```javascript create_contact.js icon="js" expandable theme={null}
function handler(webhook) {
  if (webhook.eventType === "payment.succeeded") {
    const p = webhook.payload.data;
    webhook.url = "https://api.close.com/api/v1/contact/";
    webhook.payload = {
      name: p.customer.name,
      emails: [p.customer.email],
      phones: [p.customer.phone || ''],
      custom: {
        payment_amount: (p.total_amount / 100).toFixed(2),
        payment_method: p.payment_method || '',
        dodo_customer_id: p.customer.customer_id
      }
    };
  }
  return webhook;
}
```

### 구독에서 기회 생성

```javascript create_opportunity.js icon="js" expandable theme={null}
function handler(webhook) {
  if (webhook.eventType === "subscription.active") {
    const s = webhook.payload.data;
    webhook.url = "https://api.close.com/api/v1/opportunity/";
    webhook.payload = {
      lead_id: s.customer.customer_id,
      value: (s.recurring_pre_tax_amount / 100).toFixed(2),
      value_period: s.payment_frequency_interval,
      title: `Subscription - ${s.product_id}`,
      custom: {
        subscription_id: s.subscription_id,
        billing_frequency: s.payment_frequency_interval,
        next_billing: s.next_billing_date
      }
    };
  }
  return webhook;
}
```

## 팁

* Close CRM의 API 문서를 사용하여 필드 매핑을 이해하세요
* 결제 특정 데이터를 위한 사용자 정의 필드를 포함하세요
* 구독 금액을 기회 값에 매핑하세요
* 적절한 리드 연관을 위해 고객 ID를 사용하세요

## 문제 해결

<AccordionGroup>
  <Accordion title="Records not created in Close CRM">
    * API 키에 쓰기 권한이 있는지 확인
    * 필수 필드가 포함되어 있는지 확인
    * 이메일 형식이 유효한지 확인
    * Close CRM API 속도 제한을 검토
  </Accordion>

  <Accordion title="Transformation errors">
    * JSON 구조가 Close CRM API 형식과 일치하는지 확인
    * 모든 필수 필드가 있는지 확인
    * 필드 이름이 Close CRM 스키마와 정확히 일치하는지 확인
  </Accordion>
</AccordionGroup>
