Skip to content

feat: Add more metadata to Stripe transaction#11221

Merged
alannnc merged 5 commits intocalcom:mainfrom
kcrimi:feature/more-stripe-data
Sep 14, 2023
Merged

feat: Add more metadata to Stripe transaction#11221
alannnc merged 5 commits intocalcom:mainfrom
kcrimi:feature/more-stripe-data

Conversation

@kcrimi
Copy link
Copy Markdown
Contributor

@kcrimi kcrimi commented Sep 7, 2023

What does this PR do?

This PR adds additional information to Stripe metadata and tweaks data added in a previous PR for better usability:

  • organizer id and username - used to identify the cal user when multiple cal accounts are linked to the same Stripe account
  • event type title instead of event title - allows aggregating across all like bookings by event type for total earnings by event type, the individual title is less useful
  • bookerName - useful in interacting with user for charge disputes

Fixes #10668, #10678, #8205

Requirement/Documentation

  • Original request was added here

Type of change

  • New feature (non-breaking change which adds functionality)

How should this be tested?

  • Have an organizer account with a linked stripe account offer a paid event type
  • Create a booking of that paid event type
  • Metadata should show in the Stripe transaction:
Screenshot 2023-09-07 at 2 31 26 PM

Mandatory Tasks

  • Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.

Checklist

  • I haven't added tests that prove my fix is effective or that my feature works

@vercel
Copy link
Copy Markdown

vercel bot commented Sep 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 14, 2023 4:04am

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Sep 7, 2023

CLA assistant check
All committers have signed the CLA.

@vercel
Copy link
Copy Markdown

vercel bot commented Sep 7, 2023

@kcrimi is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 7, 2023

Thank you for following the naming conventions! 🙏

@github-actions github-actions bot added billing area: billing, stripe, payments, paypal, get paid Medium priority Created by Linear-GitHub Sync ✨ feature New feature or request 🚧 wip / in the making This is currently being worked on labels Sep 7, 2023
@kcrimi kcrimi changed the title Add more metadata to Stripe transaction feat: Add more metadata to Stripe transaction Sep 7, 2023
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 7, 2023

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link
Copy Markdown
Contributor Author

@kcrimi kcrimi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shirazdole @alannnc this builds upon #10678 to get all the information I'd need.

Happy to add/change anything if needed

name: true,
email: true,
timeZone: true,
username: true,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to add the username to the query since it was previously only getting name, email, and timezone for the organizer

const handlePayment = async (
evt: CalendarEvent,
selectedEventType: Pick<Zod.infer<typeof EventTypeModel>, "metadata">,
selectedEventType: Pick<Zod.infer<typeof EventTypeModel>, "metadata" | "title">,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting the title in addition to the metadata for the event type now

bookerEmail,
paymentOption,
evt.title
selectedEventType.title
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous PR added the event title (eg "30 minute meeting with Roald Dahl") instead of the event type title (eg "30 minute meeting").

Because I'm looking to use multiple accounts on the same Stripe account, it would be more useful to be able to aggregate on the event type title to show earninings per event type.

If it's also useful to have the calendar event title, I can add it back in addition.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let's keep both. BookingTitle and eventTitle. What you think?

PeerRich
PeerRich previously approved these changes Sep 11, 2023
Copy link
Copy Markdown
Member

@PeerRich PeerRich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, waiting for @alannnc

.tool-versions Outdated
@@ -0,0 +1 @@
nodejs 20.3.1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uncheck this file from the PR.

Copy link
Copy Markdown
Contributor

@alannnc alannnc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments. Will leave with request changes for a moment, if I find time I will address the issues.

@kcrimi
Copy link
Copy Markdown
Contributor Author

kcrimi commented Sep 11, 2023

🙏 Thanks @alannnc, pushed some changes

@alannnc alannnc requested a review from a team September 14, 2023 04:07
@alannnc alannnc enabled auto-merge (squash) September 14, 2023 04:08
@alannnc alannnc merged commit 3a05ae6 into calcom:main Sep 14, 2023
ashwintelmore pushed a commit to ashwintelmore/cal.com that referenced this pull request Sep 19, 2023
* Add booker info, event type title, and organizer info into Stripe metadata

* Add back bookingTitle in addition to eventTitle

* Remove .tool-versions

* Fix typo

---------

Co-authored-by: alannnc <alannnc@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

billing area: billing, stripe, payments, paypal, get paid ✨ feature New feature or request Medium priority Created by Linear-GitHub Sync 🚧 wip / in the making This is currently being worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide information to link bookings to Stripe payments

4 participants