Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WCS & Stripe: add payment metadata and update renewal description #2254

Merged
merged 4 commits into from
Feb 15, 2023

Conversation

adekbadek
Copy link
Member

@adekbadek adekbadek commented Jan 27, 2023

All Submissions:

Changes proposed in this Pull Request:

WC Stripe Gateway plugin adds little metadata to any Stripe payment. It's not possible to learn that a payment was related to a specific subscription. WCSG only adds the order_id metadata and indicates a WC Subscription with a payment_type='recurring' metadata.

To make any third-party integrations more aware of what WCS is doing in Stripe:

  • subscription_id will be added to any payments which are WC Subscriptions renewals
  • subscription_status will be added, either created or renewed
  • additionally, for Newspack-originating subscriptions, the payment description will be updated to Newspack <frequency> Donation (Order <id>, Subscription <id>) (e.g. Newspack Monthly Donation (Order #756, Subscription #757))

How to test the changes in this Pull Request:

  1. Set up Stripe, ensure the site is reachable by Stripe webhooks
  2. Ensure the WC suite is active, and "Stripe – Credit Card (Stripe)" set as the only payment method in WC
  3. Set the environment variable NEWSPACK_USE_WC_SUBSCRIPTIONS_WITH_STRIPE_PLATFORM to true (see Stripe: create native WC Subscriptions (if a flag is set) #2251)
  4. Make a recurring donation using SDB
  5. Open the resulting WC Subscription in WP Admin an renew it manually (via the "Subscription actions" meta box)
  6. Go to Stripe dashboard, inspect the initial payment and the renewal payment – both should have subscription_id meta set (to the applicable value), the first one should have the subscription_status meta set to created, and the second one to renewed. Both should have origin meta set to newspack.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Sorry, something went wrong.

@adekbadek adekbadek requested a review from a team as a code owner January 27, 2023 16:32
@adekbadek adekbadek marked this pull request as draft January 27, 2023 16:32
@adekbadek adekbadek force-pushed the feat/wcs-stripe-metadata branch from 22fb4bd to 525ebc2 Compare January 27, 2023 16:35
@leogermani
Copy link
Contributor

leogermani commented Jan 27, 2023

That's awesome, thanks!

Would it be possible/easy to add what payment of the subscription this is? (if it's the 1st payment, second, etc... just a number 1, 2, 3...?)

The primary goal of that would be to easily identify new subscriptions from ongoing ones.

We could also edit the description and add "New subscription" or something

@leogermani
Copy link
Contributor

ah..

another thing we identified is that we could add a origin=>newspack metadata.

I know we have referer... but this would be more generic. See pamTN9-5II-p2#comment-7375

@adekbadek adekbadek force-pushed the feat/wcs-stripe-metadata branch 2 times, most recently from 78093be to 5e0598f Compare January 30, 2023 10:38
@adekbadek
Copy link
Member Author

The primary goal of that would be to easily identify new subscriptions from ongoing ones.

There will be subscription_status meta with created or renewed value, would that suffice?

another thing we identified is that we could add a origin=>newspack metadata.

Added in 5e0598f.

@leogermani
Copy link
Contributor

leogermani commented Feb 8, 2023

There will be subscription_status meta with created or renewed value, would that suffice?

Yes, that's good. What are all the possible values? For a regular payment during a subscription what would this look like?

Base automatically changed from feat/sdb-native-wc-subs to master February 13, 2023 10:43

Verified

This commit was signed with the committer’s verified signature.
miguelpeixe Miguel Peixe

Verified

This commit was signed with the committer’s verified signature.
miguelpeixe Miguel Peixe

Verified

This commit was signed with the committer’s verified signature.
miguelpeixe Miguel Peixe
@adekbadek adekbadek force-pushed the feat/wcs-stripe-metadata branch from 5e0598f to 8d9490c Compare February 13, 2023 10:47
@adekbadek
Copy link
Member Author

For a regular payment during a subscription what would this look like?

That would be renewed.

Verified

This commit was signed with the committer’s verified signature.
miguelpeixe Miguel Peixe
@adekbadek adekbadek marked this pull request as ready for review February 13, 2023 10:57
@adekbadek adekbadek added [Status] Needs Review The issue or pull request needs to be reviewed Reader Revenue Stripe WooCommerce labels Feb 13, 2023
@github-actions github-actions bot added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed labels Feb 15, 2023
@adekbadek adekbadek merged commit b039304 into master Feb 15, 2023
@adekbadek adekbadek deleted the feat/wcs-stripe-metadata branch February 15, 2023 13:03
matticbot pushed a commit that referenced this pull request Feb 17, 2023

Verified

This commit was signed with the committer’s verified signature.
miguelpeixe Miguel Peixe
# [1.103.0-alpha.2](v1.103.0-alpha.1...v1.103.0-alpha.2) (2023-02-17)

### Bug Fixes

* **ads-wizard:** cancelled state of unit displayed on the list ([#2272](#2272)) ([e10b592](e10b592))
* **ads:** remove fixed height setting ([#2255](#2255)) ([0031b89](0031b89))
* change default auth strategy to "link" ([#2261](#2261)) ([c4b2e2c](c4b2e2c))
* update package.json to resolve a merge conflict with master ([f2408a3](f2408a3))
* **webhooks:** check if endpoint exists ([#2276](#2276)) ([5a95e2c](5a95e2c))

### Features

* bootstrap GA4 connector ([#2241](#2241)) ([f7582a4](f7582a4))
* **data-events:** mailchimp connector ([#2233](#2233)) ([08060c6](08060c6))
* **data-events:** standardize the use of "user_id" and "email" ([#2263](#2263)) ([d6b6903](d6b6903))
* **donations:** add payment metadata and update renewal description ([#2254](#2254)) ([b039304](b039304))
* **my-account:** display stripe billing link regardless of RR platform ([df540fe](df540fe))
* **perfmatters:** defaults adjustments, remove feature flag ([#2271](#2271)) ([cf5ad51](cf5ad51))
* **performance:** minify all inline CSS ([#2239](#2239)) ([fbb415f](fbb415f))
* **ras:** enable custom contact metadata prefixes ([#2249](#2249)) ([e9843e4](e9843e4))
* require all woo plugins for RAS ([#2260](#2260)) ([5f6a818](5f6a818))
* **stripe:** create native WC Subscriptions (if feature flag is set) ([#2251](#2251)) ([009a8a5](009a8a5))
* **webhooks:** support label for endpoints ([#2262](#2262)) ([39da7be](39da7be))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.103.0-alpha.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Feb 17, 2023

Verified

This commit was signed with the committer’s verified signature.
miguelpeixe Miguel Peixe
# [1.104.0-alpha.1](v1.103.0...v1.104.0-alpha.1) (2023-02-17)

### Bug Fixes

* **ads-wizard:** cancelled state of unit displayed on the list ([#2272](#2272)) ([e10b592](e10b592))
* **ads:** remove fixed height setting ([#2255](#2255)) ([0031b89](0031b89))
* change default auth strategy to "link" ([#2261](#2261)) ([c4b2e2c](c4b2e2c))
* **webhooks:** check if endpoint exists ([#2276](#2276)) ([5a95e2c](5a95e2c))

### Features

* bootstrap GA4 connector ([#2241](#2241)) ([f7582a4](f7582a4))
* **data-events:** mailchimp connector ([#2233](#2233)) ([08060c6](08060c6))
* **data-events:** standardize the use of "user_id" and "email" ([#2263](#2263)) ([d6b6903](d6b6903))
* **donations:** add payment metadata and update renewal description ([#2254](#2254)) ([b039304](b039304))
* **my-account:** display stripe billing link regardless of RR platform ([df540fe](df540fe))
* **perfmatters:** defaults adjustments, remove feature flag ([#2271](#2271)) ([cf5ad51](cf5ad51))
* **performance:** minify all inline CSS ([#2239](#2239)) ([fbb415f](fbb415f))
* **ras:** enable custom contact metadata prefixes ([#2249](#2249)) ([e9843e4](e9843e4))
* require all woo plugins for RAS ([#2260](#2260)) ([5f6a818](5f6a818))
* **stripe:** create native WC Subscriptions (if feature flag is set) ([#2251](#2251)) ([009a8a5](009a8a5))
* **webhooks:** support label for endpoints ([#2262](#2262)) ([39da7be](39da7be))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.104.0-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Feb 20, 2023

Verified

This commit was signed with the committer’s verified signature.
miguelpeixe Miguel Peixe
# [1.105.0-alpha.1](v1.104.0...v1.105.0-alpha.1) (2023-02-20)

### Bug Fixes

* **ads-wizard:** cancelled state of unit displayed on the list ([#2272](#2272)) ([e10b592](e10b592))
* **ads:** remove fixed height setting ([#2255](#2255)) ([0031b89](0031b89))
* change default auth strategy to "link" ([#2261](#2261)) ([c4b2e2c](c4b2e2c))
* **webhooks:** check if endpoint exists ([#2276](#2276)) ([5a95e2c](5a95e2c))

### Features

* bootstrap GA4 connector ([#2241](#2241)) ([f7582a4](f7582a4))
* **data-events:** mailchimp connector ([#2233](#2233)) ([08060c6](08060c6))
* **data-events:** standardize the use of "user_id" and "email" ([#2263](#2263)) ([d6b6903](d6b6903))
* **donations:** add payment metadata and update renewal description ([#2254](#2254)) ([b039304](b039304))
* **my-account:** display stripe billing link regardless of RR platform ([df540fe](df540fe))
* **perfmatters:** defaults adjustments, remove feature flag ([#2271](#2271)) ([cf5ad51](cf5ad51))
* **performance:** minify all inline CSS ([#2239](#2239)) ([fbb415f](fbb415f))
* **ras:** enable custom contact metadata prefixes ([#2249](#2249)) ([e9843e4](e9843e4))
* require all woo plugins for RAS ([#2260](#2260)) ([5f6a818](5f6a818))
* **stripe:** create native WC Subscriptions (if feature flag is set) ([#2251](#2251)) ([009a8a5](009a8a5))
* **webhooks:** support label for endpoints ([#2262](#2262)) ([39da7be](39da7be))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.105.0-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.105.0-hotfix-hpb-amp-optimisations.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Feb 28, 2023

Verified

This commit was signed with the committer’s verified signature.
miguelpeixe Miguel Peixe
# [1.105.0](v1.104.1...v1.105.0) (2023-02-28)

### Bug Fixes

* **ads-wizard:** cancelled state of unit displayed on the list ([#2272](#2272)) ([e10b592](e10b592))
* **ads:** remove fixed height setting ([#2255](#2255)) ([0031b89](0031b89))
* change default auth strategy to "link" ([#2261](#2261)) ([c4b2e2c](c4b2e2c))
* **webhooks:** check if endpoint exists ([#2276](#2276)) ([5a95e2c](5a95e2c))

### Features

* bootstrap GA4 connector ([#2241](#2241)) ([f7582a4](f7582a4))
* **data-events:** mailchimp connector ([#2233](#2233)) ([08060c6](08060c6))
* **data-events:** standardize the use of "user_id" and "email" ([#2263](#2263)) ([d6b6903](d6b6903))
* **donations:** add payment metadata and update renewal description ([#2254](#2254)) ([b039304](b039304))
* **my-account:** display stripe billing link regardless of RR platform ([df540fe](df540fe))
* **perfmatters:** defaults adjustments, remove feature flag ([#2271](#2271)) ([cf5ad51](cf5ad51))
* **performance:** minify all inline CSS ([#2239](#2239)) ([fbb415f](fbb415f))
* **ras:** enable custom contact metadata prefixes ([#2249](#2249)) ([e9843e4](e9843e4))
* require all woo plugins for RAS ([#2260](#2260)) ([5f6a818](5f6a818))
* **stripe:** create native WC Subscriptions (if feature flag is set) ([#2251](#2251)) ([009a8a5](009a8a5))
* **webhooks:** support label for endpoints ([#2262](#2262)) ([39da7be](39da7be))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.105.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants