支付
支付退款
为现有支付交易发起部分或全额退款。
POST
/
payments
/
{id}
/
transactions
/
{transaction_id}
/
refund
curl --request POST \
--url https://api-sandbox.y.uno/v1/payments/{id}/transactions/{transaction_id}/refund \
--header 'Content-Type: application/json' \
--header 'X-Idempotency-Key: <api-key>' \
--header 'private-secret-key: <api-key>' \
--header 'public-api-key: <api-key>' \
--data '
{
"description": "Duplicate",
"reason": "REQUESTED_BY_CUSTOMER",
"merchant_reference": "AAB01-432245"
}
'
{
"id": "f2d6884a-f737-4565-ae32-ff60b19089e3",
"account_id": "",
"description": "Duplicate",
"country": "US",
"status": "REFUNDED",
"sub_status": "REFUNDED",
"merchant_order_id": "AAB01-432245",
"created_at": "2025-04-14T17:51:45.179645Z",
"updated_at": "2025-04-14T17:52:07.908698Z",
"amount": {
"captured": 0,
"currency": "USD",
"currency_conversion": null,
"refunded": 30000,
"value": 30000
},
"checkout": {
"session": "",
"sdk_action_required": false
},
"payment_method": {
"vaulted_token": "",
"type": "CARD",
"vault_on_success": false,
"token": "",
"parent_payment_method_type": null,
"payment_method_detail": {
"card": {
"verify": false,
"capture": false,
"installments": 1,
"installments_plan_id": null,
"first_installment_deferral": 0,
"installments_type": "MERCHANT",
"installment_amount": null,
"soft_descriptor": "",
"authorization_code": "216303",
"retrieval_reference_number": "",
"acquirer_reference_number": "",
"voucher": null,
"card_data": {
"holder_name": "John Doe",
"iin": "41111111",
"lfd": "1111",
"number_length": 16,
"security_code_length": 3,
"brand": "VISA",
"issuer_name": "CHASE BANK USA",
"issuer_code": null,
"country_code": "US",
"category": "CLASSIC",
"type": "DEBIT",
"three_d_secure": {
"version": null,
"electronic_commerce_indicator": null,
"cryptogram": null,
"transaction_id": null,
"directory_server_transaction_id": null,
"pares_status": null,
"acs_id": null
},
"fingerprint": "d244e20d-43a1-43f7-9b48-0a76423be35e",
"expiration_month": 3,
"expiration_year": 26
},
"stored_credentials": {
"reason": null,
"usage": null,
"subscription_agreement_id": null,
"network_transaction_id": null
}
}
}
},
"customer_payer": {
"id": null,
"merchant_customer_id": "1744653105",
"first_name": "John",
"last_name": "Doe",
"gender": "M",
"date_of_birth": "1990-02-28",
"email": "john.doe@example.com",
"nationality": "US",
"ip_address": "192.168.1.1",
"device_fingerprint": null,
"device_fingerprints": [],
"browser_info": null,
"document": {
"document_type": "SSN",
"document_number": "123-45-6789"
},
"phone": {
"number": "5551234567",
"country_code": "1"
},
"billing_address": {
"address_line_1": "1234 Elm Street",
"address_line_2": "Apt 5B",
"country": "US",
"state": "California",
"city": "Los Angeles",
"zip_code": "90001",
"neighborhood": null
},
"shipping_address": {
"address_line_1": "1234 Elm Street",
"address_line_2": "Apt 5B",
"country": "US",
"state": "California",
"city": "Los Angeles",
"zip_code": "90001",
"neighborhood": null
},
"merchant_customer_created_at": null
},
"additional_data": null,
"transactions": {
"id": "5414f862-51e6-433f-a54c-b46b176e87a0",
"type": "REFUND",
"status": "SUCCEEDED",
"category": "CARD",
"amount": 30000,
"provider_id": "YUNO_TEST_PAYMENT_GW",
"payment_method": {
"vaulted_token": "",
"type": "CARD",
"vault_on_success": false,
"token": "",
"parent_payment_method_type": null,
"detail": {
"card": {
"verify": false,
"capture": false,
"installments": 1,
"installments_plan_id": null,
"first_installment_deferral": 0,
"installments_type": "MERCHANT",
"installment_amount": null,
"soft_descriptor": "",
"authorization_code": "216303",
"retrieval_reference_number": "",
"acquirer_reference_number": "",
"voucher": null,
"card_data": {
"holder_name": "John Doe",
"iin": "41111111",
"lfd": "1111",
"number_length": 16,
"security_code_length": 3,
"brand": "VISA",
"issuer_name": "CHASE BANK USA",
"issuer_code": null,
"country_code": "US",
"category": "CLASSIC",
"type": "DEBIT",
"three_d_secure": {
"version": null,
"electronic_commerce_indicator": null,
"cryptogram": null,
"transaction_id": null,
"directory_server_transaction_id": null,
"pares_status": null,
"acs_id": null
},
"fingerprint": "d244e20d-43a1-43f7-9b48-0a76423be35e",
"expiration_month": 3,
"expiration_year": 26
},
"stored_credentials": {
"reason": null,
"usage": null,
"subscription_agreement_id": null,
"network_transaction_id": null
}
}
}
},
"response_code": "SUCCEEDED",
"response_message": "Transaction successful",
"reason": "REQUESTED_BY_CUSTOMER",
"description": "Test refund",
"merchant_reference": "REFUND_001",
"provider_data": {
"id": "YUNO_TEST_PAYMENT_GW",
"transaction_id": "2e5c04d5-4cf7-4d2a-b57a-dd5eb9a687bc",
"account_id": "",
"status": "",
"sub_status": "",
"status_detail": "",
"response_message": null,
"response_code": "SUCCEEDED",
"raw_request": {
"amount": {
"currency": "BRL",
"value": 2100
},
"reference": "34343434"
},
"raw_response": {
"message": "provider response"
},
"third_party_transaction_id": null,
"third_party_account_id": null,
"iso8583_response_code": null,
"iso8583_response_message": null
},
"connection_data": {
"id": "58cc35f4-faef-4107-8e09-d18d60121d38",
"name": "Connection name"
},
"created_at": "2025-04-14T17:52:07.768528Z",
"updated_at": "2025-04-14T17:52:07.862912Z"
},
"transactions_history": null,
"metadata": [],
"fraud_screening": null,
"payment_link_id": "",
"subscription_code": null,
"routing_rules": null,
"simplified_mode": false
}
请勿在另一笔退款进行中时执行退款。请等待当前操作完成后再开始新的操作。
amount,将创建部分退款。如果省略 amount,将对原始支付进行全额退款。
使用 Yuno 促销的支付退款按客户实际支付的金额计算,即
amount.value 减去 discount_amount。全额退款会退还该金额,超过剩余可退款金额的 amount 会被拒绝,并返回 400 INVALID_PARAMETERS。请参阅促销。部分批准的支付对于发送时带有
payment_method.detail.card.partial_approval: true 且已批准金额低于请求金额的卡支付,退款以 amount.authorized 为上限。全额退款会退还 amount.authorized,超过其剩余金额的 amount 会被拒绝,并返回 400 INVALID_PARAMETERS。X-Idempotency-Key。如需了解更多信息,请查看身份验证页面。授权
请求体
application/json
决定 Yuno 在首次出现错误或被拒绝后,是否应自动尝试对支付退款。设置为 true 时,如果首次尝试失败,Yuno 将重试该流程。默认为 false。更多详情请访问交易重试。
响应
201
- 全额退款
- 部分退款
应用于支付的 Yuno 促销的总折扣:即 additional_data.order.discounts 中 YUNO_PROMOTION 行的总和。未应用促销时不存在。实际扣款金额为 amount.value 减去此值,见 transactions.amount。请参阅 Promotions。
Show child attributes
Show child attributes
此页面对您有帮助吗?
⌘I
curl --request POST \
--url https://api-sandbox.y.uno/v1/payments/{id}/transactions/{transaction_id}/refund \
--header 'Content-Type: application/json' \
--header 'X-Idempotency-Key: <api-key>' \
--header 'private-secret-key: <api-key>' \
--header 'public-api-key: <api-key>' \
--data '
{
"description": "Duplicate",
"reason": "REQUESTED_BY_CUSTOMER",
"merchant_reference": "AAB01-432245"
}
'
{
"id": "f2d6884a-f737-4565-ae32-ff60b19089e3",
"account_id": "",
"description": "Duplicate",
"country": "US",
"status": "REFUNDED",
"sub_status": "REFUNDED",
"merchant_order_id": "AAB01-432245",
"created_at": "2025-04-14T17:51:45.179645Z",
"updated_at": "2025-04-14T17:52:07.908698Z",
"amount": {
"captured": 0,
"currency": "USD",
"currency_conversion": null,
"refunded": 30000,
"value": 30000
},
"checkout": {
"session": "",
"sdk_action_required": false
},
"payment_method": {
"vaulted_token": "",
"type": "CARD",
"vault_on_success": false,
"token": "",
"parent_payment_method_type": null,
"payment_method_detail": {
"card": {
"verify": false,
"capture": false,
"installments": 1,
"installments_plan_id": null,
"first_installment_deferral": 0,
"installments_type": "MERCHANT",
"installment_amount": null,
"soft_descriptor": "",
"authorization_code": "216303",
"retrieval_reference_number": "",
"acquirer_reference_number": "",
"voucher": null,
"card_data": {
"holder_name": "John Doe",
"iin": "41111111",
"lfd": "1111",
"number_length": 16,
"security_code_length": 3,
"brand": "VISA",
"issuer_name": "CHASE BANK USA",
"issuer_code": null,
"country_code": "US",
"category": "CLASSIC",
"type": "DEBIT",
"three_d_secure": {
"version": null,
"electronic_commerce_indicator": null,
"cryptogram": null,
"transaction_id": null,
"directory_server_transaction_id": null,
"pares_status": null,
"acs_id": null
},
"fingerprint": "d244e20d-43a1-43f7-9b48-0a76423be35e",
"expiration_month": 3,
"expiration_year": 26
},
"stored_credentials": {
"reason": null,
"usage": null,
"subscription_agreement_id": null,
"network_transaction_id": null
}
}
}
},
"customer_payer": {
"id": null,
"merchant_customer_id": "1744653105",
"first_name": "John",
"last_name": "Doe",
"gender": "M",
"date_of_birth": "1990-02-28",
"email": "john.doe@example.com",
"nationality": "US",
"ip_address": "192.168.1.1",
"device_fingerprint": null,
"device_fingerprints": [],
"browser_info": null,
"document": {
"document_type": "SSN",
"document_number": "123-45-6789"
},
"phone": {
"number": "5551234567",
"country_code": "1"
},
"billing_address": {
"address_line_1": "1234 Elm Street",
"address_line_2": "Apt 5B",
"country": "US",
"state": "California",
"city": "Los Angeles",
"zip_code": "90001",
"neighborhood": null
},
"shipping_address": {
"address_line_1": "1234 Elm Street",
"address_line_2": "Apt 5B",
"country": "US",
"state": "California",
"city": "Los Angeles",
"zip_code": "90001",
"neighborhood": null
},
"merchant_customer_created_at": null
},
"additional_data": null,
"transactions": {
"id": "5414f862-51e6-433f-a54c-b46b176e87a0",
"type": "REFUND",
"status": "SUCCEEDED",
"category": "CARD",
"amount": 30000,
"provider_id": "YUNO_TEST_PAYMENT_GW",
"payment_method": {
"vaulted_token": "",
"type": "CARD",
"vault_on_success": false,
"token": "",
"parent_payment_method_type": null,
"detail": {
"card": {
"verify": false,
"capture": false,
"installments": 1,
"installments_plan_id": null,
"first_installment_deferral": 0,
"installments_type": "MERCHANT",
"installment_amount": null,
"soft_descriptor": "",
"authorization_code": "216303",
"retrieval_reference_number": "",
"acquirer_reference_number": "",
"voucher": null,
"card_data": {
"holder_name": "John Doe",
"iin": "41111111",
"lfd": "1111",
"number_length": 16,
"security_code_length": 3,
"brand": "VISA",
"issuer_name": "CHASE BANK USA",
"issuer_code": null,
"country_code": "US",
"category": "CLASSIC",
"type": "DEBIT",
"three_d_secure": {
"version": null,
"electronic_commerce_indicator": null,
"cryptogram": null,
"transaction_id": null,
"directory_server_transaction_id": null,
"pares_status": null,
"acs_id": null
},
"fingerprint": "d244e20d-43a1-43f7-9b48-0a76423be35e",
"expiration_month": 3,
"expiration_year": 26
},
"stored_credentials": {
"reason": null,
"usage": null,
"subscription_agreement_id": null,
"network_transaction_id": null
}
}
}
},
"response_code": "SUCCEEDED",
"response_message": "Transaction successful",
"reason": "REQUESTED_BY_CUSTOMER",
"description": "Test refund",
"merchant_reference": "REFUND_001",
"provider_data": {
"id": "YUNO_TEST_PAYMENT_GW",
"transaction_id": "2e5c04d5-4cf7-4d2a-b57a-dd5eb9a687bc",
"account_id": "",
"status": "",
"sub_status": "",
"status_detail": "",
"response_message": null,
"response_code": "SUCCEEDED",
"raw_request": {
"amount": {
"currency": "BRL",
"value": 2100
},
"reference": "34343434"
},
"raw_response": {
"message": "provider response"
},
"third_party_transaction_id": null,
"third_party_account_id": null,
"iso8583_response_code": null,
"iso8583_response_message": null
},
"connection_data": {
"id": "58cc35f4-faef-4107-8e09-d18d60121d38",
"name": "Connection name"
},
"created_at": "2025-04-14T17:52:07.768528Z",
"updated_at": "2025-04-14T17:52:07.862912Z"
},
"transactions_history": null,
"metadata": [],
"fraud_screening": null,
"payment_link_id": "",
"subscription_code": null,
"routing_rules": null,
"simplified_mode": false
}