ログイン無料トライアルを開始
Meta Tech Provider

WhatsApp で支払いリンクを自動送信する

WhatsApp で支払いリンクを自動送信するには、支払いに関する質問への返信を、支払いプロバイダーの固定リンクで行うか、メッセージを自社システムに渡します。前者は「pay」や「pix」などの単語をトリガーにします。後者では、システムがその顧客の注文用リンクを作成し、返信として返します。顧客はプロバイダーのページで支払い、支払いが確定するとシステムがチャット内で確認メッセージを送ります。

easyCoexistence は、アプリで管理している WhatsApp Business の番号を、Coexistence を通じて Meta の Cloud API に接続し、その上で自動化を実行します。

20 s

システムがリンクを作成し、返信フィールドに返すまでの制限時間です。

24 hours

Stripe Checkout Session の既定の有効期間です。30 分から 24 時間まで設定できます。

metadata

Stripe は、作成する Checkout Session に Payment Link のメタデータをコピーします。そのため、支払いをチャットまで追跡できます。

Static URL button

変数を含まないボタンのテンプレートは、自動化の「Send a template」ステップで送信できます。

Utility

ユーザーの操作またはリクエストによって送られるテンプレートの、Meta のカテゴリです。販促の意図はありません。

WhatsApp で支払いリンクを自動送信する方法は、どれくらいありますか?

5 つのパターンがあり、コードなしのものから完全自動のものまであります。販売が 1 つの価格や店舗のチェックアウトで足りるなら固定リンクから始め、金額が異なる場合は注文ごとのリンクに移ります。どのパターンでも支払い自体はプロバイダーのページまたはアプリで行われるため、カード番号、PIX 振込、領収書は自動化とその実行ログの外に残ります:

Fixed link by keywordHas keyword + Reply with text holding your Payment Link, PIX key or checkout page
Link in the AI's InstructionsReply with AI sends it, copied exactly, when the customer is ready to pay
A link per orderCall my webhook: your system creates the link and returns it as the reply
Template with a link buttonSend a template with a static URL button, inside or outside the 24 hours
Paid confirmationYour system sends it through the Cloud API when the provider reports payment

キーワードによる固定リンクは、どのように送りますか?

「Start from an example」の下にある「Keyword reply」から始めます。トリガーは「Has keyword」を選び、条件は「Contains」にして、顧客が支払いたいときに使う言葉を設定します。ステップは「Reply with text」を選び、リンクは独立した行に置きます。タップやコピーがしやすくなります。必要なら {{first_name}} を入れます。PIX キーや銀行振込の参照も同じ方法で設定できます。「Contains」は単語の内側も一致するため、「pay」は PayPal や repay にも反応します。これは多くの場合望ましい動作ですが、「link」だけでは無関係なメッセージにも多く反応します。キーワードの自動化は AI アシスタントより先に返信するため、リンクは正確に送られ、言い換えられることはありません。

Keyword reply: words and message (example)
Keywords (Contains): pay, payment, pagar, pagamento, pix, pago, link de pago, checkout

Reply with text:
Hi {{first_name}}! You can pay securely here:
https://buy.stripe.com/test_cN25nr0iZ7bUa7meUY

Prefer PIX? Key: payments@bloomcafe.example
Send the receipt here when you are done and we will confirm.

顧客の準備ができたら、AI がリンクを送れますか?

はい、リンクが「Instructions」に書かれていれば可能です。「Reply with AI」ステップは、Instructions とチャットの内容から返信を書きます。そのため、リンクを Instructions に記載し、いつ送るかのルールと、先に確認すべき順序も書いてください。モデルは与えられた URL をそのままコピーします。また、Instructions に追加したルールで価格の捏造を禁止するため、金額を列挙するか、金額の出所を明記してください。

安全のために次の 2 行を追加してください。モデルがカード番号やパスワードを尋ねることは決してないこと、返金や支払い失敗に関する内容は必ず担当者に回すことです。自動化をオンにする前に、両方を「Try it」で検証してください。別の言語での質問も含めてください。

Lines to add to the Instructions of a Reply with AI step
Payments
- When the customer confirms the order and wants to pay, send this link on its own line:
  https://buy.stripe.com/test_cN25nr0iZ7bUa7meUY
