承接 innoweb/silverstripe-silvershop-stripe 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

innoweb/silverstripe-silvershop-stripe

Composer 安装命令:

composer require innoweb/silverstripe-silvershop-stripe

包简介

Adds stripe customer and creditcard saving to silvershop

README 文档

README

Stripe uses a little different payment flow than other processors in that you have to do some clientside javascript work to set it up and you get a token back instead of credit card processing fields.

This module uses Omnipay's Stripe adapter but overrides SilverShop's default checkout component to inject the right JavaScript.

Based on Mark Guinn's SS3 version, extended with saving of the token to the Member object for later use.

Requirements

uses Stripe.js v3

Installation

composer require innoweb/silverstripe-silvershop-stripe

Configuration

Payment Intents

Create a file at app/_config/payment.yml that looks something like the following:

---
Name: payment
---
SilverStripe\Omnipay\Model\Payment:
  allowed_gateways:
    - 'Stripe_PaymentIntents'

SilverStripe\Omnipay\GatewayInfo:
  Stripe_PaymentIntents:
    failureUrl: '/checkout/summary'
    parameters:
      apiKey: sk_test_SECRET-KEY-FOR-YOUR-TEST-ACCOUNT
      publishableKey: pk_test_PUBLISHABLE-KEY-FOR-TEST-ACCOUNT

---
Only:
  environment: 'live'
---
SilverStripe\Omnipay\GatewayInfo:
  Stripe_PaymentIntents:
    failureUrl: '/checkout/summary'
    parameters:
      apiKey: sk_live_SECRET-KEY-FOR-YOUR-LIVE-ACCOUNT
      publishableKey: pk_live_PUBLISHABLE-KEY-FOR-LIVE-ACCOUNT

If needed, the customer will be redirected to Stripe or his bank to verify the transaction via SCA or 3D-Secure.

A custom failure URL can be specified here for when a payment fails (for example, the card was declined).

Saving credit cards

The Stripe_PaymentIntents gateway creates Stripe customers and cards when a payment is processed and stores their tokens in the Silverstripe database.

To disable the storage of card tokens and the use of previously stored cards in the checkout process, add the following to your config:

---
Name: app-stripe-config
After: silvershop-stripe-config
---
Innoweb\SilvershopStripe\Checkout\Components\StripeOnsitePayment:
  enable_saved_cards: false

This will disable storing creadit card tokens in the database and hide the field to select previsouly stored cards in the payment form.

Stripe still records the card tokens on their platform in order to be able to process refunds etc. But there is no reference to the cards in the Silverstripe database.

Selecting a previously stored card

To select an existing card, the cards are shown as radio buttons in the payment form.

When there are more than 3 cards stored for a user, the field is displayed as a dropdown.

You can change that threshold by adding the following to your config:

Innoweb\SilvershopStripe\Checkout\Components\StripeOnsitePayment:
  radio_button_limit: 100

Styling the card selection radio buttons

The radio button labels include a rudimentary HTML structure to allow styling. You can add and amend the following styles to your CSS:

.field.optionset.existingCreditCards label .cc {
    display: inline-flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    width: 100%;
    max-width: 20rem;
}
.field.optionset.existingCreditCards label .cc-brand {
    margin-right: auto;
}

Stripe Charge (deprecated)

Create a file at app/_config/payment.yml that looks something like the following:

---
Name: payment
---
SilverStripe\Omnipay\Model\Payment:
  allowed_gateways:
    - 'Stripe'

SilverStripe\Omnipay\GatewayInfo:
  Stripe:
    parameters:
      apiKey: sk_test_SECRET-KEY-FOR-YOUR-TEST-ACCOUNT
      publishableKey: pk_test_PUBLISHABLE-KEY-FOR-TEST-ACCOUNT

---
Only:
  environment: 'live'
---
SilverStripe\Omnipay\GatewayInfo:
  Stripe:
    parameters:
      apiKey: sk_live_SECRET-KEY-FOR-YOUR-LIVE-ACCOUNT
      publishableKey: pk_live_PUBLISHABLE-KEY-FOR-LIVE-ACCOUNT

License

BSD 3-Clause License, see License

innoweb/silverstripe-silvershop-stripe 适用场景与选型建议

innoweb/silverstripe-silvershop-stripe 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.46k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2018 年 12 月 19 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「customer」 「stripe」 「silverstripe」 「card」 「silvershop」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 innoweb/silverstripe-silvershop-stripe 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 innoweb/silverstripe-silvershop-stripe 我们能提供哪些服务?
定制开发 / 二次开发

基于 innoweb/silverstripe-silvershop-stripe 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 3.46k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 22
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2018-12-19