#nowein-elements
1 messages ยท Page 1 of 1 (latest)
Can you share the code you're using? I think you're mixing up stripe-node and Stripe.js
Absolutely! So I have a React application that utilizes the Stripe React library (@stripe/react-stripe-js) and StripeJS (@stripe/stripe-js). I have a backend that utilizes the Stripe SDK (stripe). There are no issues with the backend API as I initialize it with the secret key. On my client (the React app) I'm accessing the stripe instance through context and the stripe wrapper
"stripe publishable api key, removed for security reasons"
);``` and want to call ```await stripe.createSource(cardElement, {
type: "card",
currency: "usd",
customer: customerId,
owner: {
name: "Some Name",
},
});
so that I may store the card before the payment as a source on the customer but I get this back from response from Stripe
doc_url: "https://stripe.com/docs/error-codes/secret-key-required"
message: "This API call cannot be made with a publishable API key. Please use a secret API key. You can find a list of your API keys at https://dashboard.stripe.com/account/apikeys."
type: "invalid_request_error```
All of this is happening client-side as it's the StripeJS library. I wanted to setup a source and confirm a payment intent all on client-side
I am fairly sure this error can not happen with the code you shared
but let's pause for a sec: why are you trying to create a Source
it's deprecated and has been for years and is not a normal integration
I was using sources since PaymentIntents don't support ACH yet
Needed something consistent to take transactions of either cards or ACH debit/credit transfer
but your code example does card are you sure you didn't get the error for ACH Credit Transfer?
that one can not be created client-side. Also ACH Debit does not work on Source either
@wheat field does that make sense?
Yes, the card example does card but I wanted to keep it consistent across all types, but it looks like I just can't
correct you can't
So what would you recommend? confirmCardSetup?
If you have a SetupIntent then yes that's what you would call for Cards
What if I have a PaymentIntent already? (Ex: a invoice is sent.) But I want to store the card that's used for that payment for later usage? Does a Setup Intent still need to be ran?
If you're collect payment via a payment intent, you can use setup_future_usage=off_session in to save the card during the payment.
https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage
https://stripe.com/docs/payments/save-during-payment
You mentioned an invoice, how does that come into play here?
Ah, gotcha. Thank you! Sorry, I'm pretty new to Stripe.
Invoices are what I'm using for capturing payments on. I have an invoice and there's a payment intent in the invoice. Using StripeJS and Elements to capture card details and pay/save card for payment later for a customer. Want to do the same for ACH, but how would you recommend going about that given no support from PaymentIntent?
THat's ok ๐
I think I tried this but got an error on payment_method_types including other payment types than just card. I'll try it again
So that's a bit different, using the payment intent wrapped within an invoice, it's managed for you by the invoice
Well, its very different. Our guide for setting up ACH payments starts here: https://stripe.com/docs/ach#manually-collecting-and-verifying-bank-accounts
But also note the link for the beta using the new version of this. YOu mentioned wanting to keep things more unified, i'd suggest signing up for that beta as it would be an integration option more closely aligned
Ahh I thought that beta was reserved for a select few. I didn't know you could sign up
well, registering interest would have been a better way to say that
Cool, thanks!
you're welcome ๐