Giter VIP home page Giter VIP logo

Comments (4)

ferasallaou avatar ferasallaou commented on May 23, 2024 3

@ssdwho Selam, bu şekilde kullanabilirsin

const makePayment = (request) => {
  return new Promise((Resolve, Reject) => {
    iyzipay.payment.create(request, async function (err, result) {
      if (err) {
        Reject({
          id: 'Payment',
          message: err
        })
      }


      if (result && result.status == 'failure') {
        Reject({
          id: 'Payment Failed',
          message: result.errorMessage
        })
      }

      Resolve(result)
    });
  })
}

const getPayment = await makePayment(requestObject)

from iyzipay-node.

moahammadalt avatar moahammadalt commented on May 23, 2024

you are using both callbacks and promises together, which Is wrong in theory.

right now promises and async-await are not supported in the client, in order to get your code works, you have to use only callbacks like this:

exports.handler = (event) => { 
     iyzipay.payment.create(request, function (err, result) { 
         // do whatever you want with the result here 
     }); 
};

from iyzipay-node.

ssdwho avatar ssdwho commented on May 23, 2024

exports.handler = (event) => { iyzipay.payment.create(request, function (err, result) { return err ? err : result; }); };

payment is successful, but the result is still 'null'.

how can I view the response? no document? I could not see. There is only one sample code.

from iyzipay-node.

moahammadalt avatar moahammadalt commented on May 23, 2024

you are getting it null because of the wrong implementation of your code.

try to change your code to the one i sent before in the comments and i am sure you will get the desired result.

from iyzipay-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.