#eztaxi-paymentinfo

1 messages · Page 1 of 1 (latest)

plucky girder
#

can you share a bit more on how you are integrating with Stripe now?

Are you using plugins, or you are directly integrating with Stripe using Stripe Checkout or Stripe Element?

burnt spire
#

Hi thank you for quick reply, I'm using PHP using 'create-stripe-session.php'

#

`<?php

require 'vendor/autoload.php';
\Stripe\Stripe::setApiKey('sk_test_');

header('Content-Type: application/json');

$YOUR_DOMAIN = 'https://myezadmin.com/tickets/public';
$price_id = $_POST['price_id'];

$checkout_session = \Stripe\Checkout\Session::create([
'line_items' => [[
# TODO: replace this with the price of the product you want to sell
'price' => $price_id,
'adjustable_quantity' => [
'enabled' => true,
'minimum' => 1,
'maximum' => 10,
],
'quantity' => 1,
]],
'payment_method_types' => [
'card',
],
'mode' => 'payment',
'success_url' => $YOUR_DOMAIN . '/success.php?orderid='.$checkout_session,
'cancel_url' => $YOUR_DOMAIN . '/cancel.html',
]);

header("HTTP/1.1 303 See Other");
header("Location: " . $checkout_session->url);`

#

I need to generate a unique ticket number based on order amount, quantity and receipt number

burnt spire
#

any idea?

plucky girder
#

Let me check.

#

there are several ways

  1. the recommended way: listen to checkout.session.completed webhook event you can take a look at how to build a webhook https://stripe.com/docs/webhooks/build
    basically Stripe will send a callback to you when the checkout session successfully completed
    you create a webhook handler, listen to the callback event which contains the checkout session, can you can get all the information there which could be used for generate a unique ticket number

Write the code that properly handles webhook notifications.