#localpath
1 messages · Page 1 of 1 (latest)
Hello! Calling stripe.createPaymentMethod shouldn't attach the Payment Method to a Customer at all - attachment wouldn't happen until you confirm an intent that uses that Payment Method w/ a customer set or you explicitly make a request to attach the PM to the customer
@cinder mica Does that make sense?
Ok so we could do the createPaymentMethod and when creating our intent in our server just omit passing the pm_id into the intent? Would we just provide the cu_id Customer ID to the Intent? So like this
await this.stripeInstance.paymentIntents.create({
amount: amountInCents,
currency: currency.toLowerCase(),
customer: customerId,
description,
statement_descriptor: statementDescriptor,
});
Are you setting setup_future_usage on the Payment Intent at all? I believe the Payment Method will only be attached to the Intent if the Customer AND setup_future_usage are set on the Intent
If you have an example Payment Method you're seeing attached to a Customer feel free to share the ID and I can take a closer look at what you're doing
@native vault yes exactly! We were setting that prop and didn't realize that it was doing the attachment in the background. Our elements config is typically like this
const options: StripeElementsOptions = useMemo(
() => ({
// Customize Appearance https://stripe.com/docs/js/elements_object/create
amount: amountInCents,
appearance: {
variables: {
borderRadius: '6px',
},
},
currency: 'usd',
mode: 'payment',
paymentMethodCreation: 'manual',
}),
[amountInCents]
);
const { error: error, paymentMethod: stripePaymentMethod } =
await stripe.createPaymentMethod({
elements,
params: {
// will be set to cashapp or paypal if using those card (otherwise card)
metadata: {}, // can add any additional data here
type: 'card',
},
});
This all works its just we didn't want a ton of Payment Methods attached to the customer. It seems like what you told me should work though
👍 Yeah as long as you remove setup_future_usage I think you'll get the behavior you want (a one-time payment for the customer w/o the payment method being attached)