Closed tiagocaus closed 7 months ago
@tiagocaus This looks like an integration support better directed at our support team for 1:1 help instead. You can contact them here: https://support.stripe.com/contact
To unblock you, what you want is the pi_123
which is the PaymentIntent id and then later listen to the payment_intent.succeeded
Event which indicates when the payment did succeed.
@remi-stripe
When a charge is created, there is no such thing as pi_***
. Only one appears: Stripe\Checkout\Session JSON: {"id": "cs_test_a19YeWg0JtjVE8z....
but this ID is not the same when the payment is completed.
$checkout_session = $stripe->checkout->sessions->create([
'customer_email' => 'customer@example.com',
'metadata' => [
'pedido_id' => "ABC123",
],
'line_items' => [
[
'price_data' => [
'currency' => 'brl',
'product_data' => [
'name' => 'T-shirt',
],
'unit_amount' => 2007,
],
'quantity' => 1,
]
],
'mode' => 'payment',
'success_url' => SISTEMA['painel'] . '/app/Modules/pagamentos/stripe/sucesso.php',
'cancel_url' => SISTEMA['painel'] . '/app/Modules/pagamentos/stripe/cancelado.php',
]);
$rs = $mysqli->prepare("INSERT INTO financeiro_logs (IDx, retorno_webhook) VALUES (?,?) ");
$rs->bind_param('ss', $IDx, $checkout_session);
$rs->execute();
header("HTTP/1.1 303 See Other");
header("Location: " . $checkout_session->url);
@tiagocaus Sorry you had never mentioned using Checkout in your original question. The docs https://docs.stripe.com/payments/checkout/fulfill-orders cover this in a lot of details and tell you how to handle fulfillment exactly. Please work with our support team for 1:1 help instead of here: https://support.stripe.com/contact
@remi-stripe I've already tried talking to support. They can't help. This would be easily resolved if stripe adopted the standard of creating a unique ID, from the beginning to the end of the process! Why don't they do that?
@tiagocaus I'm sorry but this is exactly what the doc I linked you to explains in a lot of details. Please work with our support team for 1:1 help as you are asking for integration support.
Is your feature request related to a problem? Please describe.
I'm creating a microsaas, and I would really like to use stripe, as it is accepted in all countries.
My problem is understanding which ID to save in the DB so that after it is paid, the webhook receives the IDs and thus compares them with the DB and thus cancels them.
This is because I intend to use a card and "Brazil Boleto" which is a payment method where the webhook will only receive data within 24 to 48 hours.
Could I have your help?
Describe the solution you'd like
Unique ID so we can save it in the DB
Describe alternatives you've considered
Frustrated, no solution!
Additional context
No response