#bikash_api

1 messages ยท Page 1 of 1 (latest)

ripe galleonBOT
#

๐Ÿ‘‹ 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/1305876954192285811

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

austere heron
#

๐Ÿ‘‹ happy to help

pale grail
#

i have added but still not working

#

$checkout_session = $stripe->checkout->sessions->create([
'customer_email' => 'bikash@cleonix.com',
'line_items' => [[
# Provide the exact Price ID (e.g. pr_1234) of the product you want to sell
'price' => 'price_1Q5nwVHjdlmJCM9iKP3Akpd4',
'quantity' => 1,
]],
'mode' => 'subscription',
'success_url' => $domain_url . '/'.$success_redirect_url.'?resp={CHECKOUT_SESSION_ID}',
'cancel_url' => $domain_url . '/'.$failure_redirect_url.'?is_cancel=yes',
'saved_payment_method_options' => ['payment_method_save' => 'enabled'],
'automatic_tax' => [
'enabled' => true,
],
]);

austere heron
#

is this the first or the second time you do the checkout for this customer?

#

it doesn't work with customer_email

#

you need to pass an existing customer ID

pale grail
#

okay I am changing thanks!

#

its existing customer

austere heron
#

you're passing
'customer_email' => 'bikash@cleonix.com',

#

this is wrong

#

you need to pass

#

'customer' => 'cus_xxx'

pale grail
#

$checkout_session = $stripe->checkout->sessions->create([
'customer' => $customer_profile_id,
'line_items' => [[
# Provide the exact Price ID (e.g. pr_1234) of the product you want to sell
'price' => $price_id,
'quantity' => 1,
]],
'mode' => 'subscription',
'success_url' => $domain_url . '/'.$success_redirect_url.'?resp={CHECKOUT_SESSION_ID}',
'cancel_url' => $domain_url . '/'.$failure_redirect_url.'?is_cancel=yes',
'saved_payment_method_options' => ['payment_method_save' => 'enabled'],
]);

#

still not fetching the default card

austere heron
pale grail
#

this is sandbox env

austere heron
#

the pm should have an allow_redisplay: 'always'

pale grail
#

ok thanks!

ripe galleonBOT
sharp cloak
#

Hey, taking over here. Let me know if there's any follow-up Qs I can answer!

pale grail
#

I've updated the code, so if the user clicks on "Save my payment information for future purchases," it will auto-fill the data during their next purchase. However, there's a high chance customers might overlook this feature. Are there any alternative solutions for making this more visible? I'm also sharing the code. // Create the Checkout session
$checkout_session = $stripe->checkout->sessions->create([
'customer' => $customer_profile_id,
'line_items' => [[
// Provide the exact Price ID (e.g. pr_1234) of the product you want to sell
'price' => $price_id,
'quantity' => 1,
]],
'mode' => 'subscription',
'success_url' => $domain_url . '/' . $success_redirect_url . '?resp={CHECKOUT_SESSION_ID}',
'cancel_url' => $domain_url . '/' . $failure_redirect_url . '?is_cancel=yes',
'payment_method_types' => ['card'],
'allow_promotion_codes' => true,
'saved_payment_method_options' => [
'payment_method_save' => 'enabled' // This enables saving the payment method for future use
],
]);

// Redirect to the Stripe Checkout page
echo '<script>window.location.href="' . $checkout_session->url . '"</script>';
sharp cloak
#

There are not no