#directmarketplace
1 messages ยท Page 1 of 1 (latest)
Hello! Yep, this is called a direct charge, and it happens on the connected account. To clarify, are you trying to write code to do this?
Yes please using node js
And you specifically want to create a Payment Link for this?
I am open to all options. I need to put a link on my web page to take the customer to the Check Out but if we need to do multiple steps I am open to that too. The goal is the customer clicks a link, they end up on some kind of payment / check out page and make the purchase. Then they are redirected to a successful page afterwards for processing. This is for a STANDARD account. Not express or custom. Thanks
CUSTOMER buys from MERCHANT is critical
I recommend you create Checkout Sessions as needed: https://stripe.com/docs/api/checkout/sessions
And create them on the connected account: https://stripe.com/docs/connect/authentication
Curl requires a server. Can we do this in node js
And specify an application fee: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-application_fee_amount
There are code snippets for Node there. Node also requires a server though... do you have a web server for this?
This is done as a Lambda Function using Node JS so no server
I mean, the lambda function runs on a server.
The cloud is just someone else's server. ๐
But yeah, my recommendation remains the same.
The link from our web page can run the Lambda Function the response needs to be a redirect to a Check Out / Payment Page
Yep, it will be. Once you create the Checkout Session with the options you want you can respond to the request with a redirect to the Checkout Session's url.
const stripe = require('stripe')('sk_test_your_key');
const session = await stripe.checkout.sessions.create({
success_url: 'https://example.com/success',
line_items: [
{price: 'price_H5ggYwtDq4fbrJ', quantity: 2},
],
mode: 'payment',
});
This makes no mention of the connected account. How do we connect it
You create the Checkout Session on the connected account. Instructions for making API requests on Connected accounts are in the link I shared above.
And create them on the connected account: https://stripe.com/docs/connect/authentication
I'm sorry I don't understand. The code doesn't have a connected account variable as an option. Can you please type sample syntax here. Sorry for being a bit thick
The first ref is curl i need to use node
The example syntax is in the pages I linked above. Look at the Node example here: https://stripe.com/docs/connect/authentication#stripe-account-header
You can switch to Node on any of these examples.
OK
this is for const paymentIntent = await stripe.paymentIntents.create(
There is no option here for admin fee or success url
When I look at checkout there is mention of connected account
Yes, there is. I linked you directly to the option to specify an application fee above:
And specify an application fee: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-application_fee_amount
Its is confusion hence the reason I am askig for help. Can you please show me a simple piece of hand written code in node
And the success_url is in the API reference here: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-success_url
onst paymentIntent = await stripe.paymentIntents.create(
Why are you creating a Payment Intent?
I agree it has a redirect success URL but no connected account or admin fee
That's just an example for how to make a request on a connected account. You need to understand the overall concepts being used here before you can write the code you need for your specific use case.
One sec.
Ah, we have a guide you can follow here: https://stripe.com/docs/connect/creating-a-payments-page?destination-or-direct=direct-charges
Read that end-to-end and let me know if you have questions.
Please lets not go round and round in circles. The docs are clearly confusing. Can you please show me a simple piece of code in node that does all 3 tasks. 1) Admin Fee, 2) Redirect on Success 3) Connected Account, 4) Details of the offer because the web pages don't show it and I have wasted ober 30 hours already trying to guess. Thank you so much I really appreciate it
Please have a look at the guide I linked above, I think it's exactly what you need all in one place.
If it's not let me know.
Checking
This seems right. I am programming a test. Please keep this chat open. Thank you
This thread will remain open for a little while, but we do close idle threads after a time. You can always ask new questions in #dev-help if you come back and find this thread closed though. ๐
So close. OK 1) Product YES, 2) Merchant Page YES, 3) Admin Fee paid YES, 4) Redirection on success YES. But its just my web page in the redirect. I need some kind of ref in the URL to be able to check the transaction e.g. checkout_id or something. What change do I need to make to my success url. Thanjs
in the code. Thanks
You can put the Checkout Session ID in the success_url: https://stripe.com/docs/payments/checkout/custom-success-page#modify-success-url
Wherever you put {CHECKOUT_SESSION_ID} in your success_url it will be replaced with the Checkout Session ID when the redirect happens.
OK that works. I would like to include a membership id . There doesn't seem to be an option to add meta data in the example. Any thoughts?
To clarify, where do you want to include the membership ID? Are you still talking about the URL, or do you want to add it as metadata to the Checkout Session?
OK so link on web page has memberid in query string . The link is processed in the node function where we can grab the membership id and put it somewhere in the code, then the chot url is created and we redirect to that page. Then the customer buys and we are redirected to my success url which includes the CHECKOUT_SESSION_ID. I then do an api call using that ID to get the data on the transaction which should include the Membership Fee added earlier. Make sense? The code example does not mention meta data as an option
Maybe we use it in the URL generated by the node code which what I used to do with payment links
The code example is just that, an example, and excludes many possible options. It's very important to understand how to read and use the API reference. For example, the API reference explains that you can specify metadata on the Checkout Session when you create it: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-metadata
If you have any questions about how to read and make use of the API reference just let me know, I'd be happy to help!
Finally. Yeah! I would like to use the CHECKOUT_SESSION_ID to get the details of the transaction using node. Can you kindly show me the link for same. Thanks
You can retrieve a Checkout Session by ID using this endpoint: https://stripe.com/docs/api/checkout/sessions/retrieve
k
OK there is a problem. This is expecting for the CHECKOUT_SESSION_ID to belong to me. How do I adapt this request to reference the connected account. Thanks
"errorMessage": "No such checkout.session: cs_test_a1zFpzpt8dBTAAwrx3oUpubSg46rb6HW3lJuISJ8zKgKVbXwF8QJRLeDiP",
Hi, stepping in here and catching up.
Its just the last step I need help with. Everything else is wrking yeah!
You would use the Stripe Account Header, https://stripe.com/docs/connect/authentication when making the retrieve a Checkout Session using that endpoint, https://stripe.com/docs/api/checkout/sessions/retrieve. Similar to how you made the request to create a Checkout Session: https://dashboard.stripe.com/test/logs/req_ea1nz4vE2wqkS6
Is it possible to create products as a market place vs creating them on the merchant's account. Currently we would get an error of price_id not recognised because its looking for it in the connected account.
Whilst maintaing DIRECT PAYMENT on STANDARD ACCOUNT
If not can we create products ourselves and add them to the merchants account with an api
That is not possible, you'd need to create products and prices, https://stripe.com/docs/products-prices/how-products-and-prices-work on the Connected Accounts using the API with Stripe Account Header.
If not can we create products ourselves and add them to the merchants account with an api. Is there a link for that we use node
You can directly create the Products and Prices on the Connected Account using the Stripe Account Headers with this https://stripe.com/docs/api/products/create endpoint.
@sharp hollow were you able to make a successful retrieve request for that Checkout Session?
OK great thank you everyone for your help today. Please close thread