#sunil_code
1 messages ยท Page 1 of 1 (latest)
๐ 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/1437391696705884302
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
public function stripeCheckoutSession($customerId, $p_info, $metaData, $baseUrl = '')
{
try {
$successUrl = $baseUrl . '?method=0&token={CHECKOUT_SESSION_ID}';
$cancelUrl = $baseUrl . '?method=0&token={CHECKOUT_SESSION_ID}';
$sessions = $this->stripe->checkout->sessions->create([
'customer' => $customerId,
'payment_method_types' => ['card'], // Enables GPay and Apple Pay automatically
'line_items' => [
[
'price_data' => [
'currency' => $this->currency,
'product_data' => [
'name' => $this->lang->line('medical_service') . ': ' . $p_info['service_name'],
'description' => str_replace('.','',$p_info['service_description']) . " | ".$this->lang->line('hpTxt').": " . $p_info['hp_name'],
'images' => [
$p_info["service_img"]
]
],
'unit_amount' => $p_info['total_stripe_paypal'] * 100, // amount in cents
],
'quantity' => 1,
],
],
'payment_intent_data' => [
'description' => $this->lang->line('medical_service') . ': ' . $p_info['service_name'],
],
'mode' => 'payment',
'success_url' => $successUrl,
'cancel_url' => $cancelUrl,
'metadata' => $metaData,
'expires_at' => time() + (30 * 60) // 30 minutes expiry
]);
return $sessions; // Return session object instead of echoing JSON
} catch (\Exception $e) {
return ["error" => true, "message" => $e->getMessage()];
}
}
this is my full code for checkout session
๐ Hi there! Let me take a look