#Marc-card

1 messages ยท Page 1 of 1 (latest)

willow swift
crude hamlet
#

โค๏ธ ๐Ÿ™

#

@willow swift

#

@zenith talon ^

zenith talon
#

what version of stripe-python do you have installed?

crude hamlet
crude hamlet
#

Okay!

crude hamlet
zenith talon
#

can you share the complete code of your script?

crude hamlet
#
import stripe

stripe.api_key = "sk_live_..."

card_name = stripe.PaymentMethod.billing_details.name
("TOOLS-.....")
zenith talon
#

hmm that doesn't make sense really

#

you have to retrieve a PaymentMethod first.

crude hamlet
zenith talon
#
pm = stripe.PaymentMethod.retrieve(
  "pm_1EUngD2a8peR5CH5KEoBqs0U",
) 
name = pm.billing_details.name
#

something like that.

crude hamlet
crude hamlet
zenith talon
#

it's the ID of a PaymentMethod object.

crude hamlet
zenith talon
#

where you get that from really depends on the wider picture of what you're doing exactly and where this code is run from. Maybe you read it from your database, maybe you read it from an incoming webhook, maybe you call the API and list a customer's payment methods.

crude hamlet
jade bay
#

Hey there. Stepping in for @zenith talon

#

If the Payment Method object seems alien to you, I guess you haven't created any previously

#

What is it exactly you're trying to do in that code snippet shared?

jade bay
#

What is a 'new client' in this instance? What information do you have?

crude hamlet
jade bay
#

when I receive a new client I send their information to my database so that it appears on my dashboard

#

What are those components in bold?

crude hamlet
#

Yeah!

crude hamlet
jade bay
#

Well what information do you have from them that you want to send to Stripe?

crude hamlet
jade bay
#

What's the key?

crude hamlet
# jade bay What's the key?

I get the key generated by my provider (Whop). That does not work for the Stripe API. Like CPSK-1234-1234-1234

jade bay
#

If you're not handling payment information, then you've no use for the Payment Methods API

crude hamlet
jade bay
#

What's the database?

#

Clients card from where?

crude hamlet
jade bay
#

You can use the metadata parameter to save the last 4 digits

crude hamlet
#
import stripe
stripe.api_key = "sk_test_51IZargBE80a7NgI0DyJG2GlAkJTgXTxq0PHxjbaNkdOXLSfxdWjN10oNmPvjf6qlxZ0mBkw3avmmLiYJ32aMEeNA00vx4xPCgi"

stripe.Customer.retrieve("cus_LEa5TM58PQDGoP")
jade bay
crude hamlet
#

New customer?

#

Already a client to use. id: cus_LEKPZWZ5pHewQ0

jade bay
#

You need to figure out your Python import issue

crude hamlet
jade bay
#

Sure

crude hamlet
jade bay
#

I'm not sure what you mean?

crude hamlet
jade bay
#

We only document our official client libraries

#

and curl

#

But the endpoint URLs and parameters are all listed there

crude hamlet
#

Okay, and how should I work with "metadata". I get that it is empty

jade bay
#

Did you pass the parameter with the values when creating the Customer?

crude hamlet
#

@jade bay

jade bay