options
This commit is contained in:
@@ -8,7 +8,7 @@ import { useNavigate } from 'react-router-dom';
|
|||||||
//const stripePromise = loadStripe('your_stripe_publishable_key');
|
//const stripePromise = loadStripe('your_stripe_publishable_key');
|
||||||
const stripePromise = loadStripe('pk_test_51RqL5WLjZLojw6IZmEpwFidNZSl9lLlVUHNvuFZNEz1eTR9XXepnyyVhfvXe9cp4eMnqkDPpoe9wxLLRSV0dxRee00UfhayUOT');
|
const stripePromise = loadStripe('pk_test_51RqL5WLjZLojw6IZmEpwFidNZSl9lLlVUHNvuFZNEz1eTR9XXepnyyVhfvXe9cp4eMnqkDPpoe9wxLLRSV0dxRee00UfhayUOT');
|
||||||
|
|
||||||
const CheckoutForm = ({ priceId, customerId }) => {
|
const CheckoutForm = ({ priceId, customerId ,option_name }) => {
|
||||||
const stripe = useStripe();
|
const stripe = useStripe();
|
||||||
const elements = useElements();
|
const elements = useElements();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -22,6 +22,7 @@ const CheckoutForm = ({ priceId, customerId }) => {
|
|||||||
let reqData = {
|
let reqData = {
|
||||||
priceId : priceId,
|
priceId : priceId,
|
||||||
customerId: customerId,
|
customerId: customerId,
|
||||||
|
option_name: option_name,
|
||||||
token: localStorage.getItem('token'), // USER TOKEN
|
token: localStorage.getItem('token'), // USER TOKEN
|
||||||
uid: localStorage.getItem('uid') // USER UID
|
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 (
|
return (
|
||||||
<Elements stripe={stripePromise}>
|
<Elements stripe={stripePromise}>
|
||||||
<CheckoutForm priceId={priceId} customerId={customerId} />
|
<CheckoutForm priceId={priceId} customerId={customerId} option_name={option_name} />
|
||||||
</Elements>
|
</Elements>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export default function Subscribe() {
|
|||||||
const {state: {selectedSubscription,customerId}} = useLocation()
|
const {state: {selectedSubscription,customerId}} = useLocation()
|
||||||
|
|
||||||
console.log('selectedSubscription', selectedSubscription)
|
console.log('selectedSubscription', selectedSubscription)
|
||||||
|
console.log('selectedSubscription.option_name',selectedSubscription.option_name)
|
||||||
console.log('customerId', customerId)
|
console.log('customerId', customerId)
|
||||||
|
|
||||||
let [activePaymentType, setActivePaymentType] = useState('previous')
|
let [activePaymentType, setActivePaymentType] = useState('previous')
|
||||||
@@ -36,7 +37,7 @@ export default function Subscribe() {
|
|||||||
<SubscribePreviousCard/>
|
<SubscribePreviousCard/>
|
||||||
}
|
}
|
||||||
<>
|
<>
|
||||||
<StripeSubscriptionButton priceId={selectedSubscription.stripe_price_id} customerId={customerId} />
|
<StripeSubscriptionButton priceId={selectedSubscription.stripe_price_id} customerId={customerId} option_name={selectedSubscription.option_name} />
|
||||||
</>
|
</>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user