Skip to content

Commit

Permalink
Merge branch 'release/3.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeholder committed May 11, 2023
2 parents d0b4d5c + 70185b3 commit 989debb
Show file tree
Hide file tree
Showing 11 changed files with 586 additions and 349 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Create Release
run-name: Create release for ${{ github.event.client_payload.version }}

on:
repository_dispatch:
types:
- craftcms/new-release

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: ncipollo/release-action@v1
with:
body: ${{ github.event.client_payload.notes }}
makeLatest: ${{ github.event.client_payload.latest }}
name: ${{ github.event.client_payload.version }}
prerelease: ${{ github.event.client_payload.prerelease }}
tag: ${{ github.event.client_payload.tag }}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release Notes for Stripe for Craft Commerce

## 3.1.1 - 2023-05-10

- Stripe customers’ default payment methods are now kept in sync with Craft users’ primary payment sources. ([#235](https://github.com/craftcms/commerce-stripe/issues/235))
- Added `craft\commerce\stripe\services\Customers::EVENT_BEFORE_CREATE_CUSTOMER`. ([#233](https://github.com/craftcms/commerce-stripe/pull/233))
- Added `craft\commerce\stripe\events\SubscriptionRequestEvent::$plan`, which will be set to the plan being subscribed to. ([#141](https://github.com/craftcms/commerce-stripe/pull/141))

## 3.1.0 - 2022-01-29

- Added the `commerce-stripe/reset-data` command.
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,16 @@ You can output a standard form quickly using `order.gateway.getPaymentFormHtml()

We only need a few specific IDs in our markup, and Stripe’s JavaScript will take care of the rest by inserting and managing form inputs.

Replace the `YOUR_GATEWAY_ID` below with your Stripe Payment Intents gateway ID.
(You can omit the `gatewayId` input if the gateway is already saved to the cart.)
The following example is based on the gateway having already been set on the cart in a previous step.

```twig
<form method="post" action="" id="payment-form">
<form method="post" action="" id="payment-form"
data-payment-form-namespace="{{ cart.gateway.handle|commercePaymentFormNamespace }}"
>
{{ actionInput('commerce/payments/pay') }}
{{ redirectInput(siteUrl('shop/customer/order', { number: cart.number, success: 'true' })) }}
{{ hiddenInput('cancelUrl', siteUrl('shop/checkout/payment')|hash) }}
{{ hiddenInput('gatewayId', 'YOUR_GATEWAY_ID') }}
{{ hiddenInput('gatewayId', cart.gateway.id) }}
{{ csrfInput() }}
{% namespace cart.gateway.handle|commercePaymentFormNamespace %}
Expand Down Expand Up @@ -387,6 +388,7 @@ Finally, add a form listener that uses the submitted card details to [create a p

```javascript
var form = document.getElementById('payment-form');
var paymentFormNamespace = form.data('payment-form-namespace');

form.addEventListener('submit', function(event) {
event.preventDefault();
Expand All @@ -407,7 +409,7 @@ form.addEventListener('submit', function(event) {
var form = document.getElementById('payment-form');
var hiddenInput = document.createElement('input');
hiddenInput.setAttribute('type', 'hidden');
hiddenInput.setAttribute('name', 'paymentMethodId'); // Craft Commerce only needs this
hiddenInput.setAttribute('name', paymentFormNamespace + '[paymentMethodId]'); // Craft Commerce only needs this
hiddenInput.setAttribute('value', result.paymentMethod.id);
form.appendChild(hiddenInput);

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"require": {
"php": "^8.0.2",
"craftcms/cms": "^4.0.0",
"craftcms/commerce": "^4.0.0",
"craftcms/commerce": "^4.2.8",
"stripe/stripe-php": "^7.0"
},
"require-dev": {
Expand Down
Loading

0 comments on commit 989debb

Please sign in to comment.