Saturday, 6 February 2021

Square Payment api integration angular and firebase serverless

I am creating a project using angular. In my project I am integrating square payment api and create charge using firebase. I know we can achieve with this server side easily, but my requirement is to do serverless. I already integrating angular side square api, but I don't know how can I create charge without server

cardNonceResponseReceived: function (errors, nonce, cardData)  {
        if (errors) {
          // Log errors from nonce generation to the Javascript console
          console.log("Encountered errors:");
          errors.forEach(function(error) {
            console.log('  ' + error.message);
          });
  
          return;
        }
  
        alert('Nonce received: ' + nonce); /* FOR TESTING ONLY */
  
        // Assign the nonce value to the hidden form field
        // document.getElementById('card-nonce').value = nonce;
        //needs to be extracted from the
        (<HTMLInputElement>document.getElementById('card-nonce')).value = nonce; //casting so .value will work
        //get this value from the database when the user is logged in
        (<HTMLInputElement>document.getElementById('sq-id')).value = "CBASEC8F-Phq5_pV7UNi64_kX_4gAQ";
  
        // POST the nonce form to the payment processing page
        (<HTMLFormElement>document.getElementById('nonce-form')).submit();
  
      },


from Square Payment api integration angular and firebase serverless

No comments:

Post a Comment