Skip to content

Commit 394163e

Browse files
Merge pull request #10 from nyxCore-Systems/feat/paypal-donate-button
feat(donate): swap donation button to classic PayPal Donate form
2 parents 0fb97dc + f2e2e3e commit 394163e

2 files changed

Lines changed: 36 additions & 8 deletions

File tree

src/components/noir/sections/NoirDonateSection.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import Link from 'next/link'
22
import { NOIR_DONATE_DEFAULTS, type NoirDonateContent } from '@/lib/noir-home-defaults'
33
import PayPalHostedButton from './PayPalHostedButton'
4+
import PayPalDonateButton from './PayPalDonateButton'
45

5-
// PayPal "No-Code Payments" hosted buttons, embedded inline (lazy-loaded + try/catch
6-
// with a graceful link fallback — see PayPalHostedButton). Ticket + donation IDs:
6+
// Tickets use a PayPal "No-Code Payments" hosted button (SDK, iframe-isolated —
7+
// see PayPalHostedButton). Donations use the classic PayPal "Donate" button (a
8+
// plain <form>, see PayPalDonateButton) — a different PayPal product + id, no SDK.
79
const PAYPAL_TICKET_BUTTON = 'MGNNL73RQ88DG'
8-
const PAYPAL_DONATE_BUTTON = 'QT6LRLS3DQTW4'
10+
const PAYPAL_DONATE_BUTTON = 'GCRR5BM8K8D22'
911
const ncpUrl = (id: string) => `https://www.paypal.com/ncp/payment/${id}`
1012

1113
export default function NoirDonateSection({ content }: { content?: NoirDonateContent | null }) {
@@ -77,11 +79,7 @@ export default function NoirDonateSection({ content }: { content?: NoirDonateCon
7779
<div className="nh-lab">Spenden</div>
7880
<h3>{cardHeading}</h3>
7981
<p className="nh-card-sub">{cardSubtext}</p>
80-
<PayPalHostedButton
81-
hostedButtonId={PAYPAL_DONATE_BUTTON}
82-
fallbackUrl={ncpUrl(PAYPAL_DONATE_BUTTON)}
83-
fallbackLabel="Jetzt spenden via PayPal"
84-
/>
82+
<PayPalDonateButton hostedButtonId={PAYPAL_DONATE_BUTTON} label="Jetzt spenden via PayPal" />
8583
<div className="nh-bank">
8684
<div className="nh-bank-title">Spendenkonto</div>
8785
<dl className="nh-bank-list">
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Classic PayPal "Donate" button — a plain HTML <form> POSTing to
2+
// paypal.com/donate with a hosted_button_id. Unlike the hosted-button *SDK*
3+
// (see PayPalHostedButton, which had to be iframe-isolated because the SDK's
4+
// JS broke the site nav), this loads NO PayPal script — it's just a form
5+
// submit — so it's safe to render inline as a server component and carries no
6+
// DOM/layout side effects. Styled as the site's gold button; opens PayPal in a
7+
// new tab so the visitor keeps our page open.
8+
export default function PayPalDonateButton({
9+
hostedButtonId,
10+
label,
11+
}: {
12+
hostedButtonId: string
13+
label: string
14+
}) {
15+
return (
16+
<form
17+
action="https://www.paypal.com/donate"
18+
method="post"
19+
target="_blank"
20+
rel="noopener noreferrer"
21+
className="nh-pp-donate"
22+
style={{ margin: 0 }}
23+
>
24+
<input type="hidden" name="hosted_button_id" value={hostedButtonId} />
25+
<button type="submit" className="nh-ticket-btn">
26+
{label} &rarr;
27+
</button>
28+
</form>
29+
)
30+
}

0 commit comments

Comments
 (0)