- Before sending it, repeat the items and the total from the price list above.
- Never ask for card numbers, PINs, passwords or one-time codes. The customer pays on the link.
- Refunds, double charges or failed payments: say someone from our team will reply here shortly.

注文ごとのリンクは、自社システムでどのように作成しますか?

「Call my webhook」ステップを使います。エンドポイントは X-EC-Signature を検証し、contact.wa_id または message.text 内の注文番号で、顧客の未払い注文を見つけます。その金額を指定してプロバイダーにリンクを要求し、返信フィールドに返します。リンクのメタデータには注文 ID と WhatsApp 番号を入れておくと、後で支払いを照合できます。

20 秒未満に抑えてください。プロバイダーへの呼び出しは、通常 1 〜 2 秒で終わります。顧客が同じ注文で二度頼んだ場合は、まだ有効なリンクを再利用します。テスト時は dry_run を true にします。その場合は、サンプルの文章を返し、リンクは作成しません。

Express handler: a Stripe Checkout Session per order, returned as the reply
// signed(req) is the X-EC-Signature check from the live-data page, with this automation's secret.
app.post("/whatsapp/pay", express.text({ type: "application/json" }), async (req, res) => {
  if (!signed(req)) return res.status(401).end();
  const { dry_run, contact } = JSON.parse(req.body);

  const order = await openOrderFor(contact.wa_id); // your system: this customer's unpaid order
  if (!order) return res.json({ reply: "I could not find an open order for this number. Send the order number and I will check." });
  if (dry_run) return res.json({ reply: "Test: the payment link for order " + order.id + " would go here." });

  const form = new URLSearchParams({
    mode: "payment",
    success_url: "https://shop.example/thanks",
    "line_items[0][quantity]": "1",
    "line_items[0][price_data][currency]": order.currency,               // e.g. "usd" or "brl"
    "line_items[0][price_data][unit_amount]": String(order.amountCents),
    "line_items[0][price_data][product_data][name]": "Order " + order.id,
    "metadata[order_id]": order.id,
    "metadata[wa_id]": contact.wa_id,
  });
  const r = await fetch("https://api.stripe.com/v1/checkout/sessions", {
    method: "POST",
    headers: { Authorization: "Bearer " + process.env.STRIPE_SECRET_KEY },
    body: form,
  });
  const session = await r.json();
  if (!session.url) return res.json({ reply: "The payment link is not ready yet. Someone from our team will send it here shortly." });
  res.json({ reply: "Order " + order.id + ", total " + order.total + ". Pay here:\n" + session.url + "\nThe link stays open for 24 hours." });
});

顧客は支払い後、どのように確認を受け取りますか?

支払いがプロバイダーから報告されたとき、自社システムから送ります。例えば、メタデータ付きの Stripe の checkout.session.completed イベントです。そこから WhatsApp 番号と注文 ID を読み取り、get_api_credentials が返す送信エンドポイントとアクセストークンを使って、Meta の Cloud API からメッセージを送ります。顧客の最後のメッセージから 24 時間以内であれば、通常のテキストで送れます。それ以降は、Meta は承認済みのテンプレートしか受け付けません。支払い確認は顧客自身の購入に伴うものなので、ユーティリティカテゴリに当たりますが、判断は審査時に Meta が行います。このメッセージはアプリのチャットスレッドにも表示されるため、チームは注文が支払い済みであることを把握できます。

