通过SDK自身构建订单
这种方式让前端生成订单, 但不推荐这种方式使用
请注意不推荐使用
//请注意 sessionToken 和 orderInfo 互斥 会优先使用sessionToken 请不要同时使用
// 如果不想通过后端生成session,则需要提供appId, merchantId, merchantRsaPublicKey, orderInfo
//获取方式 商户后台>开发者>标准秘钥
const checkoutOptions = {
appId: "your-app-id",
merchantId: "your-merchant-id",
merchantRsaPublicKey: "your-merchant-rsa-public-key",
env: "test", // 'test' | 'prod'
orderInfo: {
amount: {
currency: "USD",
value: 100,
},
countryCode: "US",
productDetail: "Sample Product",
origin: "https://your-website.com",
reference: "ORDER_123",
returnUrl: "https://your-website.com/return",
webhookUrl: "https://your-website.com/webhook",
productName: "Sample Product",
paymentMethod: {
type: "card",
firstName: "John",
lastName: "Doe",
shopperEmail: "[email protected]",
telephoneNumber: "1234567890",
},
browserInfo: {
terminalType: "web",
osType: "window",
},
},
};Updated 3 days ago