生成 PGP 密钥对
生成密钥对,将公钥发给 UQPAY,私钥安全保存:配置 PGP 密钥
创建 client 后,一次性配置 PGP 密钥。可传文件路径(.asc、.pgp、.gpg)或密钥 ASCII 字符串:
创建处理器
用createHandler 构造一个兼容 Express 的请求处理器,你只需实现 decide 回调:
transaction_id 注入响应,并完成所有 PGP 加解密。
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
用 UQPAY Node.js SDK 处理带 PGP 加密的卡交易实时授权决策。
import { generateAuthDecisionKeyPair } from '@uqpay/sdk'
const { publicKey, privateKey } = await generateAuthDecisionKeyPair({
name: 'Acme Corp',
email: 'issuing.tech@acme.com',
})
.asc、.pgp、.gpg)或密钥 ASCII 字符串:
await client.issuing.authDecision.configure({
privateKey: './keys/my-private.asc',
uqpayPublicKey: './keys/uqpay-public.asc',
passphrase: process.env.PGP_PASSPHRASE, // optional
})
createHandler 构造一个兼容 Express 的请求处理器,你只需实现 decide 回调:
const handler = client.issuing.authDecision.createHandler({
decide: async (transaction) => {
// transaction contains: billing_amount, merchant_name, card_id, etc.
if (transaction.billing_amount > 10000) {
return { response_code: '51' } // Insufficient Funds
}
return { response_code: '00', partner_reference_id: 'ref-001' }
},
onError: (err) => console.error('Auth decision error:', err),
})
app.post('/auth-decision', handler)
transaction_id 注入响应,并完成所有 PGP 加解密。
