@htmlbricks/hb-payment-paypal
v0.71.16
Published
Loads the PayPal JS SDK with your client id and currency, renders PayPal Buttons for a fixed order total, captures payment on approval, and dispatches paymentCompleted when the order is captured successfully.
Readme
hb-payment-paypal — payment PayPal
Category: commerce
Tags: commerce, payment
What it does
Loads the PayPal JS SDK with your client id and currency, renders PayPal Buttons for a fixed order total, captures payment on approval, and dispatches paymentCompleted when the order is captured successfully.
Custom element
hb-payment-paypal
Attributes (snake_case; use string values in HTML)
id,style(optional): strings.paypalid(required): string — PayPal client / app id.currency(required):"EUR"|"USD"(string).total(required): number as string — order amount.
Events
paymentCompleted:{ method: "paypal"; total: number }.
Usage notes
- CSS variables:
--hb-checkout-border, Bulma--bulma-*(seeextra/docs.ts). - CSS parts:
btn(PayPal button surface). - Ensure CSP and PayPal script loading match your host app; totals are fixed for the rendered session.
Styling (Bulma)
Bulma theme tokens are applied on :host only; the PayPal SDK injects its own button UI into #paypalbtn. Use --bulma-* for consistency with sibling checkout components.
Minimal HTML example
<hb-payment-paypal paypalid="YOUR_CLIENT_ID" currency="EUR" total="40"></hb-payment-paypal>