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

184
Visualizações
Razorpay :Cannot read property postMessage of null while opening razorpay popup 2nd time

I've itegrated razorpay with angular 9 but I get the error cannot read property postMessage of null. While try to click on 2nd time after 1st successfull payment. I did some research & it suggests that it because of it comes from XDM which I don't know much about, looks like it creates an iframe for communication. I have provided my code below See err screen shot here

clickitem() {      
      this.req2.key = payment.razorpayKey;
      this.req2.name = payment.name;
      this.req2.email = payment.email;
      this.req2.address = payment.address;
      this.req2.order_id = payment.orderId;
      this.req2.clientQuotationid = payment.clientQuotationid;
      this.req2.amount = payment.amount;
      this.handle: function (response) {
      paass(response.razorpay_payment_id, response.razorpay_order_id, response.razorpay_signature, PaymentComponent.amount);
      var event = new CustomEvent("payment.success",
        {
          detail: response,
          bubbles: true,
          cancelable: false
        }
      );
      window.dispatchEvent(event);
    }
      PaymentComponent.amount = payment.amount;
      this.req2.contactnumber = payment.contactNumber;
      var rzp1 = new Razorpay(this.req2);
      
      rzp1.open(); // ---------- This line gives error on clicing 2nd time

      rzp1.on('payment.failed', function (response) {
        // Todo - store this information in the server
        //console.log('Error Code:- ' +response.error.code);    

        const StatusNew = 'failed';
        const u_pgID = 'undefined';
        rzp1.close();
        if (response.error.metadata.payment_id === undefined) {
          faill(u_pgID, response.error.metadata.order_id, response.error.code, response.error.description, response.error.source, response.error.step, response.error.reason, StatusNew); 
         
        }
        else {
          faill(response.error.metadata.payment_id, response.error.metadata.order_id, response.error.code, response.error.description, response.error.source, response.error.step, response.error.reason, StatusNew);
        }
      });
 }
 
 paass(){} // ------- to store success in db
faill(){}// ------- to store Failure in db
button.btnPrimary((click)='clickitem();' pButton='', pRipple='', type='button', label='Pay Now')

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