#Nash - Charges API
1 messages · Page 1 of 1 (latest)
Hey there, whats the flow you're trying to achieve here? These checks are still available, but the sequence can be a bit different.
Note these are also available via Radar to handle automatically rather than in code, if prefered.
Hi! I think we want it in code. Flow is the following:
- On form submit, we create an intent and a customer.
- We confirmCarPayment once we get the clientSecret back from the intent.
I guess, I want to check on these variables before step 2.
Is it fine if I created a token with createToken and passed that to our backend for the sole purpose of these checks?
Yes, though if you're switching I'd also suggest using Payment Methods (createPaymentMethod) and then you can attach that to a customer
That's the thing. I'm not switching. Keep using intents as described above, but in step 1, I would pass the token with the request to our backend so we can check these.
Alternatively you can use separate auth & capture to confirm directly but allow yourself a chance to inspect that outcome before capturing the payment:
Yeah that would add more complexity than needed at this point.
So I'm thinking create a token just for these checks. Just want to make sure it's kosher if I do so while using intents.
I won't be attaching that to customer or anything.
Just use it to retrieve card and do some checks.
to link customer to payment, I'll just update the intent with the customer id as described in docs.
Those checks won't be available unless attached to a customer to trigger an auth
ah I see.
If I attach payment token to customer, can I update intent with that customer as well?
So customer has payment token attached. Then intent has same customer attached.
Yes, in fact you must provide that customer on the payment intent or you'll encounter an API error, which will tell you the card/PM is attached to cus_123
ok, cool. Will give that a shot. I also found this, so it seems I can pass that instead of card element to the confirmCardPayment. https://stripe.com/docs/js/payment_intents/confirm_card_payment#stripe_confirm_card_payment-token