Log inStart Free Trial
Meta Tech Provider

Send payment links on WhatsApp automatically

To send payment links on WhatsApp automatically, reply to payment questions with a fixed link from your payment provider, triggered by words such as "pay" or "pix", or pass the message to your own system, which creates a link for that customer's order and returns it as the reply. The customer pays on the provider's page, and your system confirms in the chat once the payment clears.

easyCoexistence connects the WhatsApp Business number you keep in the app to Meta's Cloud API through Coexistence and runs automations on it: a keyword reply with your link, your own AI on your key, or a webhook to the system that creates links per order.

20 s

Time your system has to create the link and return it in the reply field.

24 hours

Default lifetime of a Stripe Checkout Session; it can be set from 30 minutes to 24 hours.

metadata

Stripe copies a Payment Link's metadata to the Checkout Sessions it creates, so a payment can be traced to the chat.

Static URL button

Templates whose buttons carry no variable can be sent by an automation's Send a template step.

Utility

Meta's category for templates triggered by a user action or request, with no promotional intent.

Which ways can WhatsApp send a payment link automatically?

Five patterns, from no code to fully automatic. Start with the fixed link if one price or a store checkout covers your sales, and move to a link per order when amounts differ. In each of them the payment itself happens on your provider's page or app, so card numbers, PIX transfers and receipts stay outside the automation and its run log:

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

How do you send a fixed link by keyword?

Start from Keyword reply under Start from an example. Trigger: Has keyword, Contains, with the words customers use when they want to pay. Step: Reply with text with the link on its own line, so it can be tapped or copied, and {{first_name}} if you like. A PIX key or a bank transfer reference works the same way. Contains matches inside words, so "pay" also fires on PayPal and repay, which is usually welcome, while "link" alone fires on many unrelated messages. The keyword automation answers before your AI assistant, so the link is exact and never paraphrased.

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.

Can your AI send the link when the customer is ready?

Yes, if the link is in its Instructions. A Reply with AI step writes from the Instructions and the chat, so put the link there with a rule for when to send it and the order to confirm first. Models copy a URL given verbatim, and the rule added under your instructions forbids inventing prices, so list the amounts or say where they come from.

Add two lines of safety: the model must never ask for card numbers or passwords, and anything about refunds or failed payments goes to a person. Test both with Try it before switching the automation on, including a question in another language.

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.

How does your system create a link for each order?

Through a Call my webhook step. Your endpoint verifies X-EC-Signature, finds the customer's open order by contact.wa_id or by the order number in message.text, asks the payment provider for a link with the exact amount, and returns it in the reply field. Put the order id and the WhatsApp number in the link's metadata, so the payment can be matched back later.

Keep it under 20 seconds: one call to the provider usually takes a second or two. Reuse a still-open link if the customer asks twice for the same order. On tests, dry_run is true: return a sample sentence and create nothing.

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." });
});

How does the customer get a confirmation once they pay?

From your system, when the provider reports the payment, for example Stripe's checkout.session.completed event with your metadata. Read the WhatsApp number and order id from it and send a message through Meta's Cloud API, with the send endpoint and access token that get_api_credentials returns. Within 24 hours of the customer's last message, a plain text works. After that, Meta accepts only an approved template; a payment confirmation follows the customer's own purchase, which fits the utility category, though Meta decides at review. The message also appears in the app's chat thread, so the team sees the order was paid.

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 }] }] } }),
});

Can a template carry the payment button?

Yes, with a fixed URL. A Send a template step can send an approved template whose buttons carry no variable: a URL button to your checkout page or to a fixed Payment Link, or quick-reply buttons such as Pay now and Talk to us, whose taps arrive as text that a keyword automation can answer with the link. Body variables are filled by position, so the amount or order number goes in {{1}} and {{2}}.

A URL button with a variable, the way a per-order link would need it, and copy-code buttons are not filled by automations today; your system sends those templates through the Cloud API. Meta bills template messages per message, by category and country, to your own WhatsApp Business Account.

How to set it up

  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.

Common mistakes

  • Letting the AI collect card details in the chat. Add a line to the Instructions forbidding card numbers, PINs and codes, and send the provider's link instead; chat messages are kept in run logs for 30 days.
  • Sending a session link that expires. A Stripe Checkout Session lasts 24 hours by default, so a customer who returns the next day taps a dead link; create a fresh one on request.
  • Confirming payment with free text days later. Outside 24 hours of the customer's last message Meta rejects free-form text, so keep an approved utility template for confirmations.
  • Adding a fixed reply after the webhook that returns the link. Both are sent, so the customer gets the link and a second, generic message.
Doing this with EasyCoexistence

It never touches the money: customers pay your provider directly, and Meta bills messages to your own account without markup. US$ 9 down to US$ 0.75 per number per month, falling as you add numbers, with the first 3 days free.

easyCoexistence is a multichannel API and MCP server that connects AI agents such as Claude and ChatGPT to WhatsApp, Instagram, TikTok, Facebook and more. On WhatsApp it uses Coexistence: the business keeps using its number in the WhatsApp Business app while the AI works through Meta's official API.

Frequently asked questions

Does easyCoexistence process the payments?

No. It sends the text or template that carries the link, and the payment runs between the customer and your provider, such as Stripe, Mercado Pago or your bank's PIX. Fees, payouts, refunds and receipts stay in your provider's dashboard.

Can customers pay without leaving the chat?

Not through automations, which send text and templates, so the customer opens the provider's page. Meta's own in-chat payment messages exist only in some markets and are sent by the business's system through the Cloud API; check Meta's payments documentation for your country.

How does my system know which chat a payment belongs to?

Put contact.wa_id and the order id in the link's metadata when you create it. When the provider reports the payment, read them back to update the order and to send the confirmation to the right number.

Can I send a payment reminder to someone who has not written in days?

Yes, as an approved template sent by your system or your AI with send_template, since free text is refused outside 24 hours of the customer's last message. Send reminders only to customers who agreed to receive them, and keep promotions out of a utility template.

Keep reading

Ready to get started?

Set up WhatsApp Coexistence in minutes, not months. The app keeps working on the phone.

Start Free Trial

Verified on