#cedricmorelle
1 messages · Page 1 of 1 (latest)
Can you tell me what you want to achieve?
sure,
- I have a fast checkout process set, here : http://stl.sport/ you can click on "get premium" even without being logged to test it
- Then select one of the 2 offer you will then open Stripe Checkout Payment.
My need is to add a Trial period, meaning, I still need to have the same workflow, but when user ended to add his credit card or payment method, I wish the credit card to be saved, but not to be debited before the end of the trial period.
When we have the end of the trial period, then payment method is going to be debitted
was my explanation clear enough ?
So you want to collect a payment method for subscription on trial, is it the correct understanding?
There are many ways to achieve it: https://stripe.com/docs/billing/subscriptions/trials#use-the-customer-portal-to-collect-payment
this is exactly what I need but there is a issue. I provided my code above:
{
customer: customer.id,
items: [
{
price: subscription_product.price_id,
},
],
currency: subscription_product.currency.downcase,
trial_period_days: 14,
payment_behavior: "default_incomplete",
payment_settings: {
save_default_payment_method: "on_subscription",
},
expand: ["latest_invoice.payment_intent"],
}
)``` but then created subscription do not contains **__payment_intent__** that's the issue
subscription object doesn't have a payment_intent, and why it's a issue?
because I need the clientSecret when provided the Checkout Payment form
constructor() {
console.log("Fast Checkout Started");
const stripe = Stripe(window.data.stripe_public_key);
let elements;
initialize();
checkStatus();
document
.querySelector("#payment-form")
.addEventListener("submit", handleSubmit);
document.querySelector("#submit").disabled = true;
....
const {clientSecret, user_email} = await response.json();
const appearance = {
theme: 'stripe',
};
elements = stripe.elements({ appearance, clientSecret });
https://stripe.com/docs/api/subscriptions/object#subscription_object-pending_setup_intent use the pending_setup_intent instead
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
so if I understand well, when I create my subscription with Stripe::Subscription.create then I can get this pending_setup_intent?
pending_setup_intent is only available for subscription that doesn't require immediate payments (i.e., on trial)
thanks for the tip I will dig with this idea thanks a lot