測試 webhook

測試付款

post https://api.cryptomus.com/v1/test-webhook/payment 複製

若要驗證來自 webhook 資料數組的簽名,請使用支付 API 金鑰。

為了確保您正確接收 webhook 並能驗證簽名,您應該使用此方法來測試付款 webhook。
請注意,沒有資料保存到資料庫中,並且 webhook 中收到的任何資料僅儲存在數組中以用於測試目的,以確保簽名的正確性並測試從我們這裡檢索該數組。

如需使用現有發票測試 Webhook,請提供發票的 UUID 或訂單 ID。如果未提供這些參數,Webhook 將隨測試發票一起傳送。

要求

查詢參數

姓名參數類型預設值定義
url_callback*stringmin:6max:150url-發送付款狀態 webhook 的 URL
currency*string-發票貨幣代碼
network*string-發票網路代碼
uuidstringuuid隨機 uuid 字串發票的 uuid
order_idstringmin:1max:32alpha_dash隨機字串發票的訂單ID
status*stringpaid付款狀態可用選項:processcheckpaidpaid_overfailwrong_amountcancelsystem_failrefund_processrefund_failrefund_paid

參數類型

stringmin:6max:150url

定義

發送付款狀態 webhook 的 URL

參數類型

string

定義

發票貨幣代碼

參數類型

string

定義

發票網路代碼

參數類型

stringuuid

預設值

隨機 uuid 字串

定義

發票的 uuid

參數類型

stringmin:1max:32alpha_dash

預設值

隨機字串

定義

發票的訂單ID

參數類型

string

預設值

paid

定義

付款狀態可用選項:- process- check- paid- paid_over- fail- wrong_amount- cancel- system_fail- refund_process- refund_fail- refund_paid

* - 必需參數

你可以傳遞 uuid 或 order_id 參數中的一個,如果同時傳遞兩個參數,則帳戶將透過 uuid 來識別

請求範例


curl https://api.cryptomus.com/v1/test-webhook/payment \
-X POST \
-H 'merchant: 860166ce-478c-4087-9813-55cfb6c34580' \
-H 'sign: a466b82fad9415cdbf5f47802b8d376c' \
-H 'Content-Type: application/json' \
-d '{
	"uuid": "e1830f1b-50fc-432e-80ec-15b58ccac867",
	"currency": "ETH",
	"url_callback": "https://your.site/callback",
	"network": "eth",
	"status": "paid"
}'
複製

回覆

回應範例


1{
2  "state": 0,
3  "result": []
4}
複製

測試支付

post https://api.cryptomus.com/v1/test-webhook/payout 複製

若要驗證來自 webhook 資料數組的簽名,請使用支付 API 金鑰。

要求

查詢參數

姓名參數類型預設值定義
url_callback*stringmin:6max:150url-發送付款狀態 webhook 的 URL
currency*string-付款貨幣代碼
network*string-支付網路代碼
uuidstringuuid隨機 uuid 字串付款的 uuid
order_idstringmin:1max:32alpha_dash隨機字串付款的訂單ID
status*stringpaid付款狀態可用選項:processcheckpaidfailcancelsystem_fail

參數類型

stringmin:6max:150url

定義

發送付款狀態 webhook 的 URL

參數類型

string

定義

付款貨幣代碼

參數類型

string

定義

支付網路代碼

參數類型

stringuuid

預設值

隨機 uuid 字串

定義

付款的 uuid

參數類型

stringmin:1max:32alpha_dash

預設值

隨機字串

定義

付款的訂單ID

參數類型

string

預設值

paid

定義

付款狀態可用選項:- process- check- paid- fail- cancel- system_fail

* - 必需參數

你可以傳遞 uuid 或 order_id 參數中的一個,如果同時傳遞兩個參數,則帳戶將透過 uuid 來識別

請求範例


curl https://api.cryptomus.com/v1/test-webhook/payout \
-X POST -H 'merchant: 860166ce-478c-4087-9813-55cfb6c34580' \
-H 'sign: a466b82fad9415cdbf5f47802b8d376c' \
-H 'Content-Type: application/json' \
-d '{
	"uuid": "e1830f1b-50fc-432e-80ec-15b58ccac867",
	"currency": "ETH",
	"url_callback": "https://your.site/callback",
	"network": "eth",
	"status": "paid"
}'
複製

回覆

回應範例


1{
2  "state": 0,
3  "result": []
4}
複製

測試錢包

post https://api.cryptomus.com/v1/test-webhook/wallet 複製

若要驗證來自 webhook 資料數組的簽名,請使用支付 API 金鑰。

要求

查詢參數

姓名參數類型預設值定義
url_callback*stringmin:6max:150url-發送付款狀態 webhook 的 URL
currency*string-付款貨幣代碼
network*string-支付網路代碼
uuidstringuuid隨機 uuid 字串商業錢包的uuid
order_idstringmin:1max:32alpha_dash隨機字串發票的訂單ID
status*stringpaid付款狀態可用選項:processcheckpaidpaid_overfailwrong_amountcancelsystem_failrefund_processrefund_failrefund_paid

參數類型

stringmin:6max:150url

定義

發送付款狀態 webhook 的 URL

參數類型

string

定義

付款貨幣代碼

參數類型

string

定義

支付網路代碼

參數類型

stringuuid

預設值

隨機 uuid 字串

定義

商業錢包的uuid

參數類型

stringmin:1max:32alpha_dash

預設值

隨機字串

定義

發票的訂單ID

參數類型

string

預設值

paid

定義

付款狀態可用選項:- process- check- paid- paid_over- fail- wrong_amount- cancel- system_fail- refund_process- refund_fail- refund_paid

* - 必需參數

請求範例


curl https://api.cryptomus.com/v1/test-webhook/wallet \
-X POST -H 'merchant: 860166ce-478c-4087-9813-55cfb6c34580' \
-H 'sign: a466b82fad9415cdbf5f47802b8d376c' \
-H 'Content-Type: application/json' \
-d '{
	"uuid": "e1830f1b-50fc-432e-80ec-15b58ccac867",
	"currency": "ETH",
	"url_callback": "https://your.site/callback",
	"network": "eth",
	"status": "paid"
}'
複製

回覆

回應範例


1{
2  "state": 0,
3  "result": []
4}
複製

可能的錯誤

驗證錯誤

程式碼 : 422

範例回覆:

如果您傳遞 uuidorder_id 且未找到發票/靜態錢包/付款:


1{
2    "state": 1,
3    "message": "Not found payment"
4}
複製


1{
2    "state": 1,
3    "message": "Not found payout"
4}
複製


1{
2    "state": 1,
3    "message": "Not found wallet"
4}
複製

如果沒有傳遞所需的參數:


1{
2	"state": 1,
3	"errors": {
4		"currency": ["validation.required"]
5	}
6}
複製

如果提供的貨幣和網路不是加密或不受支援:


1{
2    "state": 1,
3    "message": "Payment service not found"
4}
複製


1{
2    "state": 1,
3    "message": "Payout service not found"
4}
複製