根据已保存的报价准备 EOA 的 Permit2 兑换
curl --request POST \
--url https://api.renaiss.xyz/v2/redeem/checkout/prepare \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-builder-api-key: <api-key>' \
--data '
{
"quoteId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"courierId": "<string>",
"recipient": {
"name": "<string>",
"phone": "<string>",
"email": "jsmith@example.com",
"taxId": "<string>",
"chineseName": "<string>"
},
"insurance": true
}
'const options = {
method: 'POST',
headers: {
'x-builder-api-key': '<api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
quoteId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
courierId: '<string>',
recipient: {
name: '<string>',
phone: '<string>',
email: 'jsmith@example.com',
taxId: '<string>',
chineseName: '<string>'
},
insurance: true
})
};
fetch('https://api.renaiss.xyz/v2/redeem/checkout/prepare', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.renaiss.xyz/v2/redeem/checkout/prepare"
payload = {
"quoteId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"courierId": "<string>",
"recipient": {
"name": "<string>",
"phone": "<string>",
"email": "jsmith@example.com",
"taxId": "<string>",
"chineseName": "<string>"
},
"insurance": True
}
headers = {
"x-builder-api-key": "<api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"preparationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"requestId": "<string>",
"walletAddress": "<string>",
"tokenIds": [
"<string>"
],
"expiresAt": "2023-11-07T05:31:56Z",
"address": {
"countryCode": "<string>",
"addressLine1": "<string>",
"city": "<string>",
"postalCode": "<string>",
"addressLine2": "<string>",
"state": "<string>"
},
"recipient": {
"name": "<string>",
"phone": "<string>",
"email": "jsmith@example.com",
"taxId": "<string>",
"chineseName": "<string>"
},
"courierName": "<string>",
"fees": {
"handlingFeeInUsd": "<string>",
"shippingFeeInUsd": "<string>",
"insuranceFeeInUsd": "<string>",
"dutyAndTaxesInUsd": "<string>",
"totalFeeInUsdt": "<string>"
},
"redemptionTypedData": {
"domain": {
"name": "<string>",
"chainId": 123,
"verifyingContract": "<string>",
"version": "<string>"
},
"types": {},
"primaryType": "<string>",
"message": {}
},
"permitTypedData": {
"domain": {
"name": "<string>",
"chainId": 123,
"verifyingContract": "<string>",
"version": "<string>"
},
"types": {},
"primaryType": "<string>",
"message": {}
}
}{
"error": "Invalid redemption input",
"code": "WRONG_REQUEST_PARAMS"
}{
"error": "Required authentication credential is missing",
"code": "API_AUTH_MISSING_CREDENTIAL"
}{
"error": "Every collectible must be owned by the authenticated EOA",
"code": "WRONG_REQUEST_PARAMS"
}{
"error": "Not found or expired",
"code": "REDEMPTION_ORDER_NOT_FOUND"
}{
"error": "Authentication rate limit exceeded",
"code": "API_AUTH_RATE_LIMITED"
}{
"error": "Internal server error",
"code": "FUNCTION_ERROR"
}{
"error": "Internal server error",
"code": "FUNCTION_ERROR"
}实物兑换与配送
准备兑换结账
按报价为选定的卡牌、收件人、地址和快递服务生成 Permit2 授权。
POST
/
v2
/
redeem
/
checkout
/
prepare
根据已保存的报价准备 EOA 的 Permit2 兑换
curl --request POST \
--url https://api.renaiss.xyz/v2/redeem/checkout/prepare \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-builder-api-key: <api-key>' \
--data '
{
"quoteId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"courierId": "<string>",
"recipient": {
"name": "<string>",
"phone": "<string>",
"email": "jsmith@example.com",
"taxId": "<string>",
"chineseName": "<string>"
},
"insurance": true
}
'const options = {
method: 'POST',
headers: {
'x-builder-api-key': '<api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
quoteId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
courierId: '<string>',
recipient: {
name: '<string>',
phone: '<string>',
email: 'jsmith@example.com',
taxId: '<string>',
chineseName: '<string>'
},
insurance: true
})
};
fetch('https://api.renaiss.xyz/v2/redeem/checkout/prepare', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.renaiss.xyz/v2/redeem/checkout/prepare"
payload = {
"quoteId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"courierId": "<string>",
"recipient": {
"name": "<string>",
"phone": "<string>",
"email": "jsmith@example.com",
"taxId": "<string>",
"chineseName": "<string>"
},
"insurance": True
}
headers = {
"x-builder-api-key": "<api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"preparationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"requestId": "<string>",
"walletAddress": "<string>",
"tokenIds": [
"<string>"
],
"expiresAt": "2023-11-07T05:31:56Z",
"address": {
"countryCode": "<string>",
"addressLine1": "<string>",
"city": "<string>",
"postalCode": "<string>",
"addressLine2": "<string>",
"state": "<string>"
},
"recipient": {
"name": "<string>",
"phone": "<string>",
"email": "jsmith@example.com",
"taxId": "<string>",
"chineseName": "<string>"
},
"courierName": "<string>",
"fees": {
"handlingFeeInUsd": "<string>",
"shippingFeeInUsd": "<string>",
"insuranceFeeInUsd": "<string>",
"dutyAndTaxesInUsd": "<string>",
"totalFeeInUsdt": "<string>"
},
"redemptionTypedData": {
"domain": {
"name": "<string>",
"chainId": 123,
"verifyingContract": "<string>",
"version": "<string>"
},
"types": {},
"primaryType": "<string>",
"message": {}
},
"permitTypedData": {
"domain": {
"name": "<string>",
"chainId": 123,
"verifyingContract": "<string>",
"version": "<string>"
},
"types": {},
"primaryType": "<string>",
"message": {}
}
}{
"error": "Invalid redemption input",
"code": "WRONG_REQUEST_PARAMS"
}{
"error": "Required authentication credential is missing",
"code": "API_AUTH_MISSING_CREDENTIAL"
}{
"error": "Every collectible must be owned by the authenticated EOA",
"code": "WRONG_REQUEST_PARAMS"
}{
"error": "Not found or expired",
"code": "REDEMPTION_ORDER_NOT_FOUND"
}{
"error": "Authentication rate limit exceeded",
"code": "API_AUTH_RATE_LIMITED"
}{
"error": "Internal server error",
"code": "FUNCTION_ERROR"
}{
"error": "Internal server error",
"code": "FUNCTION_ERROR"
}- 请钱包持有人核对所选卡牌、收件人、地址、快递和总价。
- 使用服务端报价中的费用。准备结账时,这些信息会与当前开发者绑定。
- 提交前,请核对钱包授予 Permit2(
permitTypedData.domain.verifyingContract)的 USDT 额度,确保足以支付permitTypedData.message.permitted.amount。额度不足时,请授权所需金额并等待确认。仅签署 witness 不会增加这项额度。 - 保存准备 ID,并让钱包签署一份 Permit2 witness 授权。
请求
需要开发者密钥和钱包访问令牌
响应
错误码
在下表中查找接口返回的 HTTP 状态码和响应原文。有关各接口通用的处理建议,请参阅错误码含义与处理方式。
| HTTP | 错误码 | 文本字段 | 响应文本与处理方式 |
|---|---|---|---|
400 | WRONG_REQUEST_PARAMS | error | Invalid redemption inputRequest body is too large字段或购物车无效、藏品尚不可兑换、来自多个金库地区、缺少申报价值,或目的地不可用或缺少州或省。请修正后重发。报价过期或所选承运商不在报价内时,需重新获取报价。 |
401 | API_AUTH_INVALID_CREDENTIAL | error | Invalid authentication credential密钥或钱包令牌格式错误、未知、已过期或被撤销。核对密钥,刷新钱包令牌或让钱包重新登录。 |
401 | API_AUTH_MISSING_CREDENTIAL | error | Required authentication credential is missing缺少开发者密钥或钱包访问令牌。请在 x-builder-api-key 中发送密钥,并同时发送 Bearer 令牌。 |
403 | API_AUTH_CREDENTIAL_NOT_ALLOWED | error | Credential is not allowed by this policy路由不接受所提供的某些凭据。仅发送开发者密钥和钱包访问令牌。 |
403 | API_AUTH_INSUFFICIENT_SCOPE | error | Required authentication scope is missing令牌缺少所需权限,读取需 redeem:read,修改需 redeem:write。请钱包重新登录并申请相应权限。 |
403 | API_AUTH_INTEGRATION_MISMATCH | error | Authentication integrations do not match令牌和密钥属于不同开发者。请使用签发令牌的开发者对应的密钥。 |
403 | API_AUTH_SUBJECT_MISMATCH | error | Authentication subjects do not match令牌所属链与 API 不符。请针对正确的链重新验证钱包。 |
403 | GACHA_V3_BUILDER_NOT_ACCEPTED_ON_PUBLIC_API | error | This builder checks out on its own surface, not on the public API此密钥无法用于当前 API。请联系 Renaiss,无需重试。 |
403 | WRONG_REQUEST_PARAMS | error | Every collectible must be owned by the authenticated EOA购物车包含钱包令牌所属钱包未持有的藏品。仅提交该钱包持有的藏品。 |
404 | REDEMPTION_ORDER_NOT_FOUND | error | Not found or expiredNot found当前钱包及开发者名下没有对应报价或准备记录,或记录已过期。请重新获取报价。 |
429 | API_AUTH_RATE_LIMITED | error | Authentication rate limit exceeded已达到密钥的请求频率上限。稍候再以较低频率重试。 |
500 | API_AUTH_INVALID_CONFIGURATION | error | Internal server error若钱包认证持续失败,请将 x-request-id 提供给 Renaiss。 |
500 | API_AUTH_ERROR | error | Internal server error |
500 | FUNCTION_ERROR | error | Internal server error |
503 | FUNCTION_ERROR | error | Internal server error |
授权
请求体
application/json
响应
成功