Skip to content

Commit 09ff383

Browse files
committed
return url
1 parent f885bd9 commit 09ff383

File tree

14 files changed

+40
-5
lines changed

14 files changed

+40
-5
lines changed

bifrost/lib/clients/jawnTypes/private.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,7 @@ export interface components {
815815
CreateCloudGatewayCheckoutSessionRequest: {
816816
/** Format: double */
817817
amount: number;
818+
returnUrl?: string;
818819
};
819820
UpgradeToProRequest: {
820821
addons?: {

bifrost/lib/clients/jawnTypes/public.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2195,6 +2195,7 @@ Json: JsonObject;
21952195
CreateCloudGatewayCheckoutSessionRequest: {
21962196
/** Format: double */
21972197
amount: number;
2198+
returnUrl?: string;
21982199
};
21992200
UpgradeToProRequest: {
22002201
addons?: {

docs/swagger.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5797,6 +5797,9 @@
57975797
"amount": {
57985798
"type": "number",
57995799
"format": "double"
5800+
},
5801+
"returnUrl": {
5802+
"type": "string"
58005803
}
58015804
},
58025805
"required": [

valhalla/jawn/src/controllers/public/stripeController.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export interface UpgradeToTeamBundleRequest {
3434

3535
export interface CreateCloudGatewayCheckoutSessionRequest {
3636
amount: number;
37+
returnUrl?: string;
3738
}
3839

3940
export enum PaymentIntentSearchKind {
@@ -153,6 +154,7 @@ export class StripeController extends Controller {
153154
const result = await stripeManager.createCloudGatewayCheckoutSession(
154155
request.headers.origin ?? "",
155156
body.amount,
157+
body.returnUrl,
156158
);
157159

158160
if (isError(result)) {

valhalla/jawn/src/managers/stripe/StripeManager.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,8 @@ WHERE (${builtFilter.filter})`,
12111211

12121212
public async createCloudGatewayCheckoutSession(
12131213
origin: string,
1214-
amount: number
1214+
amount: number,
1215+
returnUrl?: string
12151216
): Promise<Result<string, string>> {
12161217
try {
12171218
const customerId = await this.getOrCreateStripeCustomer();
@@ -1241,10 +1242,13 @@ WHERE (${builtFilter.filter})`,
12411242
const stripeFeeCents = percentageFeeCents + FIXED_FEE_CENTS;
12421243
const totalAmountCents = creditsAmountCents + stripeFeeCents;
12431244

1245+
const successUrl = returnUrl ? `${origin}${returnUrl}` : `${origin}/credits`;
1246+
const cancelUrl = returnUrl ? `${origin}${returnUrl}` : `${origin}/credits`;
1247+
12441248
const checkoutResult = await this.stripe.checkout.sessions.create({
12451249
customer: customerId.data,
1246-
success_url: `${origin}/credits`,
1247-
cancel_url: `${origin}/credits`,
1250+
success_url: successUrl,
1251+
cancel_url: cancelUrl,
12481252
mode: "payment",
12491253
line_items: [
12501254
{

valhalla/jawn/src/tsoa-build/private/routes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ const models: TsoaRoute.Models = {
267267
"dataType": "refObject",
268268
"properties": {
269269
"amount": {"dataType":"double","required":true},
270+
"returnUrl": {"dataType":"string"},
270271
},
271272
"additionalProperties": false,
272273
},

valhalla/jawn/src/tsoa-build/private/swagger.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,9 @@
615615
"amount": {
616616
"type": "number",
617617
"format": "double"
618+
},
619+
"returnUrl": {
620+
"type": "string"
618621
}
619622
},
620623
"required": [

valhalla/jawn/src/tsoa-build/public/routes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,6 +1854,7 @@ const models: TsoaRoute.Models = {
18541854
"dataType": "refObject",
18551855
"properties": {
18561856
"amount": {"dataType":"double","required":true},
1857+
"returnUrl": {"dataType":"string"},
18571858
},
18581859
"additionalProperties": false,
18591860
},

valhalla/jawn/src/tsoa-build/public/swagger.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5797,6 +5797,9 @@
57975797
"amount": {
57985798
"type": "number",
57995799
"format": "double"
5800+
},
5801+
"returnUrl": {
5802+
"type": "string"
58005803
}
58015804
},
58025805
"required": [

web/components/layout/SidebarHelpDropdown.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
CalendarIcon,
1515
FileTextIcon,
1616
MessageCircleMore,
17+
Zap,
1718
} from "lucide-react";
1819
import Link from "next/link";
1920
import { useEffect, useState } from "react";
@@ -93,6 +94,12 @@ const SidebarHelpDropdown = ({
9394
</Button>
9495
</DropdownMenuTrigger>
9596
<DropdownMenuContent className="ml-4 w-64 text-slate-700 dark:text-slate-200">
97+
<Link href="/quickstart">
98+
<DropdownMenuItem className="cursor-pointer">
99+
<Zap className="mr-2 h-4 w-4 text-slate-500" />
100+
Quickstart
101+
</DropdownMenuItem>
102+
</Link>
96103
<Link href="https://docs.helicone.ai" target="_blank">
97104
<DropdownMenuItem className="cursor-pointer">
98105
<FileTextIcon className="mr-2 h-4 w-4 text-slate-500" />

0 commit comments

Comments
 (0)