It seems I can’t get paid for using strip using python

I have the following python code to create a charge in a strip.

a_charge = stripe.Charge.create(
amount=cents, 
currency="usd",
source=token,
description="my_description",
application_fee=application_fee,
stripe_account=teacher_stripe_id
)

This succeeds (I think) because it appears in my panel using charge_id. But then, right after that in the code, the following is executed:

stripe.Charge.retrieve(a_charge.id)

With an error: There is no such charge: somelongstringhere

However, somelongstringhere is indeed an identifier under the payment details on my toolbar. So why can't Stripe get that charge? Is this not a valid identifier?

+4
source share
3 answers

, - , .

:

a_charge = stripe.Charge.create(
  amount=cents, 
  currency="usd",
  source=token,
  description="my_description",
  application_fee=application_fee,
  stripe_account=teacher_stripe_id
)

stripe_account, Stripe-Account . , Stripe API, .

, , stripe_account:

the_same_charge = stripe.Charge.retrieve(a_charge.id, stripe_account= teacher_stripe_id)

, . a_charge. , , a_charge == the_same_charge.

, Stripe API, refresh():

a_charge.refresh()

API ( stripe_account - "" ) , API.

+4

stripe.Charge.retrieve(a.charge.id) , a_charge?

, / / . .

+1

, , Stripe. Stripe .

Since the board is associated with a connected account, it does not exist on your own Stripe account, and it expected that you could not receive it directly. To do this, you need to pass the header again Stripe-Account, as described here .

Instead, your code should be

the_charge = stripe.Charge.retrieve(
    id=a_charge.id,
    stripe_account=teacher_stripe_id)
+1
source

All Articles