Skip to content

[SDK] Respect feePayer property in Payment widgets #7533

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

Merged
merged 1 commit into from
Jul 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/angry-dragons-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

Respect feePayer property in Payment widgets
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ export function BridgeOrchestrator({
amount={state.context.destinationAmount}
client={client}
destinationToken={state.context.destinationToken}
mode={uiOptions.mode}
onBack={() => {
send({ type: "BACK" });
}}
Expand All @@ -302,6 +301,7 @@ export function BridgeOrchestrator({
paymentMethod={state.context.selectedPaymentMethod}
purchaseData={purchaseData}
receiver={state.context.receiverAddress}
uiOptions={uiOptions}
/>
)}

Expand Down
14 changes: 9 additions & 5 deletions packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { Container } from "../components/basic.js";
import { Spacer } from "../components/Spacer.js";
import { Spinner } from "../components/Spinner.js";
import { Text } from "../components/text.js";
import type { UIOptions } from "./BridgeOrchestrator.js";

interface QuoteLoaderProps {
/**
Expand Down Expand Up @@ -78,14 +79,13 @@ interface QuoteLoaderProps {
paymentLinkId?: string;

/**
* Fee payer for direct transfers (defaults to sender)
* UI options
*/
feePayer?: "sender" | "receiver";
mode: "fund_wallet" | "direct_payment" | "transaction";
uiOptions: UIOptions;
}

export function QuoteLoader({
mode,
uiOptions,
destinationToken,
paymentMethod,
amount,
Expand All @@ -96,10 +96,14 @@ export function QuoteLoader({
onError,
purchaseData,
paymentLinkId,
feePayer,
}: QuoteLoaderProps) {
// For now, we'll use a simple buy operation
// This will be expanded to handle different bridge types based on the payment method
const feePayer =
uiOptions.mode === "direct_payment"
? uiOptions.paymentInfo.feePayer
: undefined;
const mode = uiOptions.mode;
const request: BridgePrepareRequest = getBridgeParams({
amount,
client,
Expand Down
3 changes: 3 additions & 0 deletions packages/thirdweb/src/react/web/ui/PayEmbed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ export function PayEmbed(props: PayEmbedProps) {
chain={props.payOptions.paymentInfo.chain}
client={props.client}
description={metadata?.description}
feePayer={
props.payOptions.paymentInfo.feePayer === "sender" ? "user" : "seller"
}
image={metadata?.image}
name={metadata?.name || "Checkout"}
onSuccess={() => props.payOptions?.onPurchaseSuccess?.()}
Expand Down
Loading