24.2. 将 Stripe 配置为信用卡网关


作为 3scale API 提供程序,配置管理门户和开发人员门户,将忽略作为付款网关,以通过使用条带作为信用卡网关从订阅中接收 API 付款。

先决条件

  • 您必须有一个 Stripe 帐户。

    • 条带建议您为每个业务或项目使用单独的 Stripe 子帐户。
    • 有关多帐户的信息,请参阅 Stripe 文档。
  • 您必须具有 Stripe 管理员权限。

流程

要将 3scale 配置为使用 Stripe 作为支付网关,请按照以下步骤执行:

  1. 在 3scale 管理门户中,前往 Account Settings > Personal > Tokens
  2. 使用 Billing API 范围创建一个 Read and Write 令牌:

    1. 单击 Add Access Token
    2. 为令牌指定一个名称。
    3. 选择范围:Billing API
    4. 选择权限级别:Read & Write
    5. 单击 Create Access token
    6. 复制访问令牌。

      • 确保您将访问令牌复制到文件文本。访问令牌之后不会显示。
    7. 要完成令牌生成,请单击 I have copied the token

返回至流程.

24.2.2. 从 stripe 获取密钥和 webhook secret

注意
  • 需要在 Stripe 中配置 webhook。
  • 使用 Webhook 通知 3scale 付款已成功。
  • 然后 3scale 更新发票的状态,并防止进一步尝试收费。

在您自己的帐户中,获取 Secret 密钥发布密钥

  1. 打开资源面板。
  2. 按照 stripe 文档中的说明查找您的 API 密钥
  3. 复制 Secret 密钥发布密钥

仍在您的 stripe 帐户中,创建一个 Webhook Signing Secret:

  1. 前往 Developers > Webhooks
  2. 单击 Add endpoint
  3. 使用以下端点 URL 填写:

    https://<Your-provider-admin-domain>/api/payment_callbacks/stripe_callbacks?access_token=<value-of-access-token>
    Copy to Clipboard Toggle word wrap
  4. Events to send 中,添加 payment_intent.succeeded
  5. 单击 Add endpoint
  6. 单击以显示您刚才创建的 webhook 的签名机密并记下此机密。这是 Webhook 签名 Secret

返回至流程.

24.2.3. 在 3scale API 管理门户中配置计费

在 3scale 管理门户中:

  1. 前往 Audience > Billing > Charging & Gateway
  2. 选择 Charging enabled,点 Save
  3. Credit Car gateway > Gateway 中,选择 Stripe 作为网关。
  4. 添加 Secret KeyPublishable KeyWebhook Signing Secret,从您的 Stripe 帐户 获取,以获取密钥,以及来自 Stripe 的 webhook secret
  5. Save

返回至流程.

  1. 使用开发人员帐户登录 3scale 开发人员门户。
  2. 进入 Settings > Credit Card Details
  3. 添加以下信用卡详细信息:信用卡号码、到期日期和 CVC。
  4. Save details

返回至流程

24.2.5. 更新收费失败的电子邮件回复的文本

对于 SCA 付款的修复,3scale 2.10 中需要手动更新 invoice_messenger_unsuccessfully_charged_for_buyer.text.liquid 电子邮件的文本。

  1. 在 3scale 管理门户中,转至 Audience > Messages > Email Templates
  2. 选择 Invoice charge failure for buyer with retry
  3. Override
  4. 更新模板消息:这是在不成功收费的电子邮件响应中使用的完整文本:

    Dear {{ account.name }},
    
    Thank you for using our service.
    
    We're sorry to inform you that your last payment was declined.
    This may have been caused by a few common reasons:
    
    - A new authentication policy enforced by your bank
    - An expired credit card
    - Insufficient funds on the account
    
    To continue using your service, verify the status of your credit card and update or re-enter the credit card details at {{payment_url}}.
    
    If you need help, don't hesitate to contact us at {{ provider.finance_support_email }}.
    
    Best regards,
    The {{ provider.name }} API Team
    Copy to Clipboard Toggle word wrap
  5. 单击 Create Email Template

通过这些步骤,您已更新了电子邮件模板,以便收费失败的电子邮件回复。

返回至流程

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat