#ogden_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1359247798024798218
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
I'm able to add a shipping address to customers, but it's more important to add a billing address. Can't quite figure that out
Hello
Can you share the full code and the error you're seeing? As well as a failed request ID would help - https://support.stripe.com/questions/finding-the-id-for-an-api-request
Ideally, you'd nest all the values under address hash - https://docs.stripe.com/api/customers/create#create_customer-address
require 'stripe'
require 'csv'
Stripe.api_key = ''
Stripe.max_network_retries = 10
if ARGV.empty?
puts "No CSV path specified"
exit 1
end
csv_path = ARGV.first
csv_mapping = CSV.read(csv_path, headers: true)
csv_mapping.each do |csv_line|
stripe_customer_id = csv_line['stripe_customer_id']
address1 = csv_line['address1']
address2 = csv_line['address2']
city = csv_line['city']
state = csv_line['state']
country = csv_line['country']
zip = csv_line['zip']
stripe_customer = Stripe::Customer.retrieve(stripe_customer_id)
puts "#{stripe_customer.id}\tupdating address"
#billing address:
stripe_customer.address.city = city
stripe_customer.address.country = country
stripe_customer.address.line1 = address1
stripe_customer.address.line2 = address2
stripe_customer.address.postal_code = zip
stripe_customer.address.state = state
stripe_customer.save
end
I've tinkered with a few things and run into a few diff errors (wrong number of arguments (given 0, expected 1..3), undefined method `city=' for nil:NilClass, etc.)
req_xTFa87xgf2cQqP, req_VtLZloEWtVSFUo
req_VtLZloEWtVSFUo this is most relevant
You're not sending the information in the right format. See the request body:
https://dashboard.stripe.com/logs/req_VtLZloEWtVSFUo
It's not nested under address object
How should that look?
We have an example on how you can handle updates in ruby - https://docs.stripe.com/api/customers/update?lang=ruby
You can do something like
Stripe::Customer.update('cus_ID', {
address: {
line1: xxx,
city: xxx,
...
},
metadata: {order_id: '6735'}})