#m.michalis

1 messages · Page 1 of 1 (latest)

jolly isleBOT
onyx locust
#

Hello! Can you give me some more details here?

analog sundial
#

i use Stripe JS for rendering elements on frontend

#
const paymentElement = elements.create('payment');
//const addressElement = elements.create('address', {mode: 'billing'});

this.createModal({
    type: 'subscription',
    actionText: 'Pay ' + price_text
}, () => {
    //addressElement.mount('#address-element');
    paymentElement.mount('#payment-element')

});
onyx locust
#

Gotcha - are you seeing some payment method types that you have enabled through the dashboard not showing up in your payment element?

#

Can you be specific about which payment method types those are?

analog sundial
#
/**
 * @param $customer_id
 * @param $price_id
 * @param string $currency
 * @return \Stripe\Subscription
 * @throws ApiErrorException
 */
public function createSubscription($customer_id, $price_id, string $currency = "USD"): \Stripe\Subscription
{
    return $this->getClient()->subscriptions->create([
        'customer' => $customer_id,
        'items' => [
            [
                'price' => $price_id
            ]
        ],
        'currency' => strtolower($currency),
        'payment_behavior' => 'default_incomplete',
        'expand' => ['latest_invoice.payment_intent'],
    ]);
}
#

sec

analog sundial
onyx locust
#

Again, can you be really specific about WHICH payment method types aren't behaving as your expect?

#

You've provided a lot of screenshots but haven't actually said which parts aren't behaving llike you expect

analog sundial
#

ok. i've disabled every payment method on stripe dashboard, but on frontend sepa and paypal shows up

onyx locust
#

Where in the dashboard are you disabling them? Can you share the link?

analog sundial
#

SEPA Direct Debit is off as well

#

only cards are on

onyx locust
#

Hmm... can you share the Subscription ID that you created?

analog sundial
#

sub_1NTSyjGhIhXmDWFT3MLqUNav

jolly isleBOT
onyx locust
#

Can you show me your code where you're calling stripe.elements and the options you pass in there?

analog sundial
#

sec

analog sundial
#

then:

fetch(stripeConfig.urls.subscribeIntent, {
            method: 'POST',
            body: formData,
        }).then((r) => r.json().then(this.createElements.bind(this)).then((elements) => {
            const paymentElement = elements.create('payment');
            //const addressElement = elements.create('address', {mode: 'billing'});

            this.createModal({
                type: 'subscription',
                actionText: 'Pay ' + price_text
            }, () => {
                //addressElement.mount('#address-element');
                paymentElement.mount('#payment-element')

            });
        }))
onyx locust
#

No, I just need to see the client-side code where you initialize elements

onyx locust
#

You cshould have code that calls stripe.elements()

#

This would be coming before the code you're sharing

analog sundial
#

o shh.. sorry

#

this is createElements:

createElements({clientSecret}) {
        return new Promise((resolve, reject) => {
            this.getStripe().then(() => {
                this.elements = this.Stripe.elements({
                    clientSecret: clientSecret,
                    appearance: {
                        theme: 'night',
                        variables: {
                            colorPrimary: '#55D3F9',
                            colorBackground: '#2b3750',
                        },
                        rules: {
                            '.Tab': {
                                borderColor: '#abb0ba',
                                boxShadow: 'none'
                            },
                            '.Input': {
                                borderColor: '#abb0ba',
                                boxShadow: 'none'
                            },
                            '.Input--focused': {
                                borderColor: '#abb0ba',
                                colorBackground: '#1a263f'
                            }
                        }
                    },
                    fields: {
                        billingDetails: {
                            name: 'auto',
                            address: {
                                line1: 'auto',
                                city: 'auto',
                                country: 'auto',
                                postalCode: 'auto'
                            }
                        }
                    }
                });

                resolve(this.elements)
            });
        })
    }
patent yew
#

Hello! I'm taking over and catching up...

analog sundial
#

hi!

patent yew
analog sundial
#

ok? other payment methods?

#

never seen that before

patent yew
#

Down here:

#

Which are enabled there?

analog sundial
#

many were enabled, i just disabled them on test

#

now its like this:

#

still paypal shows up:

analog sundial
patent yew
#

Yes, those settings are account wide.

#

To clarify, you don't want PayPal to show up there?

analog sundial
#

yes

#

only credit/debit card

patent yew
#

There should have been a setting in the Invoice template payment methods for PayPal; is it there? Is it disabled when you click on manage?

analog sundial
#

this?

patent yew
#

Yep. Oh, so you haven't activated PayPal on that account yet?

analog sundial
#

nope

patent yew
analog sundial
#

added this

#

no, wrong sorry

patent yew
#

Needs to be nested under payment_settings.

analog sundial
#

ye

#

FIXED

#

nice

#

bug?

patent yew
#

I don't think it's a bug, just kinda unintuitive behavior, and maybe a gap in the Dashboard. I think accounts that have PayPal have it enabled by default. Normally you could go to the Invoice settings page I linked you to and turn it off, but you haven't enabled it in live mode for that account, so the setting is disabled.

#

Work is being done to improve that entire area of the Dashboard, so it shouldn't be an issue when that work is complete.

analog sundial
#

is the flow correct? every time a customer wants to subscribe to a plan, i create a subscription and prompt the user to enter payment info.

#

if payment continues, i catch it via webhooks

patent yew
#

Yep, that sounds correct.

analog sundial
#

glad to hear that.. thank you Rubeus.

#

i believe this case is closed

patent yew
#

Happy to help!