#streetfeels
1 messages · Page 1 of 1 (latest)
Good question. To make the card re-usable you will need to attach the PM to a customer before confirming your payment intent
I think you will want to create a customer, set it as the customer property on the payment intent, and confirm that intent with setup_future_usage set to offline or online?
We have two flows on our client side - 1) Apple / Google Pay and then the credit card option.
Is is possible to create a customer object on the payment intent without a name and email entered?
Yes, you can create a Customer object without any initial information and attach it to the payment intent
And you can update the Customer later once you have that info
Ok, that's essentially how we have it for the credit card flow. Which has name and email inputs, and as the user enters that info, we patch the payment intent and the server side updates the customer object
However, with Apple and Google Pay, we do not request this separately, it's all done in the flow provided by Apple / Google Pay, where have requestPayerEmail / requestPayerName enabled.
So we won't have a chance to update the customer object.
So essentially, the payment does go through, but Stripe just creates a guest account
On our server side, we grab the name and email attributes and actually create a customer object then. However, seems like Stripe will not let us attach the payment method that's already associated with the guest account. We get the following error:
Hello! I'm taking over and catching up...
h Error occurrence: #501 InvalidRequestError: Request req_iWy7BjCUetDg2x: This PaymentMethod was previously used without being attached to a Customer or was detached from a Customer, and may not be used again.
Ok thanks!
What you need to do is create a Customer ahead of time. You don't need to specify anything up front; you can omit things like name and email, and then update the Customer later when you have that info.
Oh I see, so that would prevent Stripe from creating a guest account?
Yep.
as long as the payment intent has ANY customer object attached to it.