#ogden_api

1 messages ¡ Page 1 of 1 (latest)

green kiteBOT
#

👋 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.

fiery ocean
#

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

topaz robin
fiery ocean
#

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

topaz robin
fiery ocean
#

How should that look?

topaz robin