#Rob.Clayton

1 messages · Page 1 of 1 (latest)

feral heathBOT
arctic sky
#

Where do you set the metadata and which object are you trying to search from?

rancid harness
#

at the customer level, and I'm trying to retrieve the customer by that metadata "handle"

#

it's an id that matches with something in our own db

#

customer = stripe.Customer.create(
email="jenny.rosen@example.com",
test_clock=test_clock.id,
payment_method="pm_card_visa",
metadata={"account_id": "85b83f41-7e99-4cdb-9541-0aff438b6491"},
invoice_settings={"default_payment_method": "pm_card_visa"},
api_key=stripe_client.api_key,
)

line_items = [
LineItem(
PriceID="price_1N4CkfDBF4LGcRTgnsCo96IQ", quantity=1
), # Add tier 1 monthly
LineItem(
PriceID="price_1N4zAuDBF4LGcRTg1HXkQ7DZ", quantity=10
), # Add monthly paid licenses
]

subscription = stripe_client.create_stripe_subscription(
account_id="85b83f41-7e99-4cdb-9541-0aff438b6491",
payment_method="pm_card_visa",
promo_code=None,
line_items=line_items,
)

#

that's my test code

#

actually .... no ... I shouldn't show you that piece of code
just know that the stripe_client call is searching against the account_id metadata

arctic sky
#

I see! Sometimes it'll take time to for the metadata to become searchable

rancid harness
#

ahhhhhh

#

is there a away to deal with that?

#

since we rely on it as a linking point back to our db

arctic sky
#

Why don't you save the customer ID associated to the account_id instead? In the above code, you have already had the customer ID from stripe.Customer.create, why extra search is needed?

rancid harness
#

we have done the reverse, and not modified our db, but added a meta data column holding our id so we can find it. Yes, we could change our db, but that's not a good fit.
That's okay though, I can work through that.

I'm now trying to progress the time clock, and because you can only do two cycles at a time, I'm trying to progress it a cycle at a time 12 times ...
without using webhook events, can I avoid this error:

arctic sky
#

This means that the same test clock is under advancement and there's a conflict. You can't have two advancement on the same test clock at the same time

rancid harness
#

is there a way I can wait for the advancement to complete without using webhooks (I'm trying to write a test harness)?

arctic sky
#

I'm afraid that will not be possible

rancid harness
#

ah, ok