#ben-st-john_api

1 messages ¡ Page 1 of 1 (latest)

exotic domeBOT
#

👋 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/1407359130187857933

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

loud vault
#

Stripe test account in connect: acct_1JK5wmQISsiW5X09

#

what's weird, is in the actual dashboard it says the "balance" is 3,301.41 which I'm not getting from any request. It's like the balance API is just broken in test mode?

#

I'll send a request and get this data
{ "object": "balance", "available": [ { "amount": 63123857, "currency": "usd", "source_types": { "card": 63123857 } }, { "amount": 8295, "currency": "cad", "source_types": { "card": 8295 } } ], "connect_reserved": [ { "amount": 0, "currency": "usd" }, { "amount": 0, "currency": "cad" } ], "instant_available": [ { "amount": 1000000, "currency": "usd", "source_types": { "card": 1000000 } } ], "livemode": false, "pending": [ { "amount": 491958, "currency": "usd", "source_types": { "card": 491958 } }, { "amount": 0, "currency": "cad", "source_types": { "card": 0 } } ], "refund_and_dispute_prefunding": { "available": [ { "amount": 0, "currency": "usd" }, { "amount": 0, "currency": "cad" } ], "pending": [ { "amount": 0, "currency": "usd" }, { "amount": 0, "currency": "cad" } ] } }

And then refresh and get this response back immediately (same exact request)
{ "object": "balance", "available": [ { "amount": 8295, "currency": "cad", "source_types": { "card": 8295 } }, { "amount": 63123857, "currency": "usd", "source_types": { "card": 63123857 } } ], "connect_reserved": [ { "amount": 0, "currency": "cad" }, { "amount": 0, "currency": "usd" } ], "instant_available": [ { "amount": 1000000, "currency": "usd", "source_types": { "card": 1000000 } } ], "livemode": false, "pending": [ { "amount": 0, "currency": "cad", "source_types": { "card": 0 } }, { "amount": 494108, "currency": "usd", "source_types": { "card": 494108 } } ], "refund_and_dispute_prefunding": { "available": [ { "amount": 0, "currency": "cad" }, { "amount": 0, "currency": "usd" } ], "pending": [ { "amount": 0, "currency": "cad" }, { "amount": 0, "currency": "usd" } ] } }

#

Current stripe version is: 2020-08-27

#

But even if I try and do it with basil stripe version (req_rYTUcc0rP2BVqk) '2025-03-31.basil'

I get
{ "object": "balance", "available": [ { "amount": 8295, "currency": "cad", "source_types": { "card": 8295 } }, { "amount": 63118561, "currency": "usd", "source_types": { "card": 63118561 } } ], "connect_reserved": [ { "amount": 0, "currency": "cad" }, { "amount": 0, "currency": "usd" } ], "instant_available": [ { "amount": 1000000, "currency": "usd", "source_types": { "card": 1000000 } } ], "livemode": false, "pending": [ { "amount": 0, "currency": "cad", "source_types": { "card": 0 } }, { "amount": 503884, "currency": "usd", "source_types": { "card": 503884 } } ], "refund_and_dispute_prefunding": { "available": [ { "amount": 0, "currency": "cad" }, { "amount": 0, "currency": "usd" } ], "pending": [ { "amount": 0, "currency": "cad" }, { "amount": 0, "currency": "usd" } ] } }

fathom sigil
#

Hi, looking into this now

loud vault
fathom sigil
#

If you look at the API responses, it is returning multiple balances for different currencies. But they do appear to be the same, just in a different order. I also see lots of test payment activity on the account, so some small changes are expected as those payments settle. But overall, the responses seem expected

loud vault
#

hmm, they look different to me. Are you seeing all of these exactly the same? why is the order different?

fathom sigil
#

Looking it over, most of it seems the same. As I mentioned, some can be different if a payment resolves in between each request. The sorting order is not guaranteed from the API response, as the order is arbitrary for this situation

loud vault
#

okay let me take a look

#

is there a place that shows the complete total? or do we have to build the total off of the response?

#

and why is it different when I pin the API vs not pinning the API?

exotic domeBOT
earnest inlet
#

hi there, taking over for my colleague since they had to step away. yes, you would have to build the total off of the response. can you describe the differences of pinning vs. not pinning the API?

loud vault
#

Yes just one second

#

