#arya_code

1 messages · Page 1 of 1 (latest)

warped rapidsBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1345006520533782610

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

forest tangle
#

👋 happy to help

#

you're still updating the code it seems

mellow gulch
#

yes

#

done now

#

check it, what getting wrong

forest tangle
#

you shouldn't create a separate PaymentIntent to start a subscription

mellow gulch
#

then can you give the write code for creating correct implementation

forest tangle
mellow gulch
#

import React from "react";
import { loadStripe } from "@stripe/stripe-js";
import { Elements } from "@stripe/react-stripe-js";
import ClientPaymentPage from "./ClientPaymentPage";

const stripePromise = loadStripe(
"pk_test_51OyaTISEYHxd3PYrdMFKgz5nbQMcKawMQZEeTnqbv7oYitmSWdP6bZ2TlJcz8MHZEaIU77xaB8O3XKfs9yfwqwGm006kxTkgRh"
);

const PaymentParentComponent = () => {
return (
<Elements stripe={stripePromise}>
<ClientPaymentPage />
</Elements>
);
};

export default PaymentParentComponent;

#

Can You review it?

forest tangle
#

yes but you can do the same with the subscription integration

#

instead of creating the PaymentIntent you create the subscription and use the latest_invoice.payment_intent.client_secret

mellow gulch
#

review it once, for making subscription in best way

forest tangle
#

I'm not sure I understand what you mean

mellow gulch
#

Firstly I have register the customer on my db along with registered them on stripe, then taking payment then subscribing them

forest tangle
#

that's not how we recommend implementing subscriptions

#

you can collect the PaymentMethod before creating the subscription if you want but not the way you're describing

mellow gulch
#

Can you guide me the flow in better way, like I have priceId for the product instead of Directly implementation of amount
as you have recommended the code as
import React from 'react';
import ReactDOM from 'react-dom';
import {Elements} from '@stripe/react-stripe-js';
import {loadStripe} from '@stripe/stripe-js';

import CheckoutForm from './CheckoutForm';

// Make sure to call loadStripe outside of a component’s render to avoid
// recreating the Stripe object on every render.
const stripePromise = loadStripe('pk_test_51OyaTISEYHxd3PYrdMFKgz5nbQMcKawMQZEeTnqbv7oYitmSWdP6bZ2TlJcz8MHZEaIU77xaB8O3XKfs9yfwqwGm006kxTkgRh');

function App() {
const options = {
mode: 'subscription',
amount: 1099,
currency: 'usd',
// Fully customizable with appearance API.
appearance: {/.../},
};

return (
<Elements stripe={stripePromise} options={options}>
<CheckoutForm />
</Elements>
);
};

ReactDOM.render(<App />, document.getElementById('root'));

#

const options = {
mode: 'subscription',
amount: 1099,
currency: 'usd',
// Fully customizable with appearance API.
appearance: {/.../},
};
Here it hardcoded the amount, but I want to share the priceId instead of amount and currency

#

Here on Clicking next, The user is getting registered, then

#

navigated to payment page

#

This is the flow I want

forest tangle
#

and on the "submit payment" click you would create the subscription and then confirm the Payment of the latest_invoice.payment_intent on the frontend

#

before we proceed, please take the time to go through the doc I shared with you

#

and then I would be happy to answer any follow-up questions

mellow gulch
#

Ok

warped rapidsBOT
mellow gulch
#

Can you give the reference to create payment intent in node js

noble bay
#

All the code snippets are available in all supported languages:

mellow gulch
#

Yah, but I need the doc link where it's guided to implement the intent

noble bay