#pareil_quotepdf-php
1 messages Ā· Page 1 of 1 (latest)
š Welcome to your new thread!
ā±ļø We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime!
š 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/1212545545483321344
š Have more to share? You can add more detail below, including code, screenshots, videos, etc.
ā²ļø 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. Thank you for your patience!
Its status is "open".
ack, looking, this is a pretty weird code example with that function in the middle
Connect is not in beta, it's been in production for 11+ years
Step 1: try without Connect though. Create a Quote on your own account and try to download the PDF first to see what happens
I Try
I am in Test mode, but when I try to create a quote, it does not display the clients from the connected account on which I am creating the quote, but rather those from my personal account, the same goes for the products.
it's just to debug so it doesn't matter. Use information from your own account (Customer, Price and Product, etc.) so that you can debug this
Sry
Sorry, I realized that the quote was created on my personal Stripe account instead of the Connect Plus account, even though I requested it to be done on the Connect Plus account.
The code example in our API Reference seems wrong though. I think what you want is this: ```$quotePdf = $stripe->quotes->pdf(
$quote->id,
function ($chunk) use (&$output) {
$output .= $chunk;
}
);
file_put_contents("./test.pdf", $output, FILE_APPEND);```
that works for me locally
With stripe connect ? Doesn't work for me
$quote->stripe_quote_id,
function ($chunk) use (&$output) {
$output .= $chunk;
},[], ['stripe_account' => auth()->user()->stripe_connected_account_id]
);
file_put_contents("./test.pdf", $output, FILE_APPEND);
When I go through the dashboard, everything works correctly; it's when I use the API that it doesn't work.
What I don't understand is that I feel like the request is executing fine because the page takes time to load (the time to retrieve the API response).
I just tried that exact code and it works fine for me
so I think you should add clear debugging logs before/after those parts to track down what the problem is
You need the empty array. And then the "nothing downloads" you can add clear logs to figure out what's happening. Share exact final code with exact logs so that I can see what you are doing
What else can I implement to retrieve logs?
You are the developer, you write the code here. what you need to do is add a clear log before the PDF method and right after to understand what happened
what does that mean "no log return". You clearly added logs before and after and they appear?
Stripe will not log anything
you removed the code you shared
But my point was: now that you are certain the PDF call works (since you saw the log after) the next step is to log what is inside $output
I try when i dd($output) i have :
$quotePdf = $stripe->quotes->pdf(
$quote->stripe_quote_id,
function ($chunk) use (&$output) {
$output .= $chunk;
dd($output);
},
[],
['stripe_account' => auth()->user()->stripe_connected_account_id]
);
I don't know what that means. You said "I have" and then dump your PHP code
%PDF-1.4
\n
1 0 obj
\n
<<
\n
/Title (ā )
\n
/Creator (ā
\x00
w
\x00
k
\x00
h
\x00
t
\x00
m
\x00
l
\x00
t
\x00
o
\x00
p
\x00
d
\x00
f
\x00
\x00
0
\x00
.
\x00
1
ā¶
perfct
so clearly you have something in $output and it's working fine!
it's a "binary stream" so you have to now write that cleanly to a file on your file system
Amazing!
it's definitely a weird pattern in our PHP SDK partly because handling file streams in PHP is a bit harder
I hope we improve this in the future to just return a raw payload instad of this callback approach š¦
I understand, the main thing is that it works. Thanks again, have a great day!