Send the confirmation: text inside the window, template after it
// send_endpoint and access_token come from get_api_credentials for this number.
const insideWindow = Date.now() - lastCustomerMessageAt(waId) < 24 * 3600 * 1000;
await fetch(SEND_ENDPOINT, {
  method: "POST",
  headers: { Authorization: "Bearer " + ACCESS_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify(insideWindow
    ? { messaging_product: "whatsapp", to: waId, type: "text",
        text: { body: "Payment received for order " + orderId + ". Thank you! We will let you know when it ships." } }
    : { messaging_product: "whatsapp", to: waId, type: "template",
        template: { name: "payment_received", language: { code: "en" },
          components: [{ type: "body", parameters: [{ type: "text", text: orderId }] }] } }),
});

テンプレートに支払いボタンを含めることはできますか?

はい、URL が固定であれば可能です。「Send a template」ステップは、ボタンに変数を含まない承認済みのテンプレートを送れます。例えば、チェックアウトページまたは固定の Payment Link への URL ボタン、あるいは「Pay now」や「Talk to us」などのクイック返信ボタンです。クイック返信をタップすると、テキストとして届くため、キーワードの自動化でリンクを返せます。本文の変数は位置で埋められるため、金額や注文番号は {{1}} と {{2}} に入れます。

変数付きの URL ボタン(注文ごとのリンクに必要なもの)と、コードをコピーするボタンは、現在の自動化では埋められません。そのようなテンプレートは、自社システムから Cloud API で送信してください。テンプレートメッセージの料金は、カテゴリと国ごとにメッセージ単位で、お使いの WhatsApp Business アカウントに Meta から請求されます。

設定方法

  1. Create the link at your providerMake a Payment Link or a checkout page for the product, or note your PIX key. Open it once on a phone to check the amount and the page.
  2. Start a keyword automationIn Automations, click New automation and pick Keyword reply under Start from an example. Choose Contains and enter your payment words, one per line.
  3. Write the replyIn Reply with text, put a short greeting with {{first_name}} and the link on its own line. Save with the switch Off.
  4. Test the wordsClick Test and run "how do I pay?", "quero pagar" and an unrelated message with Run test, to see which ones match and what the customer would receive.
  5. Switch it OnSet the switch to On and save. Write "pay" from another phone and tap the link to check it opens the payment page.

よくある間違い

  • AI にチャットでカード情報を集めさせることです。Instructions に、カード番号、暗証番号、コードを禁止する行を追加し、代わりにプロバイダーのリンクを送ってください。チャットのメッセージは、実行ログに 30 日間保存されます。
  • 期限切れのセッションリンクを送ることです。Stripe Checkout Session は既定で 24 時間有効です。翌日戻ってきた顧客は無効なリンクをタップすることになるため、依頼があった時点で新しく作成してください。
  • 数日後にフリーテキストで支払いを確認することです。顧客の最後のメッセージから 24 時間を過ぎると、Meta はフリーテキストを拒否します。確認には、承認済みのユーティリティテンプレートを使ってください。
  • リンクを返す webhook の後に固定返信を追加することです。両方が送信されるため、顧客はリンクと、もう一つの一般的なメッセージを受け取ります。
EasyCoexistence で実現する

キーワードへの返信でリンクを送ったり、ご自身のキーを使った AI で応答したり、注文ごとのリンクを作成するシステムへ webhook を送ったりできます。お金には一切触れません。顧客は支払いプロバイダーに直接支払い、Meta のメッセージ料金はマークアップなしでお使いのアカウントに請求されます。番号 1 件あたり月額 US$ 9 から US$ 0.75 まで、番号を増やすほど下がります。最初の 3 日間は無料トライアルです。

よくある質問

easyCoexistence は決済を処理しますか?

いいえ。リンクを含むテキストまたはテンプレートを送信するだけです。支払いは顧客と、Stripe、Mercado Pago、またはお使いの銀行の PIX などのプロバイダーの間で行われます。手数料、入金、返金、領収書は、プロバイダーのダッシュボードで管理されます。

顧客はチャットを離れずに支払えますか?

自動化ではできません。自動化はテキストとテンプレートを送るだけなので、顧客はプロバイダーのページを開きます。Meta 独自のチャット内支払いメッセージは一部の市場でのみ提供されており、事業者のシステムが Cloud API 経由で送信します。国ごとの状況は、Meta の支払いに関するドキュメントでご確認ください。

自社システムは、どのチャットがどの支払いに属するかをどう判断しますか?

リンクを作成するときに、メタデータに contact.wa_id と注文 ID を入れてください。プロバイダーが支払いを報告したら、それらを読み取って注文を更新し、正しい番号に確認メッセージを送ります。

何日も連絡がない相手に支払いリマインダーを送れますか?

はい。承認済みのテンプレートとして、自社システムまたは AI から send_template で送れます。顧客の最後のメッセージから 24 時間を過ぎると、フリーテキストは受け付けられないためです。受信に同意した顧客だけにリマインダーを送り、販促内容はユーティリティテンプレートに含めないでください。

続きを読む

始める準備はできましたか?

WhatsApp Coexistence の設定は数分で完了し、数か月もかかりません。スマートフォン上のアプリも引き続き使えます。

無料トライアルを始める

確認日