#RMoura_JS-paymentmethods
1 messages · Page 1 of 1 (latest)
@edgy lagoon can you share the request ID for that error? https://support.stripe.com/questions/finding-the-id-for-an-api-request
(forget about it) My boss is the only one with access
Ah, thanks for clarifying
does doing this fix the proble?
payment_method_id,
{ customer: retrieve_customer.id }
)```
It could
As the error message said this may also have been detached which would mean it may not be used again. Having trouble finding it if it was
Try attaching and see what happens
Otherwise this is a test PM you can create it again and attach
ok! ill try it, ill update you in a bit
Thank you!
*** Stripe::InvalidRequestError Exception: This PaymentMethod was previously used without being attached to a Customer or was detached from a Customer, and may not be used again.
when i try to attach it
im getting the pm id from a Stripe::PaymentIntent.retrieve(intent_id)
hmmm
using a stripe element
customer = retrieve_customer
::Stripe::PaymentIntent.create(
amount: prepare_amount(amount),
currency: amount.currency.to_s,
payment_method_types: payment_types,
description: description,
capture_method: 'automatic',
customer: customer&.id,
metadata: metadata
# setup_future_usage: 'off_session'
)
and then creating a stripe payment element with the payment intent id
So I am not seeing a customer being passed in when the example PM was created https://dashboard.stripe.com/test/logs/req_k0bTkCFQrnU6va
customer: customer&.id, here? no?
I am unfamiliar with the &. operator. Is that something that won't pass anything/will pass in null if customer is null?
ahhh
interesting
yes
its possible
pi_3JttRNIGDBqjniob0AwCuBbX
cus_JJS3aM0Bkrzmlh
"payment_method": "pm_1JttRiIGDBqjniobHAaaMZlU",
Stripe::InvalidRequestError - This PaymentMethod was previously used without being attached to a Customer or was detached from a Customer, and may not be used again.
i think the setup_future_usage is needed
off_session
That could be it. I am also not seeing the customer param in the call again https://dashboard.stripe.com/test/logs/req_LxQWjzLERPh0jz
But yes, definitely use setup_future_usage as well