#Fonseca

1 messages · Page 1 of 1 (latest)

clever trailBOT
tacit agate
#

But the charge exists

        db.session.commit()
        transfer = stripe.Transfer.create(
            amount=2995,
            currency='brl',
            destination=accountId,
            transfer_group='{transfer1}',
            source_transaction=charge.stripe_id
        )```
Heres the code
#

Can u not do transactions w test charges?

rustic wagon
#

It looks like you supplied the Checkout Session ID (that's the cs_test_ ID from above) instead of a Charge ID. You need to pass in a Charge ID for source_transaction

tacit agate
#

charge = stripe.checkout.Session.retrieve(session.id, expand=["payment_intent.charges"])

#

but w this code arent I supposed to get the charge info?

rustic wagon
#

That request should give you back a Checkout Session object with the Charge ID nested under data.payment_intent.charges.id I believe

rustic wagon
#

Are you able to log the Checkout Session object so you can see its url field and its payment_intent hash?

tacit agate
#

I restarted my pc and it worked again

#
        print(charge)   
        db.session.commit()
        transfer = stripe.Transfer.create(
            amount=2995,
            currency='brl',
            destination=accountId,
            transfer_group='{transfer1}',
            source_transaction=charge.payment_intent.charges.data[0].id
        )```
#

This my code now