import Link from "next/link"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { Toaster } from "react-hot-toast"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc"; import { Button, showToast, TextField } from "@calcom/ui"; export default function PayPalSetup() { const [newClientId, setNewClientId] = useState(""); const [newSecretKey, setNewSecretKey] = useState(""); const router = useRouter(); const { t } = useLocale(); const integrations = trpc.viewer.integrations.useQuery({ variant: "payment", appId: "paypal" }); const [paypalPaymentAppCredentials] = integrations.data?.items || []; const [credentialId] = paypalPaymentAppCredentials?.userCredentialIds || [-1]; const showContent = !!integrations.data && integrations.isSuccess && !!credentialId; const saveKeysMutation = trpc.viewer.appsRouter.updateAppCredentials.useMutation({ onSuccess: () => { showToast(t("keys_have_been_saved"), "success"); router.push("/event-types"); }, onError: (error) => { showToast(error.message, "error"); }, }); if (integrations.isLoading) { return
; } return (
{showContent ? (
Paypal Payment Logo

Paypal

setNewClientId(e.target.value)} role="presentation" /> setNewSecretKey(e.target.value)} /> {/* Button to submit */}

Setup instructions

    {/* @TODO: translate */}
  1. Log into your Paypal Developer account and create a new app{" "} {t("here")} .
  2. Choose a name for your application.
  3. Select Online payments solution.
  4. Choose "No" for "Using online platform".
  5. CheckoutAPI as integration product.
  6. Accept terms and Create APP.
  7. Go back to dashboard, click on new app and copy the credentials.
  8. Paste them on the required field and save them.
  9. You're all setup.
) : (
Paypal
)}
); }