#DaganChen

1 messages · Page 1 of 1 (latest)

urban pierBOT
robust forum
#

hello! i'm not entirely sure i understand what you're referring to - what does redirect inside app and redirect on site mean?

echo sundial
#

I have an react native app

#

and react site, and an angular site

#

react -> holds an identifier and creates seti_ pm_ or whatever

#

when calling him from react native app, it redirects user to bank account and returns to same process with needed data

#

when calling him from website (angular)
it completely redirects the entire website to redirect page, so when returns, it cant pass back the values

#

when redirect, I'm losing my current site

robust forum
#

can you share the code that you're using for angular to collect payment?

echo sundial
#

it's just an iframe

#

function onIFrameResponse(e) {
console.log('onIFrameResponse',e);
if(vm.paymentServiceName === 'firstpay'){
if (e.data.firstpay && e.data.code === 105) {
vm.user.firstPayCrypto = e.data.cryptogram;
vm.user.forceDisable = vm.addNewToken;
$scope.$apply();
}
}else{
if(e.data.payload){
vm.user.firstPayCrypto = e.data.payload.data.id;//Server expectations
vm.user.token = vm.user.firstPayCrypto;
vm.user.forceDisable = vm.addNewToken;
vm.user.payment_response = e.data.payload.data;
$scope.$apply();
console.log(e.data.payload);
}
}
}

#

this one listen to that react iFRAME

robust forum
#

nothing about this code seems to be using Stripe?

echo sundial
#

lol

#

thats the react part

#

const handleSubmit = async (event: any) => {
// We don't want to let default form submission happen here,
// which would refresh the page.
event.preventDefault();

    if (!stripe || !elements) {
        // Stripe.js has not yet loaded.
        // Make sure to disable form submission until Stripe.js has loaded.
        return;
    }
 
    const {error,setupIntent} = await stripe.confirmSetup({
        elements,
        confirmParams: {
            // Return URL where the customer should be redirected after the SetupIntent is confirmed.
            return_url: `${process.env.REACT_APP_SELF}/payments/iframeResponse`,
        },
        redirect: 'if_required'
    });

    if (error) {
        console.log(error,'error from stripe')
        setErrorMessage(error.message as any);
    }
    else {
        console.log('no errors', setupIntent);
        if (setupIntent) {
            console.log('on setup intent');
            props.callback(setupIntent);
        }
        // Your customer will be redirected to your `return_url`. For some payment
        // methods like iDEAL, your customer will be redirected to an intermediate
        // site first to authorize the payment, then redirected to the `return_url`.
    }
}

return (
    <form onSubmit={handleSubmit}>
        <PaymentElement />
        <button disabled={!stripe}>Submit</button>
        {/* Show error message to your customers */}
        {errorMessage && <div>{errorMessage}</div>}
    </form>
)

};

#

that redirect is fired in a poor way

#

?

full musk
#

Hi there, you mean you embedded the react app in an iframe of your webpage?

echo sundial
#

lets talk about webpage

#

webpage -> iframe (react) ->code is above

#

it should redirect the user and then return seti_ to webpage

#

but it fires the entire screen

#

so callback is not valid

full musk
#

That's how redirect works, it will refresh the whole page.

#

Is there a reason why you choose to embed the payment element in an iframe instead of integrating it directly to your webpage?

echo sundial
#

yeah I have a mini service that I can call from anywhere

#

even if I do so, how can I keep him on site?
if redirect throws to complete screen ?

#

and my old site is AngluarJS and new is react, so doing it in AngularJS is a much harder work

#

?

full musk
#

I'd suggest you to redesign your webpage instead of embedding the payment element inside an iframe.

echo sundial
#

not that easy and it based to work for multiple sites

#

but it wont resolve redirect issue

#

you guys have any idea as a solution?

full musk
#

No I'm afraid.

echo sundial
#

Can I open redirect in a new tab? and then return response to the opener?

full musk
#

You can try but I don't know how to implement this behaviour.

echo sundial
#

can you direct me to managers that might?
u are doing your job great of course but someone might know

full musk
#

We can help you if your question is directly related to Stripe products. But adapting browser behaviour is not our area of expertise.

echo sundial
#

the redirect is a issue I'm sure happens to a lot