#nowein-elements

1 messages ยท Page 1 of 1 (latest)

radiant nest
#

Can you share the code you're using? I think you're mixing up stripe-node and Stripe.js

wheat field
#

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

radiant nest
#

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

wheat field
#

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

radiant nest
#

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?

wheat field
#

Yes, the card example does card but I wanted to keep it consistent across all types, but it looks like I just can't

radiant nest
#

correct you can't

wheat field
#

So what would you recommend? confirmCardSetup?

radiant nest
#

If you have a SetupIntent then yes that's what you would call for Cards

wheat field
#

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?

sleek shadow
wheat field
#

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?

sleek shadow
#

THat's ok ๐Ÿ™‚

wheat field
sleek shadow
#

So that's a bit different, using the payment intent wrapped within an invoice, it's managed for you by the invoice

#

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

wheat field
#

Ahh I thought that beta was reserved for a select few. I didn't know you could sign up

sleek shadow
#

well, registering interest would have been a better way to say that

wheat field
#

Cool, thanks!

sleek shadow
#

you're welcome ๐Ÿ™‚