Create Stripe customer with name and phone

Am trying to to create a new customer in Stripe via API with email, name and phone.

I’ve tried unsuccessfully;
stripe_customer = anvil.stripe.new_customer(user['email'], f"{user['firstname']} {user['lastname']}", token)
and
stripe_customer = anvil.stripe.new_customer(email=user['email'], name=f"{user['firstname']} {user['lastname']}", token)

only this works.
stripe_customer = anvil.stripe.new_customer(user['email'], token)

The Stripe API documentation states you should be able to supply name and phone as optional to email

I looked into the open source anvil code for stripe, it looks like only email is supported in the anvil implementation of the stripe API interface.
(You may be correct that stripe supports other information, but anvil is not passing it to stripe)

image

The only way around this would probably be to use the anvil HTTP requests library to interact directly with stripe yourself, using the stripe API documentation, stripe account, and API key, but I have no further insights as to how difficult that would be.

You can use the full Python Stripe library on the server, as long as you pass the right parameter in the client when getting the Stripe token from the user: Anvil Docs | Using Stripe's Python API

2 Likes