Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Closed
andriyfm opened this issue Oct 25, 2020 · 4 comments
Closed

Comments

@andriyfm
Copy link

andriyfm commented Oct 25, 2020

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
Copy link
Collaborator

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
Copy link
Author

andriyfm commented Oct 26, 2020 via email

@rizdaprasetya
Copy link
Collaborator

rizdaprasetya commented Oct 26, 2020

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
Copy link
Author

Mantap. makasih pencerahannya mas @rizdaprasetya

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants