#paulc7053_code

1 messages · Page 1 of 1 (latest)

grizzled adderBOT
#

👋 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/1227625367750316113

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

steep crescentBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

tidal agate
#

Hey

#

This is the relevant code

#

`let invoice;
invoice = event.data.object;
invoice = await stripe.invoices.retrieve(invoice.id, { expand: ['payment_intent.payment_method'] });

        const billingDetails = invoice.payment_intent.payment_method.billing_details;
        console.log(invoice.payment_intent.payment_method)

        const billingFullName = billingDetails.name;
        const billingEmail = billingDetails.email;
        const billingPhone = billingDetails.phone;`
steep crescentBOT
dapper pulsar
#

Hello, are you confirming the invoice's payment intent on your own custom page, or are you using the hosted invoice page? For a custom page, you can disable the email field from elements and create your own input to collect it. I don't think the hosted invoice page can be forced to collect email but I can double check.

tidal agate
#

I have a custom one yes

#

But that doesnt make any sense

#

There are endless websites with apple pay one click checkout

#

Why would I made another input vor email?

#

Also, I think having a selected email is required for they payment to go through with apple pay and gpay, no?

#

the payment*

dapper pulsar
#

Not currently seeing it for the Express Checkout Element but can look further

tidal agate
#

Yes, I'm using the ECE

dapper pulsar
#

I was more in the headspace that you might be using payment methods beyond wallets, in which case that is the most consistent way to collect email across all PMs

#

Will look in to that more

tidal agate
#

Alright, thanks!

dapper pulsar
#

I'm not seeing this for ECE, will ask my colleagues and get back to you

tidal agate
#

Thanks!

#

The weird thing is that... I'm 90% sure it worked as expected yesterday

dapper pulsar
#

It looks like this is an option that can be enabled by the on click handler:

  const options = {
    emailRequired: true,
    phoneNumberRequired: true
  };
  event.resolve(options);
});```
https://docs.stripe.com/elements/express-checkout-element/accept-a-payment#collect-payer

Learn how to accept payments with the Express Checkout Element.

tidal agate
#

Alrighty, am trying it right now

#

Okay, now it works as expected

#

Thanks a lot!

#

One more question: I have been approved to use PayPal within the ECE, but it still doesnt show up

#

I am doing const expressCheckoutOptions = { layout: { overflow: "never" }, buttonHeight: 50, paymentMethodOrder: ["google_pay", "apple_pay", "paypal"] };

dapper pulsar
#

Interesting, looking in to that and will get back to you

tidal agate
#

Thanks!

dapper pulsar
tidal agate
#

Yes, it is

#

Where would I create the payment intent within an ECE implementation?

dapper pulsar
#

I meant apart from the page, creating an intent like that can be a quick test to see if there are overall issues with the PM on your account. On second thought that probably wouldn't be that helpful here.
When you initialize elements client side, are you specifying the invoice's intent's client secret, or are you initializing your page before it has that secret?

tidal agate
#

Sorry, now that I think better

#

I don't know exactly what you mean by that

#

I'll create a minimal version

#

`const options = {
mode: 'subscription',
amount: totalPrice * 100,
currency,
appearance: {
variables: {
borderRadius: '36px',
}
},
setupFutureUsage: "off_session",
};

return (
    <Elements stripe={stripePromise} options={options}>
        <ElementsConsumer>
            {({ stripe }) => {
                if (!stripe) {
                    return <Spinner />;
                };
                return (
                    <>
                        <ExpressCheckout
                            {...props}
                        />
                        <ManualCheckout
                            {...props}
                        />
                    </>
                );
            }}
        </ElementsConsumer>
    </Elements>
);`
dapper pulsar
#

Gotcha, if you expand the "PayPal" section in your PayPal settings, does it say if recurring payments are turned on?

tidal agate
#

Oh interesting, says requires approval

#

But I received an email saying I was approved

dapper pulsar
#

Ah gotcha, that is likely the issue then. Is the PayPal button showing up for you in test mode? I think this recurring payments setting doesn't exist in test mode, but I think we may just act like it is already on

tidal agate
#

No, its not showing

dapper pulsar
#

Gotcha, seeing the same on my PayPal enabled account in test mode. PayPal shows up for me for one time payments but not subscriptions

#

Checking if it is possible to enable this for test mode PayPal

tidal agate
#

Thanks!

grizzled adderBOT
inner scarab
#

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

tidal agate
#

Hello!

inner scarab
#

It looks like something changed regarding the way PayPal recurring payments work in test mode. This is something we're looking into, but likely won't be able to solve here on Discord. I recommend you write in to support and explain that there's no option to enable PayPal in test mode on your account. That way, when the issue is resolved, you'll get a reply to your support request about it. https://support.stripe.com/contact/email

tidal agate
#

Alright, I understand

#

One last thing I have just ran into

#

I was previously creating a subscription with a predivined price_id

#

Now, I am tyring to dynamically create a subscription (based on dynamic price ids), but it seems that the payment_intent is always null

#

const product = await stripe.products.create({ name: Subscription with ${addon} addon`,
});
console.log("Stripe product has been created.");

//create a dynamic price
const price = await stripe.prices.create({
    unit_amount: totalPrice,
    currency: currency.toLowerCase(),
    recurring: {interval: 'year'},
    product: product.id,
});
console.log("Stripe price has been created.");
  
//create the subscription
const subscription = await stripe.subscriptions.create({
    customer: stripeCustomerId,
    items: [{
        price: price.id,
    }],
    payment_behavior: 'default_incomplete',
    payment_settings: { save_default_payment_method: 'on_subscription' },
    expand: ['latest_invoice.payment_intent'],
    metadata: metadata,
});
console.log("Stripe subscription has been created.");`.
inner scarab
#

Can you give me the ID of the Subscription that code created so I can take a look?

tidal agate
#

Sure, 1 sec please

#

sub_1P42z8J4ILijjURSEZaPsmh4

inner scarab
#

Looking...

tidal agate
#

Thanks!

inner scarab
#

The Invoice's total was below our minimum charge amount, so that negative amount was applied to the Customer's balance instead of being charged.

#

That balance will be applied to the next Invoice that has a total above our minimum charge amounts.

#

That's when you'll get that money.

#

So no Payment Intent is expected in this case.

tidal agate
#

Okay, so I should try again with a higher amount

#

Admittedly, Im a bit confused by the negative amounts you mentioned

inner scarab
#

I'm happy to clarify.

#

In this case the Invoice's total was for £0.29. Our minimum charge amount for GBP is £0.30. We can't create a Payment Intent for an amount lower than that, so we didn't. Instead, we applied a -£0.29 amount to the Customer's balance. That balance will automatically be applied to the next Invoice created for that Customer, which in this case means the Invoice will be for the amount of the line items on that Invoice plus £0.29.

tidal agate
#

I see

#

The problem is that I don't remember ever having that amount

#

for example, I'm just trying to make a 19 pound payment

inner scarab
#

Also, the Price you specified has an amount of 29.

tidal agate
#

Ah, I see

#

I'm looking into that

#

So sorry, you're right

#

I forgot about the *1000 trick

tidal agate
inner scarab
#

No, it won't create the Price/Product clutter, which is why I recommended it.

#

Give it a try and see if it fits your use case better.

tidal agate
#

Thanks a lot!

#

Thanks for your time!