一、SDK概述
极速支付SDK提供了简单易用的接口,帮助开发者快速集成支付功能。
二、安装配置
// 使用npm安装
npm install jsupay-sdk
// 或使用yarn安装
yarn add jsupay-sdk
三、初始化配置
const Jsupay = require('jsupay-sdk');
const client = new Jsupay({
merchant_id: 'your_merchant_id',
api_key: 'your_api_key',
environment: 'production' // 或 'sandbox'
});
四、接口调用示例
// 创建支付订单
const order = await client.createOrder({
order_no: '202404220001',
amount: 100.00,
currency: 'CNY',
notify_url: 'https://your-domain.com/notify'
});
// 查询订单状态
const status = await client.queryOrder('202404220001');
五、注意事项
- 请妥善保管API密钥
- 建议在测试环境完成测试后再上线
- 注意处理异常情况
- 定期更新SDK版本