diff --git a/Hyperswitch-React-Demo-App/.env b/Hyperswitch-React-Demo-App/.env index d2c398adf..2a32c4a34 100644 --- a/Hyperswitch-React-Demo-App/.env +++ b/Hyperswitch-React-Demo-App/.env @@ -1,6 +1,6 @@ STATIC_DIR=./dist -HYPERSWITCH_PUBLISHABLE_KEY= -HYPERSWITCH_SECRET_KEY= -HYPERSWITCH_SERVER_URL= -HYPERSWITCH_CLIENT_URL= +HYPERSWITCH_PUBLISHABLE_KEY="pk_snd_3b33cd9404234113804aa1accaabe22f" +HYPERSWITCH_SECRET_KEY="snd_c691ade6995743bd88c166ba509ff5da" +HYPERSWITCH_SERVER_URL="https://sandbox.hyperswitch.io" +HYPERSWITCH_CLIENT_URL="http://localhost:9050" diff --git a/Hyperswitch-React-Demo-App/server.js b/Hyperswitch-React-Demo-App/server.js index caddd6e02..99d95e9dd 100644 --- a/Hyperswitch-React-Demo-App/server.js +++ b/Hyperswitch-React-Demo-App/server.js @@ -45,8 +45,8 @@ app.get("/create-payment-intent", async (req, res) => { try { var paymentIntent; const request = { - currency: "USD", - amount: 2999, + currency: "EUR", + amount: 0, order_details: [ { product_name: "Apple iphone 15", @@ -60,7 +60,16 @@ app.get("/create-payment-intent", async (req, res) => { customer_id: "hyperswitch_sdk_demo_id", email: "hyperswitch_sdk_demo_id@gmail.com", description: "Hello this is description", - // allowed_payment_method_types:["sofort"], + profile_id: "pro_E6k4XxWE3fVzTIYDMzJa", + setup_future_usage: "off_session", + // mandate_data: { + // mandate_type: { + // single_use: { + // amount: 4000, + // currency: "USD", + // }, + // }, + // }, shipping: { address: { state: "zsaasdas", @@ -96,7 +105,7 @@ app.get("/create-payment-intent", async (req, res) => { city: "San Fransico", state: "California", zip: "94122", - country: "US", + country: "PT", first_name: "joseph", last_name: "Doe", }, diff --git a/Hyperswitch-React-Demo-App/src/CheckoutForm.js b/Hyperswitch-React-Demo-App/src/CheckoutForm.js index 3a1013d4b..62f93ba71 100644 --- a/Hyperswitch-React-Demo-App/src/CheckoutForm.js +++ b/Hyperswitch-React-Demo-App/src/CheckoutForm.js @@ -1,7 +1,7 @@ import { PaymentElement } from "@juspay-tech/react-hyper-js"; import Cart from "./Cart"; import { useState, useEffect } from "react"; -import { useHyper, useElements } from "@juspay-tech/react-hyper-js"; +import { useHyper, useWidgets } from "@juspay-tech/react-hyper-js"; import { useNavigate } from "react-router-dom"; import "./App.css"; import "./index"; @@ -10,7 +10,7 @@ import Completion from "./Completion"; export default function CheckoutForm() { const hyper = useHyper(); - const elements = useElements(); + const elements = useWidgets(); const navigate = useNavigate(); const [isSuccess, setSucces] = useState(false); @@ -104,6 +104,21 @@ export default function CheckoutForm() { height: 55, }, }, + // displaySavedPaymentMethodsCheckbox: false, + // displaySavedPaymentMethods: true, + // paymentMethodsHeaderText: "1ssttttt csdnjdnjcnsdjcds", + // savedPaymentMethodsHeaderText: "Saveddd", + business: { + name: "dscsndjkndsjnsc", + }, + showCardFormByDefault: false, + sdkHandleConfirmPayment: { + handleConfirm: true, + buttonText: "SDK Pay Now", + confirmParams: { + return_url: "http://localhost:9060/", + }, + }, }; return ( diff --git a/Hyperswitch-React-Demo-App/src/Payment.js b/Hyperswitch-React-Demo-App/src/Payment.js index b2b104a2f..1bea689cd 100644 --- a/Hyperswitch-React-Demo-App/src/Payment.js +++ b/Hyperswitch-React-Demo-App/src/Payment.js @@ -58,6 +58,7 @@ function Payment() { clientSecret, appearance: { labels: "floating", + theme: "brutal", }, }} > diff --git a/src/Components/SavedMethods.res b/src/Components/SavedMethods.res index 12c0729b4..6ac0ccaef 100644 --- a/src/Components/SavedMethods.res +++ b/src/Components/SavedMethods.res @@ -177,7 +177,7 @@ let make = ( useSubmitPaymentData(submitCallback) let conditionsForShowingSaveCardCheckbox = React.useMemo(() => { - !isGuestCustomer && list.payment_type !== SETUP_MANDATE && displaySavedPaymentMethodsCheckbox + !isGuestCustomer && list.payment_type === NEW_MANDATE && displaySavedPaymentMethodsCheckbox }, (isGuestCustomer, list.payment_type, displaySavedPaymentMethodsCheckbox))