Skip to main content
PUT
/
payments
/
refunds
/
{refund_id}
/
cancel
import cobo_waas2
from cobo_waas2.models.refund import Refund
from cobo_waas2.rest import ApiException
from pprint import pprint

# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
    # Replace `<YOUR_PRIVATE_KEY>` with your private key
    api_private_key="<YOUR_PRIVATE_KEY>",
    # Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
    host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = cobo_waas2.PaymentApi(api_client)
    refund_id = "R20250304-M1001-1001"

    try:
        # Cancel refund order
        api_response = api_instance.cancel_refund_by_id(refund_id)
        print("The response of PaymentApi->cancel_refund_by_id:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling PaymentApi->cancel_refund_by_id: %s\n" % e)

{
  "request_id": "123e4567-e89b-12d3-a456-426614174004",
  "refund_id": "R20250304-M1001-1001",
  "order_id": "O20250304-M1001-1001",
  "merchant_id": "M1001",
  "token_id": "ETH_USDT",
  "chain_id": "ETH",
  "amount": "0.0025",
  "to_address": "0x9876543210abcdef1234567890abcdef12345678",
  "status": "Pending",
  "refund_type": "Merchant",
  "created_timestamp": 1744689600,
  "updated_timestamp": 1744689600,
  "initiator": "b2ae1b5aaade686c968ef2bbd31cc75ba94e5a85fd9cb0b85b81dcc15f920e9d",
  "transactions": [
    {
      "tx_id": "tx_123e4567-e89b-12d3-a456-426614174003",
      "tx_hash": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
      "token_id": "ETH_USDT",
      "from_address": "0xF8e4bfc10A2821DF52D3322cB5170E5E9276b537",
      "to_address": "0x15B95A2D8af95D9F48148667B6b8B3CdF89e4F15",
      "amount": "0.15",
      "status": "Submitted",
      "created_timestamp": 1610445878970,
      "updated_timestamp": 1610445878970
    }
  ],
  "charge_merchant_fee": false,
  "merchant_fee_amount": "0.0001",
  "merchant_fee_token_id": "ETH_USDT",
  "commission_fee": {
    "fee_amount": "<string>"
  }
}
import cobo_waas2
from cobo_waas2.models.refund import Refund
from cobo_waas2.rest import ApiException
from pprint import pprint

# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
    # Replace `<YOUR_PRIVATE_KEY>` with your private key
    api_private_key="<YOUR_PRIVATE_KEY>",
    # Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
    host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = cobo_waas2.PaymentApi(api_client)
    refund_id = "R20250304-M1001-1001"

    try:
        # Cancel refund order
        api_response = api_instance.cancel_refund_by_id(refund_id)
        print("The response of PaymentApi->cancel_refund_by_id:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling PaymentApi->cancel_refund_by_id: %s\n" % e)

Authorizations

BIZ-API-KEY
string
header
required

The API key. For more details, refer to API key.

In the API playground, enter your API secret, and your API key will be accordingly calculated.

Path Parameters

refund_id
string
required

The refund order ID.

Response

The request was successful.

refund_id
string
required

The refund order ID.

Example:

"R20250304-M1001-1001"

token_id
string
required

The ID of the cryptocurrency used for refund.

Example:

"ETH_USDT"

chain_id
string
required

The ID of the blockchain network on which the refund transaction occurs.

Example:

"ETH"

amount
string
required

The amount in cryptocurrency to be returned for this refund order.

Example:

"0.0025"

to_address
string
required

The recipient's wallet address where the refund will be sent.

Example:

"0x9876543210abcdef1234567890abcdef12345678"

status
enum<string>
required

The current status of the refund order. For information about transaction status, see Transaction statuses and sub-statuses.

  • Pending: The refund order has been created but the transaction has not been initiated.
  • Processing: The refund order is currently being processed, with at least one refund transaction in progress.
  • Completed: All refund transactions have been completed successfully.
  • PartiallyCompleted: Some refund transactions have been completed successfully, while others have failed.
  • Failed: All refund transactions have failed.
  • PendingConfirmation: The refund order has been created but the address to send (to_address) has not been specified. Once you use the Update refund order operation to specify the address, the status will be updated to Pending.
Available options:
Pending,
Processing,
Completed,
PartiallyCompleted,
Failed,
PendingConfirmation
Example:

"Pending"

request_id
string

The request ID provided by you when creating the refund request.

Example:

"123e4567-e89b-12d3-a456-426614174004"

order_id
string

The ID of the pay-in order corresponding to this refund.

Example:

"O20250304-M1001-1001"

merchant_id
string

The merchant ID.

Example:

"M1001"

refund_type
enum<string>

Specifies the source of funds for the refund:

  • Merchant: The refund amount will be deducted from the merchant balance.
  • Psp: The refund amount will be deducted from the developer balance.
Available options:
Merchant,
Psp
Example:

"Merchant"

created_timestamp
integer

The creation time of the refund order, represented as a UNIX timestamp in seconds.

Example:

1744689600

updated_timestamp
integer

The last update time of the refund order, represented as a UNIX timestamp in seconds.

Example:

1744689600

initiator
string

The initiator of this settlement request. Can return either an API key or the Payments App's ID.

  • Format api_key_<API_KEY>: Indicates the settlement request was initiated via the Payments API using the API key.
  • Format app_<APP_ID>: Indicates the settlement request was initiated through the Payments App using the App ID.
Example:

"b2ae1b5aaade686c968ef2bbd31cc75ba94e5a85fd9cb0b85b81dcc15f920e9d"

transactions
object[]

An array of transactions associated with this refund order. Each transaction represents a separate blockchain operation related to the refund process.

charge_merchant_fee
boolean

Whether to charge developer fee to the merchant for the refund.

  • true: The fee amount (specified in merchant_fee_amount) will be deducted from the merchant's balance and added to the developer's balance

  • false: The merchant is not charged any developer fee.

Example:

false

merchant_fee_amount
string

The developer fee amount to charge the merchant, denominated in the cryptocurrency specified by merchant_fee_token_id. This is only applicable if charge_merchant_fee is set to true.

Example:

"0.0001"

merchant_fee_token_id
string

The ID of the cryptocurrency used for the developer fee. This is only applicable if charge_merchant_fee is set to true.

Example:

"ETH_USDT"

commission_fee
object