@whop/checkout 0.0.21-canary.8 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +89 -0
- package/license.md +21 -0
- package/package.json +16 -1
package/README.md
CHANGED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# @whop/checkout - Embed Whop checkout on your page
|
|
2
|
+
|
|
3
|
+
Embedded checkout allows you to embed Whop's checkout flow on your own website in two easy steps. This allows you to offer your users a seamless checkout experience without leaving your website.
|
|
4
|
+
|
|
5
|
+
## Step 1: Add the script tag
|
|
6
|
+
|
|
7
|
+
To embed checkout, you need to add the following script tag into the `<head>` of your page:
|
|
8
|
+
|
|
9
|
+
```md
|
|
10
|
+
<script
|
|
11
|
+
async
|
|
12
|
+
defer
|
|
13
|
+
src="https://cdn.jsdelivr.net/npm/@whop/checkout@0.0.21-canary.8/dist/loader.js"
|
|
14
|
+
></script>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Step 2: Add the checkout element
|
|
18
|
+
|
|
19
|
+
To create a checkout element, you need to include the following attribute on an element in your page:
|
|
20
|
+
|
|
21
|
+
```md
|
|
22
|
+
<div data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
This will now mount an iframe inside of the element with the plan id you provided. Once the checkout is complete, the user will be redirected to the redirect url you specified in the settings on Whop.
|
|
26
|
+
|
|
27
|
+
You can configure the redirect url in your [whop's settings](https://whop.com/dashboard/whops/) or in your [company's settings](https://whop.com/dashboard/settings/checkout/) on the dashboard. If both are specified, the redirect url specified in the whop's settings will take precedence.
|
|
28
|
+
|
|
29
|
+
## Available attributes
|
|
30
|
+
|
|
31
|
+
### **`data-whop-checkout-plan-id`**
|
|
32
|
+
|
|
33
|
+
**Required** - The plan id you want to checkout.
|
|
34
|
+
|
|
35
|
+
> To get your plan id, you need to first create a plan in the **Manage Pricing** section on your whop page.
|
|
36
|
+
|
|
37
|
+
### **`data-whop-checkout-theme`**
|
|
38
|
+
|
|
39
|
+
**Optional** - The theme you want to use for the checkout.
|
|
40
|
+
|
|
41
|
+
Possible values are `light`, `dark` or `system`.
|
|
42
|
+
|
|
43
|
+
```md
|
|
44
|
+
<div data-whop-checkout-theme="light" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### **`data-whop-checkout-session-id`**
|
|
48
|
+
|
|
49
|
+
**Optional** - The session id to use for the checkout.
|
|
50
|
+
|
|
51
|
+
This can be used to attach metadata to a checkout by first creating a session through the API and then passing the session id to the checkout element.
|
|
52
|
+
|
|
53
|
+
```md
|
|
54
|
+
<div data-whop-checkout-session-id="ch_XXXXXXXXX" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Full example
|
|
58
|
+
|
|
59
|
+
```md
|
|
60
|
+
<!DOCTYPE html>
|
|
61
|
+
<html>
|
|
62
|
+
<head>
|
|
63
|
+
<meta charset="utf-8">
|
|
64
|
+
<meta name="viewport" content="width=device-width">
|
|
65
|
+
<script
|
|
66
|
+
async
|
|
67
|
+
defer
|
|
68
|
+
src="https://cdn.jsdelivr.net/npm/@whop/checkout@0.0.21-canary.8/dist/loader.js"
|
|
69
|
+
></script>
|
|
70
|
+
<title>Whop embedded checkout example</title>
|
|
71
|
+
<style>
|
|
72
|
+
div {
|
|
73
|
+
box-sizing: border-box;
|
|
74
|
+
}
|
|
75
|
+
body {
|
|
76
|
+
margin: 0
|
|
77
|
+
}
|
|
78
|
+
</style>
|
|
79
|
+
</head>
|
|
80
|
+
<body>
|
|
81
|
+
<div
|
|
82
|
+
data-whop-checkout-plan-id="plan_XXXXXXXXX"
|
|
83
|
+
data-whop-checkout-session-id="ch_XXXXXXXXX"
|
|
84
|
+
data-whop-checkout-theme="light"
|
|
85
|
+
style="height: fit-content; overflow: hidden; max-width: 50%;"
|
|
86
|
+
></div>
|
|
87
|
+
</body>
|
|
88
|
+
</html>
|
|
89
|
+
```
|
package/license.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Whop, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whop/checkout",
|
|
3
|
-
"
|
|
3
|
+
"description": "Embed Whop checkout on any website",
|
|
4
|
+
"version": "0.0.22",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/whopio/whop-sdk-ts",
|
|
8
|
+
"directory": "packages/checkout"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"whop",
|
|
12
|
+
"checkout",
|
|
13
|
+
"embedded",
|
|
14
|
+
"payments"
|
|
15
|
+
],
|
|
16
|
+
"bugs": "https://github.com/whopio/whop-sdk-ts/issues",
|
|
17
|
+
"homepage": "https://whop.com/developers/",
|
|
18
|
+
"license": "MIT",
|
|
4
19
|
"main": "./dist/index.cjs",
|
|
5
20
|
"module": "./dist/index.mjs",
|
|
6
21
|
"types": "./dist/index.d.ts",
|