This commit is contained in:
CHIEFSOFT\ameye
2025-08-23 23:02:53 -04:00
parent bbd6ecac58
commit 2c6102dfa5
2 changed files with 6 additions and 4 deletions
@@ -8,7 +8,7 @@ import { useNavigate } from 'react-router-dom';
//const stripePromise = loadStripe('your_stripe_publishable_key');
const stripePromise = loadStripe('pk_test_51RqL5WLjZLojw6IZmEpwFidNZSl9lLlVUHNvuFZNEz1eTR9XXepnyyVhfvXe9cp4eMnqkDPpoe9wxLLRSV0dxRee00UfhayUOT');
const CheckoutForm = ({ priceId, customerId }) => {
const CheckoutForm = ({ priceId, customerId ,option_name }) => {
const stripe = useStripe();
const elements = useElements();
const navigate = useNavigate();
@@ -22,6 +22,7 @@ const CheckoutForm = ({ priceId, customerId }) => {
let reqData = {
priceId : priceId,
customerId: customerId,
option_name: option_name,
token: localStorage.getItem('token'), // USER TOKEN
uid: localStorage.getItem('uid') // USER UID
}
@@ -45,10 +46,10 @@ const CheckoutForm = ({ priceId, customerId }) => {
);
};
const StripeSubscriptionButton = ({ priceId, customerId }) => {
const StripeSubscriptionButton = ({ priceId, customerId ,option_name}) => {
return (
<Elements stripe={stripePromise}>
<CheckoutForm priceId={priceId} customerId={customerId} />
<CheckoutForm priceId={priceId} customerId={customerId} option_name={option_name} />
</Elements>
);
};
+2 -1
View File
@@ -13,6 +13,7 @@ export default function Subscribe() {
const {state: {selectedSubscription,customerId}} = useLocation()
console.log('selectedSubscription', selectedSubscription)
console.log('selectedSubscription.option_name',selectedSubscription.option_name)
console.log('customerId', customerId)
let [activePaymentType, setActivePaymentType] = useState('previous')
@@ -36,7 +37,7 @@ export default function Subscribe() {
<SubscribePreviousCard/>
}
<>
<StripeSubscriptionButton priceId={selectedSubscription.stripe_price_id} customerId={customerId} />
<StripeSubscriptionButton priceId={selectedSubscription.stripe_price_id} customerId={customerId} option_name={selectedSubscription.option_name} />
</>
</div>
</div>