#vell2x
1 messages · Page 1 of 1 (latest)
Where do you post/fetch? Is it at client or server?
Can you share example code which you use with fetch?
Server. I am currently using POST
app.post('/v1/customers', async (req, res) =>
I am researching FETCH. Looking for general advice
Even with fetch, it also uses post eventually: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
Since you use NodeJS, why don't you use Stripe Node SDK which helps you to handle the HTTP and you only need to send in the parameters?
For example: https://stripe.com/docs/api/customers/create?lang=node
const customer = await stripe.customers.create({
description: 'My First Test Customer (created for API docs at https://www.stripe.com/docs/api)',
});
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Do you have an example for creating a customer? Ive been trying to find one in your samples github
The above code I shared is the example to create the customer with Node
You can set additional parameter such as email address to email field or customer's name to name field with reference from the spec: https://stripe.com/docs/api/customers/create?lang=node
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Ok. I will try it.