summaryrefslogtreecommitdiff
path: root/src/components/PaypalProductButtons.astro
blob: 0ebbd3f5a344e7e82837402f36e08faad688a08f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
---
import env from '$lib/env';
import type Price from '$types/Price';

interface Props {
  successPageUrl: string;
  productDescription: string;
  shortDescription: string;
  totalPrice: Price;
}

const { successPageUrl, productDescription, shortDescription, totalPrice } = Astro.props;

const PAYPAL_CLIENT_ID =
  env.ENVIRONMENT === 'prod' ? env.PAYPAL_LIVE_CLIENT_ID : env.PAYPAL_SANDBOX_CLIENT_ID;
---

<paypal-product-buttons
  paypal-client-id={PAYPAL_CLIENT_ID}
  success-page-url={successPageUrl}
  product-description={productDescription}
  short-description={shortDescription}
  total-price={totalPrice}
>
  Loading PayPal buttons…
</paypal-product-buttons>