#bird-paymentintent-paymentmethod
1 messages ยท Page 1 of 1 (latest)
@cunning marsh do you have a more specific question? That PaymentIntent was created successfully and then you didn't do anything else with it. So what's the real problem?
ahh, ok. Well I have a simple elements form it hits this method:
public function charge($amount){ if (!auth()->user()->stripeCustomer()->exists()) { $stripeCustomer = \Stripe\Customer::create(); \App\Models\StripeCustomer::create([ 'user_id' => auth()->user()->id, 'stripe_id' => $stripeCustomer->id, ]); } try { return \Stripe\PaymentIntent::create([ 'setup_future_usage' => 'off_session', 'amount' => $amount, 'currency' => 'usd', 'customer' => auth()->user()->stripeCustomer->stripe_id, 'automatic_payment_methods' => ['enabled' => true], ], ['api_key' => $this->apiKey]); } catch (InvalidRequestException $e) { throw new PaymentFailedException(); }}
that's just a dump of unformatted server-side PHP code. What is your question?
bird-paymentintent-paymentmethod
ok, tried to format a bit. So a user selects quantity and when they hit submit this charge() method is hit. It check if there is a stripeCustomer. If not, it creates one.
Then a payment intent is created, and the system creates one of our own orders.
So, what from stripes perspective needs to happen after the PaymentIntent is created?
It seems like all the info should be available?
it's a card element
I'm sorry I have no idea what any of this could mean at all. You keep talking about " a card element" but also only share PHP code
A PaymentIntent represents the intent to accept a payment from a Customer for a certain amount/currency. Creating it is solely that intent, it doesn't "charge" a card or anything
I'm upgrading from the 2018 api. So that used to have a charge object. Is there an equavalent for this?
just uploaded the js/blade.php file where the form lives.
I'm not going to read a file with 500 lines of code I'm sorry. You are the developer here, you own this code, I can help with Stripe-specific developers questions.
If you ask me your specific question I can help you narrow it down.
Right now it looks like you might be confused by PaymentIntents entirely so I'd recommend reading those two docs first: https://stripe.com/docs/payments/payment-intents and https://stripe.com/docs/payments/payment-intents/migration
Hey no prob. just deleted. I thought it was specific - please pardon me there if it is not clear.
After creating a payment intent a charge did not get made with a payment card element.
๐ Hopping in here - are you sure you're actually confirming the PaymentIntent?
yea, that seems to be what I'm missing. Appreciate that last doc. It seems like I should have a separate method for createPaymentIntent then return that to the browser, then confirm. It seems like I had the order of things messed up with the old charge payment flow....
going to step away for lunch but will be back...
๐ (we usually archive threads if it's been more than an hour since the last response, but if this thread is closed by the time your back feel free to ask again in the main channel)
It seems like I should have a separate method for createPaymentIntent then return that to the browser, then confirm.
Yup, generally that's how the flow should work