I’m trying to save a credit card for future payment.
The payment method is created, but it is not attached to the customer at stripe.
I am using Create Setup Intent and it is returning:
And on success of the Setup created dynamic event, I am executing a Create Payment Method:
The payment method is created, but customer is null. There is not place to bind the client secret to the other actions, so I’m assuming Wappler is doing this?
Ideas on why this doesn’t work?
George
April 7, 2021, 4:43pm
2
Did you pass a customer Id to the create setup intent?
You should first lookup or create the stripe customer then pass its id to the create setup intent action
Yep, triple checked that a valid customer id is being passed.
George
April 7, 2021, 4:51pm
5
Well according to the stripe docs it should get attached:
https://stripe.com/docs/api/setup_intents/create#create_setup_intent-customer
Try to output it with set value just before the create setup intent to be sure it has a value.
Should have provided this earlier…the customer is shown as being set on the Create Setup Intent output:
@George do I have the proper logic here?
On the front end I have:
Stripe object that calls createPaymentMethod after success of Setup Intent:
George
April 7, 2021, 5:28pm
8
What is your goal? To just let the user enter credit card and save it?
Then the flow is exactly the same as:
Intro
You can create your own custom checkout forms for Stripe. Custom forms allow you to fully customize your checkout, branding and style of the page, while the whole payment is securely handled by Stripe.
Custom forms are also useful if you want to use additional/custom fields in your checkout form such as address or other user details - which for example you can store in your database.
Stripe Component
The first thing we need to do is to add the Stripe component on the page. R
Right cli…
But instead of payment intent you are creating setup intent to just save the credit card.
Thanks, that is where I started…but do I still convert the form to a Stripe checkout form even though I’m not checking out?
And yes, that is the use case.
George
April 7, 2021, 5:40pm
10
Yes just use stripe checkout form, even if you are not paying anything.
It is just used to submit info to your server side and there you decide if you want to charge - then create payment intent, or just save tge payment info then create setup intent.
You can event charge and save in a single action as well.
Still not working @George .
I have tested a PAYMENT intent and it works fine.
Here is what Wappler is sending to Stripe:
When doing a SETUP intent, this is what Wappler is sending:
Here is the form I am using:
<form id="form_add_card" method="post" is="dmx-stripe-checkout-form" action="../dmxConnect/api/stripe/add_credit_card.php">
<div class="form-group">
<label for="input1">Stripe Card</label>
<dmx-stripe-card id="input1"></dmx-stripe-card>
</div>
<button id="btn3" class="btn btn-primary" type="submit">Add Payment
Method</button>
</form>
And the contents of add_credit_card.php
In 2 minutes the PAYMENT intent works fine, and the same config for SETUP intent does not.
Are you saying this works for you?
George
April 7, 2021, 6:05pm
12
Well my understanding is that it should work like this.
Check the events log in stripe to verify and maybe ask stripe online support why the payment isn’t attached.
They have a great online chat support.
Let’s keep trying @George .
This is what I’m following:
https://stripe.com/docs/payments/save-and-reuse
And when I do this step:
https://stripe.com/docs/payments/save-and-reuse?platform=web#confirm-the-setupintent
I get this error:
It seems the process is to:
Create the setup intent
pass the secret from the intent to the confirmCardSetup method
It sure seems like Wappler is not attaching the client_secret value to the confirmCardSetup.
Would you mind taking a look at that?
George
April 7, 2021, 6:47pm
14
Ah did you return the client secret from your server connect action?
George
April 7, 2021, 6:50pm
16
If you use the “create setup intent template” this will be auto generated for you, just like when using the “create payment intent template” action as described in tge docs.
George
April 7, 2021, 6:52pm
18
Well if it is returned then it should be picked up.
Otherwise @patrick can check it out.
George
April 7, 2021, 6:54pm
19
Do you see it in devtools in the response of the server action?
As maybe there is an error occurring and you will see the error.