#just-ah_api
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/1296070503362068491
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
What's the sub_xx ID you've created
Also, your integration is a little backwards which may be causing issues. Generally with ECE you create the intent/subscription after the user provides payment details. So you'd initialise ECE without a client secret and pass these parameters instead: https://docs.stripe.com/js/elements_object/create_without_intent
My understanding is that PayPal should work in that scenario, so it's likely a integration misconfiguration
Hi! Hmm interesting.For instance this sub_id sub_1Q9arUGzd0JjFWBKJP0OlHoO
currently, we create subscription with payment intent
and if customer complited the payment the subscription automatically change status from Incomplete to Active
hi! I'm taking over this thread.
so your goal is to pay a Subscription with Paypal and the Express Checkout Element?
I tried setting off_session: true on the server when creating a subscription. In that case, the PayPal button appeared in the UI.
that's odd. give me a few minutes to try to reproduce this on my end.
sure, take ur time. 1 clarification, It shown up with off_session: true only in Sandbox env. On Prod I never see PayPal bnt with any config
I can provide more code from server/client if needed
can you share your frontend code, to see how you initilaize the ECE?
sec
`
private createAdditionalPaymentButton(stripe: Stripe) {
const expressCheckoutElement = this.stripeElements?.create('expressCheckout', {
paymentMethods: {
applePay: 'always',
googlePay: 'always',
paypal: 'auto',
link: 'auto',
amazonPay: 'auto',
},
paymentMethodOrder: ['applePay', 'paypal', 'link', 'googlePay', 'amazonPay'],
buttonTheme: {
applePay: 'black',
googlePay: 'black',
paypal: 'gold',
},
layout: {
maxRows: 2,
},
buttonHeight: 48,
});
expressCheckoutElement?.mount(this.expressCheckoutContainer.nativeElement);
expressCheckoutElement?.on('click', (event) => {
event.resolve({
emailRequired: !this.email
});
});
expressCheckoutElement?.on('ready', ({ availablePaymentMethods }) => {
this.isExpressMethodsAvailable = !!availablePaymentMethods;
this.isLoading = false; //TODO: make sure there is no better api in stripe to wai
});
expressCheckoutElement?.on('confirm', async (event) => {
const { error } = await stripe.confirmPayment({
elements: this.stripeElements,
clientSecret: this.clientSecret,
confirmParams: {
return_url: `${location.origin}/result`,
},
redirect: 'if_required',
});
if (error) {
this.handleError(error);
} else {
// Customer will be redirected to your `return_url`.
this.goToSuccess();
}
});
}`
thanks, having a look
@kind fox can you try and pass mode: 'subscription' to elements.create()? https://docs.stripe.com/js/elements_object/create_without_intent#stripe_elements_no_intent-options-mode
Actually, ignore me. What does your stripe.elements() code look like?
` private createMainPayment(stripe: Stripe) {
this.stripeElements = stripe.elements({
clientSecret: this.clientSecret,
appearance: {
theme: 'stripe',
variables: {
borderRadius: '8px',
fontFamily: '"Open Sans", sans-serif;'
},
},
loader: 'always'
});
this.card = this.stripeElements?.create('card', {
hidePostalCode: true,
disableLink: true,
style: {
base: {
lineHeight: '40px',
fontFamily: '"Open Sans", sans-serif',
fontSize: '16px',
}
}
});
this.card.mount(this.stripeElement.nativeElement);
if (!this.email) {
this.stripeElements?.create('linkAuthentication').mount(this.stripeEmail.nativeElement);
}
}`
Can you do this, but to stripe.elements()?
And remove clientSecret
You have a mix of deferred and non-deferred integrations and I think it's messing with how we calculate which payment methods to display
to give you a clue how our checkout form looks like here it is.
it contains payment by card option and one-click buttons
Yes, we can account for that with separate Elements instances. Did you try what I outlined specifically for the ECE PayPal issue?
just a sec, i'm trying
Hm, I removed client secret, set mode = subscription + set amout and currency. And for some ready non of ECE one-click btns didn't appear.
it means that availablePaymentMethods is empty
Well amount: 9 is below the minimum charge amount so I suspect that is the issue
It should accurately reflect the value of the intent โ that value is passed to wallet UIs
Although that should not matter if mode: 'subscription' ๐ค
Is there anything in the dev console?
I set amout = 150 and now one click button shown (but only LINK, not paypal)
Is there somewhere I can reproduce this?
I logged available payment methods availablePaymentMethods!!: {"googlePay":false,"applePay":false,"paypal":false,"link":true,"amazonPay":false}
Hold on
there are no any errors in console
Which domain are you testing on?
check this
just enter any random email and click next next, select productk and click checkout, this is sandbox
there is flow with clientSecret curretly deployed on that domain
Ah I think recurring PayPal payments in ECE are still in beta
@remote plume did you find smth maybe? ๐
This is the issue I'm afraid
If you want access, then support can help: https://support.stripe.com/contact/email?topic=api_integration
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Otherwise, I'd recommend spliting your ECE and Card Element integration up like I advised as it may cause issues down the line
so I can request access to this beta feature?
Specifically, have two separate Elements groups: one you initialise with the client secret for the Card Element the other with the other params for ECE
I believe so yes
I'll try. Thank you so much guys for your help and time!
We got there in the end
one more quick question, what is the easiest way to add just a single paypal button? using any stripe js sdk/elements?
like I want to have ECE + single paypal button
You can add your own button with the Direct API integration - https://docs.stripe.com/payments/paypal/accept-a-payment?web-or-mobile=web&payments-ui-type=direct-api
will it work for subscriptions as well?
It should
or..ynnoj ment that paypal reccuring payments in beta overall, but not only with ECE
It is in beta overall for subscriptions
https://docs.stripe.com/payments/paypal
got it, thanks for quick reply!