Midtrans / midtrans-nodejs-client

Official Midtrans Payment API Client for Node JS | https://midtrans.com
MIT License
174 stars 56 forks source link

Transaction cannot be authorized with the current client/server key #22

Closed andriyfm closed 3 years ago

andriyfm commented 3 years ago

Kenapa server mengirimkan response status 401 di mode production?

Sebelumnya saya test di mode sandbox berhasil tidak ada kendala.

Berikut adalah response yang saya dapet di mode production:

{
    "status_code": "401",
    "status_message": "Transaction cannot be authorized with the current client/server key.",
    "id": "1679fb5e-31b2-49e0-bbae-cec703a5cdde"
}

Berikut adalah request dari servernya:

const midtransClient = require('midtrans-client');

const midtrans = new midtransClient.CoreApi({
  isProduction: true,
  serverKey: 'SERVER_KEY',
  clientKey: 'CLIENT_KEY',
});

module.exports.charge = async (req, res) => {
  try {
    const promise = await midtrans.charge(req.body);
    return res.send(promise);
  } catch (err) {
    return res.status(err.httpStatusCode).send(err.ApiResponse);
  }
};

Mungkin ada yang bisa bantu jawab, saya pertama kali menggunakan midtrans sampe di mode production, atau apakah musti kontak pihak midtrans jika mau mengganti mode ke production?

Terima kasih

rizdaprasetya commented 3 years ago

Hi @andriyfm berdasarkan log di sisi API Midtrans, request Anda gagal karena serverKey yg digunakan salah, yg saat itu digunakan adalah clientKey, bukan serverKey. Pastikan sudah menggunakan serverKey yg benar. Contoh format serverKey: Mid-Server-xxx.... Thanks

andriyfm commented 3 years ago

Oh iya clientKey sama serverKey yang sya masukan kebalik. Tapi sekarang pesan response yang didapat adalah "Payment channel is not activated."

Pada tanggal Sen, 26 Okt 2020 pukul 11.25 Rizda Dwi Prasetya < notifications@github.com> menulis:

Hi @andriyfm https://github.com/andriyfm berdasarkan log di sisi API Midtrans, request Anda gagal karena serverKey yg digunakan salah, yg saat itu digunakan adalah clientKey, bukan serverKey. Pastikan sudah menggunakan serverKey yg benar. Contoh format serverKey: Mid-Server-xxx.... Thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Midtrans/midtrans-nodejs-client/issues/22#issuecomment-716295352, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG53MBTRKV52YTYK66TAVFLSMT22DANCNFSM4S6KPCDQ .

rizdaprasetya commented 3 years ago

Untuk case Payment channel is not activated, pastikan sudah "complete registration" pada banner di Dashboard Midtrans. atau sebaiknya kontak melalui email support[at]midtrans.com untuk dicek dan bantu aktivasi spesifik di akun Anda tersebut @andriyfm

Karena sudah bukan technical issue yang related dengan repo ini, maka issue ini akan kami close. Selanjutnya bisa kontak melalui email Support tersebut. Terima kasih.

andriyfm commented 3 years ago

Mantap. makasih pencerahannya mas @rizdaprasetya