Skip to content

Add Billing using paddle #411

Description

@SaravanakumarR2018

Feature Request

Clerk–Paddle User and Organisation Flow

User Creation

  1. When a user gets created in Clerk, we need to make sure a similar user is created in Paddle with the email and the paddle_subscription_id should be added as part of the user public metadata in Clerk.

Organisation Creation and Payment Flow

  1. When a user creates an organisation, the user should then be moved to the payment screen. Whichever plan the user uses, the user should select the number of seats they require in the organisation.

    Subscription and Metadata Updates

    2a. The subscription with that number of seats(quantity) should be added in Paddle, and the paddle_subscription_id should be added to the organisation public_metadata in Clerk and also the organisation_created_by field which should be the user id who created the organisation now.

    2b. The limited membership in Clerk in the organisation should be updated to the number of seats.

JWT Requirements After Payment

  1. When the user moves from the payment screen when the org is created the JWT should contain:
  • 3a. user.public_metadata.paddle_customer_id

  • 3b. organisation.public_metadata.paddle_subscription_id

  • 3c. organisation.public_metadata.organisation_created_by

  • 3d. user.email

    When the user has already created the org, after selecting the org, the JWT should contain\

    • 3a. user.public_metadata.paddle_customer_id
    • 3b. organisation.public_metadata.paddle_subscription_id
    • 3c. organisation.public_metadata.organisation_created_by
    • 3d. user.email

User Flows

Once we have this setup, now whenever a user logs in:

4a. If they don’t have an organisation, they create an organisation and then they go to the payment flow.

4b. If the user already has an organisation and selected that organisation, we should check whether the user has access by checking the Paddle subscription status by quering paddle using the paddle_subscription_id in the JWT token.

  • If the access is available, the user is let to flows.

  • If the access is not available:

    • If the user is the same organisation_created_by user, it should be taken to the payment screen.
    • Else, the user should be told that they need to contact the admin who created the organisation, which can be obtained from the organisation_created_by field.

Motivation

NA

Your Contribution

NA

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions