使用通过 Outlook 付款Implementing payments in Outlook

启用通过 Outlook 付款,可以提供强大的付款解决方案,让你通过电子邮件发送付款请求,以便收件人立即采取行动。Implementing payments in Outlook provides a powerful payment solution that allows you to send requests for payments via email that are immediately actionable by the recipient. 收件人可以查看他们的发票、选择付款方式并批准付款,这些操作均可在 Outlook 内执行。The recipient can view their invoice, select a payment method, and approve payment, all from within Outlook.

我们了解一下简单的发票方案流程。Let's take a look at the flow for a simple invoice scenario.

发送发票和接收付款的事件顺序Sequence of events for sending an invoice and receiving payment

说明在 Outlook 中使用付款的发票方案的事件顺序的流程图

  1. 商家在 Office 365 中向收件人发送付款请求电子邮件。The merchant sends a payment request email to the recipient on Office 365.
  2. 付款服务验证是否允许发件人在交付给用户之前发送付款请求。The payment service validates that the sender is allowed to send payment requests before delivering to the user.
  3. 用户打开邮件,将其显示为支付卡。The user opens the message, which is rendered as a payment card.
  4. 用户对卡调用付款操作。The user invokes the payment action on the card.
  5. 付款服务将请求发布到商家的服务器,以便获取发票详细信息和允许的付款方式。The payment service POSTs a request to the merchant's server to get the invoice details and allowed payment methods.
  6. 商家使用 POST 中的信息来检索发票并将其发送回 Outlook。The merchant uses the information in the POST to retrieve the invoice and sends it back to Outlook.
  7. 用户可以在不离开 Outlook 的情况下查看发票、选择付款方式以及批准付款。The user reviews the invoice, selects a payment method, and approves payment without leaving Outlook.
  8. 付款服务将付款令牌发布到商家的服务器。The payment service POSTs a payment token to the merchant's server.
  9. 商家使用适当的付款处理器 API(Stripe、Microsoft Pay 等)处理令牌并将结果发送回 Outlook。The merchant processes the token using the appropriate payment processor API (Stripe, Microsoft Pay, etc.) and sends the result back to Outlook.
  10. Outlook 显示结果。Outlook displays the result.

集成组件Integration components

可以通过两个主要组件在 Outlook 中创建付款集成。There are two major components to creating a payment integration in Outlook.

  • 付款请求邮件 - 这是包含付款特定操作的电子邮件。Payment request message - This is an email message that includes pay-specific actions. 你的服务将这些特殊格式的邮件发送给收件人。Your service sends these specially-formatted messages to the recipient.
  • Webhook 服务 - 这是一种 Web 服务,它实施两个截然不同的 Webhook:一个提供最新的发票或结帐信息,另一个接受付款。Webhook service - This is a web service that implements two distinct webhooks: one that provides up-to-date invoice or checkout information, and one that accepts payment.

付款请求邮件Payment request message

付款请求邮件是在 HTML 正文中嵌入了可操作卡的电子邮件。The payment request message is an email message with an actionable card embedded in the HTML body. 该卡片由 JSON 有效负载定义,如 ActionRequest 标记引用中指定的那样。The card is defined by a JSON payload as specified in ActionRequest markup reference.

Outlook 中的付款请求邮件屏幕截图

productContext JSON 字典包含在 ActionRequest 有效负载中,其中应包含 Webhook 查找相应发票所需的信息。The ActionRequest payload contains a productContext JSON dictionary, which should include the information your webhooks need to locate the corresponding invoice.

重要

如需向用户发送付款请求邮件,需要在可操作电子邮件开发人员仪表板中注册。The ability to send payment request messages to users requires registration with the actionable email developer dashboard. 付款卡片标记还需要由合作伙伴仪表板生成的商家 ID 和显示 ID,用于通过 Outlook 付款。The payment card markup also requires a merchant ID and display ID generated by the partner dashboard for payments in Outlook. 有关详细信息,请参阅通过 Outlook 付款入门For details, see Get started with payments in Outlook.

WebhookWebhooks

该 Web 服务实施两个截然不同的 Webhook。The web service implements two distinct webhooks.

  • 付款请求 Webhook:此 Webhook 接收 POST 以加载发票。Payment request webhook: this webhook receives POSTs to load invoices. 如果发票方案包括提示输入送货地址和送货选项,则当用户选择或更改其送货信息时,该 Webhook 也会收到 POST。If your invoicing scenario includes prompting for a shipping address and shipping option, this webhook also receives POSTs when the user selects or changes their shipping information. 该 Webhook 返回一个最新的发票以显示在 Outlook 中。This webhook returns an up-to-date invoice to be displayed in Outlook. 有关详细信息,请参阅 PaymentRequest webhookFor details, see PaymentRequest webhook.
  • 付款完成 Webhook:该 Webhook 接收带付款令牌的 POST。Payment complete webhook: this webhook receives POSTs with payment tokens. 该 Webhook 处理付款令牌并将结果(成功还是失败)返回给 Outlook。This webhook processes payment tokens and returns success or failure to Outlook. 有关详细信息,请参阅 PaymentComplete webhookFor details, see PaymentComplete webhook.

后续步骤Next steps

查看我们的入门指南,了解如何在 Outlook 解决方案中实施自己的付款。Check out our getting started guide to learn how to implement your own payments in Outlook solution.