#stealthlog
1 messages · Page 1 of 1 (latest)
hi! you don't
you create a new PaymentMethod(by using e.g. Elements to collect the card details like normal)
one sec let me explain what I'm trying to do sir
sir I have two issues of which I would like to get the help with the first one
i m trying to create a new card payment method, which is being made successfully, them I'm trying to attach that payment method to the customer but I'm getting error while attaching the payment method
payment_method = stripe.PaymentMethod.create(
type="card",
card={
"number": card_number,
"exp_month": int(exp_month),
"exp_year": int(exp_year),
"cvc": cvc,
},
)
stripe_id = request.user.stripe_id
customer = stripe.Customer.retrieve(stripe_id)
try:
attach = stripe.PaymentMethod.attach(
payment_method.id,
customer = stripe_id,
)
am I missing out somethings here?
that code is all wrong, sorry
you can not do this, you can not handle raw card numbers yourself in backend Python code. You need to use Elements/Checkout instead to be PCI compliant.
I suggest throwing away all that code and staring with
https://stripe.com/docs/payments/save-and-reuse or https://stripe.com/docs/payments/save-during-payment
could you please with 5 minutes till I checkout the doc get clarification on how to implement it?
So my current task is to have a feature when user can can save additional credit card,
how do I save additional credit card taken from user and store it in stipe for that customer
besides the primary credit card I want to save an additional user credit card which may or may not be used for the billing
ok I think I got the right docs,
could you tell me what is this input being passed
while creating the super intent where exactaly are we supposed to pass the card details?
you don't
that all happens on the frontend
also your reading the wrong docs
you're reading about Terminal(card reader) payments for some reason.
I suggest starting with
https://stripe.com/docs/payments/save-and-reuse or https://stripe.com/docs/payments/save-during-payment
ok thanks for your help I think I will require some time in understanding it and implementing it, If I have doubt on same issue should I create a new thread later or should I continue asking in same thread here?