Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

230
Visualizações
How to redirect user on closing Accept.js payment dialog

We have a payment gateway implemented with Authorize.net's Accept.js javascript library in Reactjs. This is is button tag code.

<button
   ref={this.paymentBtnRef}
   style={{ display: "none" }}
   className="AcceptUI"
   disabled={!this.state.acceptJsLoaded || !this.state.formData}
   data-billingaddressoptions='{"show":false, "required":false}'
   data-apiloginid={CONSTANTS.AUTH_NET_API_LOGIN_ID}
   data-clientkey={CONSTANTS.AUTH_NET_CLIENT_KEY}
   data-acceptuiformbtntxt="Proceed"
   data-acceptuiformheadertxt="Payment information"
   data-paymentoptions='{"showCreditCard": true, "showBankAccount": false}'
   data-responsehandler="handlePaymentTokenResponse"
   cancelUrl="/"
>
   [ checkout ]
</button>

I am using the class component in Reactjs and this is where Accept.js loads:-

componentDidMount = () => {
   window.handlePaymentTokenResponse = (obj) => {
      if (this.state.formData) {
         this.props.registerUser({
            ...this.state.formData,
            paymentTokenObj: obj.opaqueData,
         });

         // eslint-disable-next-line
         this.state.formData = null;
      }
   };

   loadScript(
      document,
      "script",
      "authorize-net-accept-js",
      "https://jstest.authorize.net/v3/AcceptUI.js",
      () => {
         this.setState(
            {
               acceptJsLoaded: true,
            },
            () => console.log("authorize-net-accept-js loaded")
         );
      }
   );
   this.props.fetchCreateAccountData();
};

I want to redirect when the user closes the Model but I can't find anything on Authorize.net documentation for cancelling the URL. When the user closes the dialog it stays on the current page I want to redirect the user to another page.

Accept.js renders AccpetUI dialog in an iframe so I can't add onClick on the close icon button. How should I redirect the user ?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda