#rangermillze_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/1293283825488498759
๐ 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.
- rangermillze_api, 3 hours ago, 60 messages
- rangermillze_api, 5 hours ago, 27 messages
- rangermillze_api, 6 hours ago, 89 messages
What do you mean by "need them together" exactly?
hi, i mean i want both elements on the same page
I dont want my users to be taken to another external site like paypal, so I need to make the paypal button appear on the same page as the payment element.
So my customers can either choose to use card payment on the payment element or the paypal checkout with ECE
this is what my checkout page looks like at the moment:
the paypal button is the one added via the dashboard (which redirects the user offline). So i will be removing this and adding the ECE one below to get a better experience.
my thinking is to do something like this:
when the user click "paypal" i call the following script:
paymentElement.on('change', function(event) {
if( event.type == "paypal"){
//show the paypal ECE button and hide #paypal-panel
}
});
so I hide the paypal panel, the submit button and show the paypal ECE button. (which is loaded in the background)
and if the custoemr click Card, then i do the same and hide the paypal ECE element.
Hmm that might be a bit tricky to do since ECE and PaymentElement aren't designed to work together.
the last dev i spoke to said they will work fine together. I think i just need to seperate the elements. My main issue will be using the clientkey twice?
When you say client key, are you referring to pk_test or pi_xxx ?
var clientSecret = response.clientSecret;
obtained by calling $response = $stripe->subscriptions->create([])
i.e $response->latest_invoice->payment_intent->client_secret;
or $response->pending_setup_intent->client_secret;
the payment_intent is used when handling trials
Gotcha. I don't think client-secret can be used between two elements ๐ค
Have you already tried using it for two different elements instance? Are you seeing any errors?
not yet, im' just going to put the code together now. What i dont want to do is have to duplicate code.
Gotcha. I'd recommend giving it a try and see if it works/breaks things. I haven't tested it myself so I don't know what the expected behavior would be here