Getting this error when using paynow.sendMobile()


TypeError: Failed to fetch

       let paynow = new Paynow("xxx", "xxxxxxxxxxxxxx");

// Set return and result urls
      paynow.resultUrl = "";
      paynow.returnUrl = "";

// Create a new payment
      let payment = paynow.createPayment("Invoice 35",'[email protected]');

// Add items to the payment list passing in the name of the item and it's price
      payment.add("Bananas", 2.5);
      payment.add("Apples", 3.4);

// Send off the payment to Paynow

          // The payment to send to Paynow

          // The phone number making payment

          // The mobile money method to use.

      ).then(function(response) {
          if(response.success) {
              // These are the instructions to show the user.
              // Instruction for how the user can make payment
              let instructions = response.instructions // Get Payment instructions for the selected mobile money method

              // Get poll url for the transaction. This is the url used to check the status of the transaction.
              // You might want to save this, we recommend you do it
              let pollUrl = response.pollUrl;


          } else {
      }).catch(ex => {
          // Ahhhhhhhhhhhhhhh
          // *freak out*
          console.log('Your application has broken an axle', ex.message)


Ive tried both the sendMobile() and send(). The sendMobile() doesnt return anything, whilst the send() works but the pollstatus doesnt return anything so no way of knowing if transactions successful. Theres something wrong with this nodejs SDK. The support team is slow to respond. Very Poor


Hi @kudzanaim.

Can you please send a snippet of your payment code? I have a REPL set up using the NodeJS SDK and I’m not running into any issues. A code sample could help the community assist with the issue you’re running into

PS: Will be deleting the integration keys in a day or so. Just wanted to demo this


So the idea here is if I do sendMoney(), i am returned an object with instructions and pollURL which i can then use to check if transaction is complete, which isnt working. I’ve tried implementing your documented code in my code and getting same error. When I pass pollURL into pollTransaction(x), an error occurs saying “Invalid URI”. ive posted my code in the other question.


Hi Kudzanai.

I’m looking into that error. I’ll have an update for by end of today


Any updates on the issue. I think its a problem with paynow node sdk


Hey Kudzanai. Keep an eye on this GitHub issue. Working out the kink right now.


The issue should be resolved in version 1.0.7 of the SDK. It might take about 30 minutes to an hour before the new version shows up on npm though

Let me know if you’re still facing issues.


@kudzanaim. new version is now on npm.


Thanks alot bro. Will test it out again and let u know.


The new sdk fixed the “sendMobile()” method and that now works. Only issue is the “pollTransactionStatus(x).paid()” method still throws error saying “.paid()” isn’t a function. The sendMobile() does make the payment, but i am in testing environment, i have no way of knowing if the transaction worked or not.


Hey Kudzanai.

The pollTransaction method returns a PromiseLike<StatusResponse> | Promise<StatusResponse>. So you’d have to use it like this:

paynow.pollTransaction(url).then(transaction => {
  if(transaction.status === 'paid') {
     // User showed us the doe

Or if you’re in an async function

let transaction = await paynow.pollTransaction(url);

if(transaction.status === 'paid') {
     // User showed us the doe

I’ll submit a PR to the docs site to reflect those changes in the SDK. Let me know if that gives you issues still