#paulc7053_code
1 messages · Page 1 of 1 (latest)
👋 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.
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.
- paul_ece-react, 18 hours ago, 157 messages
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;`
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.
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*
It looks like the payment request button does have an option for collecting emails https://docs.stripe.com/js/payment_request/create#stripe_payment_request-options-requestPayerEmail
Not currently seeing it for the Express Checkout Element but can look further
Yes, I'm using the ECE
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
Alright, thanks!
I'm not seeing this for ECE, will ask my colleagues and get back to you
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
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"] };
Interesting, looking in to that and will get back to you
Thanks!
Is PayPal on in your payment settings? Also if you create a payment intent and specify payment_method_types=['paypal] do you get any errors?
https://dashboard.stripe.com/settings/payment_methods
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
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?
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>
);`
Gotcha, if you expand the "PayPal" section in your PayPal settings, does it say if recurring payments are turned on?
Oh interesting, says requires approval
But I received an email saying I was approved
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
No, its not showing
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
Thanks!
Hello! I'm taking over and catching up...
Hello!
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
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.");`.
Can you give me the ID of the Subscription that code created so I can take a look?
Also note that if you're doing one-off/ad-hoc pricing you may want to use price_data when creating the Subscription instead of creating a distinct Price separately: https://docs.stripe.com/api/subscriptions/create#create_subscription-items-price_data
Looking...
Thanks!
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.
Okay, so I should try again with a higher amount
Admittedly, Im a bit confused by the negative amounts you mentioned
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.
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
In your request to create the Subscription you set metadata that indicates the total price is 29: https://dashboard.stripe.com/test/logs/req_44LCkJWm0OKODA
Also, the Price you specified has an amount of 29.
Ah, I see
I'm looking into that
So sorry, you're right
I forgot about the *1000 trick
Do you recommend using this as opposed to my approach? ( does it still create the price/product clutter my approach does)