Skip to main content

はじめに

支払いおよびサブスクリプションイベントが発生した際に、トランザクションメールを自動送信します。支払い確認、サブスクリプションの更新、失敗通知を、ミドルウェアサーバーなしでKeplars経由で送信できます。Dodo PaymentsがJavaScript transformation handlerを使用してKeplars APIを直接呼び出します。
このintegrationではKeplars API keyで認証します。Keplars dashboardのSettings → API KeysでAPI keyを確認し、Domainsでsender domainまたはaddressを検証してください。

はじめに

1

Open the Webhook Section

Dodo Payments dashboardでDeveloper → Webhooksに移動し、Add endpointをクリックします。
2

Select Keplars

IntegrationでKeplarsを選択します。テンプレートによってKeplars API URLとtransformation codeが入力されます。
Keplars integration cardを選択
3

Enter API Key

Keplars API keyをAPI keyに貼り付けます。Dodo PaymentsはすべてのrequestでBearer tokenとして送信します。Subscribed eventsで、メールを送信するイベントを選択します。
Keplars API URL、API Keyを入力し、イベントを購読
4

Configure Transformation

Transformation codeで、Keplars向けにメールをフォーマットするコードを編集します。プレースホルダーのsender addressとtemplate IDsを自分のものに置き換えます。
5

Test & Create

Test this codeでevent typeを選択し、Simulateをクリックして、sample payloadに対してtransformationを実行します。次にCreate endpointをクリックして、メールの送信を開始します。
6

Done

Dodo Paymentsのイベントによって、Keplars経由でトランザクションメールが送信されるようになりました。

変換コード例

各handlerはwebhook.urlをKeplarsのhigh-priority send endpointに設定し、webhook.payloadをKeplars requestに書き換えます。Dodo PaymentsはAPI keyをBearer tokenとして追加します。payments@mail.yourdomain.comを検証済みのsenderに置き換え、your-keplars-*-template-idをtemplate IDsに置き換えてください。
toは、recipientが1人だけの場合でもarrayでなければなりません。template_idを使用する場合は、テンプレートから提供されるため、subjectまたはbodyも送信しないでください。

支払い確認メール

payment_succeeded.js

支払い失敗通知

payment_failed.js

サブスクリプション開始メール

subscription_active.js

サブスクリプションキャンセルメール

subscription_cancelled.js

ヒント

  • 配信到達率を高めるため、検証済みのdomainまたはaddressから送信します。
  • 各メールのブランドとメッセージを統一できるよう、event typeごとにKeplars templateを1つ作成します。
  • paramsにname、amount、payment IDなどのcustomer dataを渡して、各メールをパーソナライズします。
  • まずsandbox modeでテストします。Keplarsはsandbox送信を配信せず、Test Inboxに取り込みます。

トラブルシューティング

  • KeplarsのSettings → API Keysで、API keyが正しく、有効になっていることを確認します。
  • sender domainまたはaddressが検証済みであることを確認します。
  • Dodo Payments dashboardで、Developer → WebhooksのLogsタブからmessageを開きます。各delivery attemptに、Keplarsからのraw error responseが表示されます。
  • handler内のtemplate_idは、Keplars accountで有効なtemplateと一致している必要があります。Keplars dashboardでIDとtemplateが有効であることを確認します。
  • 各handlerはwebhook.eventTypeを確認し、eventが一致しない場合はwebhookを変更せずに返します。endpointのSubscribed eventsに、必要なイベントのみが含まれていることを確認します。
最終更新日 2026年9月26日