Refund

post
https://api.cryptomus.com/v1/payment/refund
COPY

Request

Query parameters

NameParameter typeDefinition
address*stringThe address to which the refund should be made
is_subtract*booleanWhether to take a commission from the merchant's balance or from the refund amounttrue - take the commission from merchant balancefalse - reduce the refundable amount by the commission amount
uuid*uuidrequired_without: order_idInvoice uuid
order_id*stringmin:1max:128alpha_dashrequired_without: uuidInvoice order ID

Parameter type

string

Definition

The address to which the refund should be made

Parameter type

boolean

Definition

Whether to take a commission from the merchant's balance or from the refund amounttrue - take the commission from merchant balancefalse - reduce the refundable amount by the commission amount

Parameter type

uuidrequired_without: order_id

Definition

Invoice uuid

Parameter type

stringmin:1max:128alpha_dashrequired_without: uuid

Definition

Invoice order ID

* - mandatory parameter

Invoice is identified by order_id or uuid, if you pass both, the account will be identified by uuid

Request example


curl https://api.cryptomus.com/v1/payment/refund \
-X POST \
-H 'merchant: 8b03432e-385b-4670-8d06-064591096795' \
-H 'sign: fe99035f86fa436181717b302b95bacff1' \
-H 'Content-Type: application/json' \
-d '{
"uuid": "8b03432e-385b-4670-8d06-064591096795",
"address": "TDD97yguPESTpcrJMqU6h2ozZbibv4Vaqm", 
"is_subtract": "true",
}'
COPY

Response

Response example


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

Possible errors

Validation errors

code : 422

example responses:

If the invoice with the uuid or order_id you provided doesn’t exist:


1{
2    "state": 1,
3    "message": "Payment was not found"
4} 
COPY

If you will not pass a uuid and order_id, you will receive this message. It means that at least one of the parameters is required.


1{
2	"state": 1,
3	"errors": {
4		"uuid": ["validation.required_without"],
5		"order_id": ["validation.required_without"]
6	}
7}
COPY

If payouts are blocked on your merchant, you will receive this error message. This happens, for example, when you change your password and payouts are blocked for 24 hours.


1{
2    "state": 1,
3    "message": "You are forbidden"
4}
5
COPY

If merchant wallet that is connected to an invoice does not exist:


1{
2    "state": 1,
3    "message": "Undefined merchant wallet"
4}
COPY

If the invoice is not finalized or not paid.


1{
2    "state": 1,
3    "message": "Refunds are made only for completed payments"
4}
COPY

If the amount to be refunded exceeds the amount of the invoice payment:


1{
2    "state": 1,
3    "message": "The refund amount should not be more than the amount paid"
4}
COPY

If technical work occurs and the payment is temporarily unavailable, you can receive this error message:


1{
2    "state": 1,
3    "message": "Server error"
4}
COPY