Authentication
Merchant dashboard authentication — login, 2FA, password management, and session handling.
Methods
login
- JavaScript
- Python
const result = await zenpays.auth.login({
email: 'merchant@example.com',
password: 'your-password',
})
if (result.requires2FA) {
// Prompt for 2FA code
const verified = await zenpays.auth.verify2FALogin({
tempToken: result.tempToken,
code: '123456',
})
}
result = zenpays.auth.login({
"email": "merchant@example.com",
"password": "your-password",
})
if result.get("requires2FA"):
verified = zenpays.auth.verify_2fa_login({
"tempToken": result["tempToken"],
"code": "123456",
})
verify2FALogin
const result = await zenpays.auth.verify2FALogin({
tempToken: 'temp_xxx',
code: '123456',
})
refreshToken
const tokens = await zenpays.auth.refreshToken({
refreshToken: 'refresh_xxx',
})
logout
await zenpays.auth.logout()
changePassword
await zenpays.auth.changePassword({
currentPassword: 'old-password',
newPassword: 'new-password',
})
forgotPassword
await zenpays.auth.forgotPassword({
email: 'merchant@example.com',
})
verifyResetToken
const result = await zenpays.auth.verifyResetToken({
token: 'reset_xxx',
})
resetPassword
await zenpays.auth.resetPassword({
token: 'reset_xxx',
newPassword: 'new-password',
})