Alright so if I pin the API in the request with curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Stripe-Version: ' . '2020-08-27
));
I get this response
{ "object": "balance", "available": [ { "amount": 8295, "currency": "cad", "source_types": { "card": 8295 } }, { "amount": 63104589, "currency": "usd", "source_types": { "card": 63104589 } } ], "connect_reserved": [ { "amount": 0, "currency": "cad" }, { "amount": 0, "currency": "usd" } ], "instant_available": [ { "amount": 1000000, "currency": "usd", "source_types": { "card": 1000000 } } ], "livemode": false, "pending": [ { "amount": 0, "currency": "cad", "source_types": { "card": 0 } }, { "amount": 555044, "currency": "usd", "source_types": { "card": 555044 } } ], "refund_and_dispute_prefunding": { "available": [ { "amount": 0, "currency": "cad" }, { "amount": 0, "currency": "usd" } ], "pending": [ { "amount": 0, "currency": "cad" }, { "amount": 0, "currency": "usd" } ] } }

if I don't use the pinned version (which I believe just uses the default API version...which is '2020-08-27' they are functionally the same API version I get a different response

{ "object": "balance", "available": [ { "amount": 98739, "currency": "usd", "source_types": { "card": 98739 } } ], "instant_available": [ { "amount": 581149, "currency": "usd", "source_types": { "card": 581149 } } ], "livemode": false, "pending": [ { "amount": 482410, "currency": "usd", "source_types": { "card": 482410 } } ], "refund_and_dispute_prefunding": { "available": [ { "amount": 0, "currency": "usd" } ], "pending": [ { "amount": 0, "currency": "usd" } ] } }

#

(unpinned: req_eCaBDtbYyi57dS)

#

vs pinned req_IYcZd5t7XGAM02

#

Both in the workbench are showing "2020-08-27" as the API version

#

Let me know if that makes sense

#

like the balances aren't even kind of the same

#

what's also weird is the balance requests still doesn't match up with the balance shows on the actual connect dashboard for the account in "pending" balance

earnest inlet
#

those both look pinned to 2020-08-27, can you send another one without the Stripe-Account header?

loud vault
#

I have already done that, that's the last one I did

#

req_0RZbkaB1cmonyp

#

this one is not explictly pinned in the code, but should be on 2020-08-27 since that is the API version

#

however, what I'm finding is that if I hit https://api.stripe.com/v1/balance without passing Stripe-Account (connect ID) I get the

"object": "balance",
"available": [
    {
        "amount": 63104589,
        "currency": "usd",
        "source_types": {
            "card": 63104589
        }
    },
    {
        "amount": 8295,
        "currency": "cad",
        "source_types": {
            "card": 8295
        }
    }
],
"connect_reserved": [
    {
        "amount": 0,
        "currency": "usd"
    },
    {
        "amount": 0,
        "currency": "cad"
    }
],
"instant_available": [
    {
        "amount": 1000000,
        "currency": "usd",
        "source_types": {
            "card": 1000000
        }
    }
],
"livemode": false,
"pending": [
    {
        "amount": 554884,
        "currency": "usd",
        "source_types": {
            "card": 554884
        }
    },
    {
        "amount": 0,
        "currency": "cad",
        "source_types": {
            "card": 0
        }
    }
],
"refund_and_dispute_prefunding": {
    "available": [
        {
            "amount": 0,
            "currency": "usd"
        },
        {
            "amount": 0,
            "currency": "cad"
        }
    ],
    "pending": [
        {
            "amount": 0,
            "currency": "usd"
        },
        {
            "amount": 0,
            "currency": "cad"
        }
    ]
}
#

which makes me believe that somehow pinning the API version is breaking the API and somehow removing the 'stripe-account' passed in? Or it's overwriting the header in the code since I define the 'stripe-account' in a header but then pass in the other header with stripe version?

$headers = array(
"Stripe-Account: $account_id"
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, "https://api.stripe.com/v1/balance");
curl_setopt($ch, CURLOPT_USERPWD, "$stripe_key");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Stripe-Version: ' . \Ludus\LudusConfig::LEGACY_STRIPE_API_VERSION
));

#

that must be the problem

crimson spruce
#

That makes sense to me, all of the request IDs sent so far have been made directly on your platform account without the Stripe-Account header. Can you try running this curl command twice with and without the version header at the end? It should stay the same with or without the pinning, I have a feeling this is more how the library is handling the headers being set

  -u sk_test_1234: \
  -H "Stripe-Account: acct_456" \
  -H "Stripe-Version: 2020-08-27"```
loud vault
#

it was definitely me just overriding the headers