#cedricmorelle

1 messages · Page 1 of 1 (latest)

chrome stumpBOT
wicked hollow
#

Can you tell me what you want to achieve?

odd lynx
#

sure,

  1. I have a fast checkout process set, here : http://stl.sport/ you can click on "get premium" even without being logged to test it
  2. 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 ?

wicked hollow
#

So you want to collect a payment method for subscription on trial, is it the correct understanding?

odd lynx
#

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
wicked hollow
#

subscription object doesn't have a payment_intent, and why it's a issue?

odd lynx
#

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 }); 
wicked hollow
odd lynx
#

so if I understand well, when I create my subscription with Stripe::Subscription.create then I can get this pending_setup_intent?

wicked hollow
#

pending_setup_intent is only available for subscription that doesn't require immediate payments (i.e., on trial)

odd lynx
#

thanks for the tip I will dig with this idea thanks a lot