Experimental project
This is a sandbox project, which contains experimental code for developer use only.
The project moved here: 'Stripe Roles' module
The little bit modified version of the 'Stripe Registration' module for resolving the issues with roles update.
See
'Stripe Registration on cancel does not remove role',
'Stripe Registration not showing user cancelled'.
Configuration
1. Add _access: 'TRUE' to the 'stripe_api.webhook' route.
Edit the 'stripe_api.routing.yml' file of the 'Stripe API' module and alter the 'requirements' section of the 'stripe_api.webhook' route like this:
stripe_api.webhook:
path: '/stripe/webhook'
methods: [POST]
defaults:
_controller: '\Drupal\stripe_api\Controller\StripeApiWebhook::handleIncomingWebhook'
requirements:
_access: 'TRUE'
_content_type_format: json
2. On the Stripe dashboard add the 'customer.subscription.deleted' webhook.
3. Rebuild the cache.
The export of the Rule for notification of a subscriber via email when a new subscription was created.
langcode: en
status: true
dependencies: { }
id: if_new_stripe_subscription_was_created_then_notify_subscriber
label: 'If a new Stripe subscription was created, then notify a subscriber via email'
events:
-
event_name: 'rules_entity_insert:stripe_subscription'
description: ''
tags: { }
config_version: '3'
expression:
id: rules_rule
uuid: 49c22ebd-6dfb-4998-9552-5330388fa2f6
weight: 0
conditions:
id: rules_and
uuid: db0e4840-8659-47e8-b3b7-85d32bc6f2ee
weight: 0
conditions: { }
actions:
id: rules_action_set
uuid: 178897cd-df5d-4c6e-9c86-31500ed51392
weight: 0
actions:
-
id: rules_action
uuid: 43478176-9883-49cb-88c6-c4d7fd375e52
weight: 0
context_values:
to:
- '{{ stripe_subscription.user_id.entity.mail.value }}'
subject: 'New subscription notification'
message: 'You have subscribed successfully.'
reply: ''
language: ''
context_mapping: { }
context_processors:
to:
rules_tokens: { }
subject:
rules_tokens: { }
message:
rules_tokens: { }
reply:
rules_tokens: { }
language:
rules_tokens: { }
provides_mapping: { }
action_id: rules_send_email
The export of the Rule for notification of a subscriber via email when a subscription was canceled.
langcode: en
status: true
dependencies: { }
id: if_stripe_subscription_was_canceled_then_notify_subscriber
label: 'If a Stripe subscription was canceled, then notify a subscriber via email'
events:
-
event_name: 'rules_entity_update:stripe_subscription'
description: ''
tags: { }
config_version: '3'
expression:
id: rules_rule
uuid: 7b5fc318-e40c-47f6-bd4f-fdece2bd7550
weight: 0
conditions:
id: rules_and
uuid: 08fcffa2-0b59-4f37-90a6-077dbcd6b5d3
weight: 0
conditions: { }
actions:
id: rules_action_set
uuid: efde6986-7d77-41ff-b7a5-e94b0940984a
weight: 0
actions:
-
id: rules_action
uuid: 7fb6b9e6-aad2-4e3c-a57c-26997b0b445e
weight: 0
context_values:
to:
- '{{ stripe_subscription.user_id.entity.mail.value }}'
subject: 'Unsubscribe notification'
message: 'The subscription has been canceled.'
reply: ''
language: ''
context_mapping: { }
context_processors:
to:
rules_tokens: { }
subject:
rules_tokens: { }
message:
rules_tokens: { }
reply:
rules_tokens: { }
language:
rules_tokens: { }
provides_mapping: { }
action_id: rules_send_email
The export of the Rule for the case when administrator deleted a subscription.
If a subscription was canceled before then the notification email will not send (because it was sent after canceling).
langcode: en
status: true
dependencies: { }
id: if_stripe_subscription_was_delated_then_notify_subscriber
label: 'If a Stripe subscription was delated, then notify a subscriber via email'
events:
-
event_name: 'rules_entity_delete:stripe_subscription'
description: ''
tags: { }
config_version: '3'
expression:
id: rules_rule
uuid: 14a4f82f-99f9-40b3-abc8-90404d28579e
weight: 0
conditions:
id: rules_and
uuid: 60dbb3e7-274b-47b0-a513-fc6ddc1d7673
weight: 0
conditions:
-
id: rules_condition
uuid: 30580742-71c3-46e1-934e-bdddfad81195
weight: 0
context_values:
operation: '=='
value: canceled
context_mapping:
data: stripe_subscription.status.value
context_processors:
operation:
rules_tokens: { }
value:
rules_tokens: { }
provides_mapping: { }
condition_id: rules_data_comparison
negate: true
actions:
id: rules_action_set
uuid: 87d0b318-b8d5-4d99-9c6b-e089cc1de9e4
weight: 0
actions:
-
id: rules_action
uuid: 75a62115-b678-460e-85aa-3e93a6c7a980
weight: 0
context_values:
to:
- '{{ stripe_subscription.user_id.entity.mail.value }}'
subject: 'Unsubscribe notification'
message: 'The subscription has been canceled.'
reply: ''
language: ''
context_mapping: { }
context_processors:
to:
rules_tokens: { }
subject:
rules_tokens: { }
message:
rules_tokens: { }
reply:
rules_tokens: { }
language:
rules_tokens: { }
provides_mapping: { }
action_id: rules_send_email
Project information
Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed.- Project categories: E-commerce
- Created by wombatbuddy on , updated
