Method: externaltransactions.refundexternaltransaction
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
ביצוע החזר כספי או החזר כספי חלקי על עסקה חיצונית קיימת.
בקשת HTTP
POST https://androidpublisher.googleapis.com/androidpublisher/v3/{name=applications/*/externalTransactions/*}:refund
כתובת ה-URL משתמשת בתחביר של Transcoding של gRPC.
פרמטרים של נתיב
פרמטרים |
name |
string
חובה. שם העסקה החיצונית שתבוצע עבורה החזר כספי. פורמט: applications/{packageName}/externalTransactions/{externalTransaction}
|
גוף הבקשה
גוף הבקשה מכיל נתונים במבנה הבא:
ייצוג ב-JSON |
{
"refundTime": string,
// Union field refund_type can be only one of the following:
"partialRefund": {
object (PartialRefund )
},
"fullRefund": {
object (FullRefund )
}
// End of list of possible types for union field refund_type .
} |
שדות |
refundTime |
string (Timestamp format)
חובה. המועד שבו בוצע ההחזר הכספי על העסקה. הפורמט הזה משתמש ב-RFC 3339, שבו הפלט שנוצר תמיד יהיה מנורמלי לפי Z וישמש בספרות עשרוניות של 0, 3, 6 או 9. אפשר להשתמש גם בשינויים (offsets) אחרים מלבד 'Z'. דוגמאות: "2014-10-02T15:01:23Z" , "2014-10-02T15:01:23.045123456Z" או "2014-10-02T15:01:23+05:30" .
|
שדה האיחוד refund_type . חובה. סוג ההחזר הכספי על עסקה חיצונית. הערך של refund_type יכול להיות רק אחת מהאפשרויות הבאות: |
partialRefund |
object (PartialRefund )
החזר כספי חלקי.
|
fullRefund |
object (FullRefund )
החזר כספי מלא.
|
גוף התשובה
אם הפעולה מצליחה, גוף התגובה מכיל מופע של ExternalTransaction
.
דוגמה
דוגמה לבקשה:
curl \
-X POST \
'https://androidpublisher.googleapis.com/androidpublisher/v3/applications/com.example.app/externalTransactions/foo:refund' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
-H 'Content-Type: application/json' \
-d '{ \
"partialRefund": { \
"refundId": "my_refund_id", \
"refundPreTaxAmount": { \
"currency": "USD", \
"priceMicros": "10120000" \
} \
}, \
"refundTime": "2023-10-20T16:43:32.852Z" \
}'
זוהי דוגמה לתגובה:
{
"externalTransactionId": "1234567890123456789012345678901234567890123456789012345678901234",
"originalPreTaxAmount": {
"currency": "USD",
"priceMicros": "1990000"
},
"originalTaxAmount": {
"currency": "USD",
"priceMicros": "11400000"
},
"packageName": "com.example.app",
"transactionState": "TRANSACTION_CANCELED",
"transactionTime": "2023-04-01T12:00:00Z",
"userTaxAddress": {
"regionCode": "US"
},
"createTime": "2023-04-01T11:55:00Z",
"currentPreTaxAmount": {
"currency": "USD",
"priceMicros": "0"
},
"currentTaxAmount": {
"currency": "USD",
"priceMicros": "0"
},
"testPurchase": {},
"recurringTransaction": {
"initialExternalTransactionId": "9876543210987654321098765432109876543210987654321098765432109876",
"externalSubscription": {
"subscriptionType": "RECURRING"
}
}
}
היקפי הרשאה
נדרש היקף הרשאות OAuth הבא:
https://www.googleapis.com/auth/androidpublisher
PartialRefund
ייצוג ב-JSON |
{
"refundId": string,
"refundPreTaxAmount": {
object (Price )
}
} |
שדות |
refundId |
string
חובה. מזהה ייחודי שמבדיל את ההחזר הכספי החלקי הזה. אם ההחזר הכספי בוצע בהצלחה, המערכת לא תוכל לבצע החזרים כספיים נוספים עם אותו מזהה. המזהה צריך להיות ייחודי לכל החזר כספי של עסקה אחת.
|
refundPreTaxAmount |
object (Price )
חובה. הסכום של ההחזר הכספי החלקי לפני מס. הסכום צריך להיות נמוך מסכום העסקה שנותר לפני מס.
|
FullRefund
אין שדות לסוג הזה.
החזר כספי מלא על הסכום שנותר בעסקה.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-26 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-26 (שעון UTC)."],[[["\u003cp\u003eRefunds or partially refunds an existing external transaction using an HTTP POST request.\u003c/p\u003e\n"],["\u003cp\u003eRequires providing the external transaction name as a path parameter and refund details in the request body.\u003c/p\u003e\n"],["\u003cp\u003eThe request body specifies the refund time and either a partial or full refund type.\u003c/p\u003e\n"],["\u003cp\u003eSuccessful requests will receive a response containing the updated external transaction details.\u003c/p\u003e\n"],["\u003cp\u003eAuthorization requires the \u003ccode\u003ehttps://www.googleapis.com/auth/androidpublisher\u003c/code\u003e OAuth scope.\u003c/p\u003e\n"]]],["This document details how to refund an external transaction via a POST request to the specified URL. The request requires a `name` path parameter, indicating the transaction to be refunded. The request body includes a `refundTime` timestamp and either a `partialRefund` object with a unique `refundId` and `refundPreTaxAmount`, or a `fullRefund` object. Successful requests return an `ExternalTransaction` instance and needs the `androidpublisher` OAuth scope.\n"],null,["# Method: externaltransactions.refundexternaltransaction\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [PartialRefund](#PartialRefund)\n - [JSON representation](#PartialRefund.SCHEMA_REPRESENTATION)\n- [FullRefund](#FullRefund)\n- [Try it!](#try-it)\n\nRefunds or partially refunds an existing external transaction.\n\n### HTTP request\n\n`POST https://androidpublisher.googleapis.com/androidpublisher/v3/{name=applications/*/externalTransactions/*}:refund`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | `string` Required. The name of the external transaction that will be refunded. Format: applications/{packageName}/externalTransactions/{externalTransaction} |\n\n### Request body\n\nThe request body contains data with the following structure:\n\n| JSON representation |\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"refundTime\": string, // Union field `refund_type` can be only one of the following: \"partialRefund\": { object (/android-publisher/api-ref/rest/v3/externaltransactions/refundexternaltransaction#PartialRefund) }, \"fullRefund\": { object (/android-publisher/api-ref/rest/v3/externaltransactions/refundexternaltransaction#FullRefund) } // End of list of possible types for union field `refund_type`. } ``` |\n\n| Fields ||\n|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `refundTime` | `string (`[Timestamp](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp)` format)` Required. The time that the transaction was refunded. Uses RFC 3339, where generated output will always be Z-normalized and uses 0, 3, 6 or 9 fractional digits. Offsets other than \"Z\" are also accepted. Examples: `\"2014-10-02T15:01:23Z\"`, `\"2014-10-02T15:01:23.045123456Z\"` or `\"2014-10-02T15:01:23+05:30\"`. |\n| Union field `refund_type`. Required. Type of external transaction refund. `refund_type` can be only one of the following: ||\n| `partialRefund` | `object (`[PartialRefund](/android-publisher/api-ref/rest/v3/externaltransactions/refundexternaltransaction#PartialRefund)`)` A partial refund. |\n| `fullRefund` | `object (`[FullRefund](/android-publisher/api-ref/rest/v3/externaltransactions/refundexternaltransaction#FullRefund)`)` A full-amount refund. |\n\n### Response body\n\nIf successful, the response body contains an instance of [ExternalTransaction](/android-publisher/api-ref/rest/v3/externaltransactions#ExternalTransaction).\n\n### Sample\n\nThe following is a sample request: \n\n```json\ncurl \\\n -X POST \\\n 'https://androidpublisher.googleapis.com/androidpublisher/v3/applications/com.example.app/externalTransactions/foo:refund' \\\n -H 'Accept: application/json' \\\n -H 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \\\n -H 'Content-Type: application/json' \\\n -d '{ \\\n \"partialRefund\": { \\\n \"refundId\": \"my_refund_id\", \\\n \"refundPreTaxAmount\": { \\\n \"currency\": \"USD\", \\\n \"priceMicros\": \"10120000\" \\\n } \\\n }, \\\n \"refundTime\": \"2023-10-20T16:43:32.852Z\" \\\n }'\n```\n\nThe following is a sample response: \n\n```json\n{\n \"externalTransactionId\": \"1234567890123456789012345678901234567890123456789012345678901234\",\n \"originalPreTaxAmount\": {\n \"currency\": \"USD\",\n \"priceMicros\": \"1990000\"\n },\n \"originalTaxAmount\": {\n \"currency\": \"USD\",\n \"priceMicros\": \"11400000\"\n },\n \"packageName\": \"com.example.app\",\n \"transactionState\": \"TRANSACTION_CANCELED\",\n \"transactionTime\": \"2023-04-01T12:00:00Z\",\n \"userTaxAddress\": {\n \"regionCode\": \"US\"\n },\n \"createTime\": \"2023-04-01T11:55:00Z\",\n \"currentPreTaxAmount\": {\n \"currency\": \"USD\",\n \"priceMicros\": \"0\"\n },\n \"currentTaxAmount\": {\n \"currency\": \"USD\",\n \"priceMicros\": \"0\"\n },\n \"testPurchase\": {},\n \"recurringTransaction\": {\n \"initialExternalTransactionId\": \"9876543210987654321098765432109876543210987654321098765432109876\",\n \"externalSubscription\": {\n \"subscriptionType\": \"RECURRING\"\n }\n }\n}\n```\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/androidpublisher`\n\nPartialRefund\n-------------\n\nA partial refund of a transaction.\n\n| JSON representation |\n|-------------------------------------------------------------------------------------------------------------|\n| ``` { \"refundId\": string, \"refundPreTaxAmount\": { object (/android-publisher/api-ref/rest/v3/Price) } } ``` |\n\n| Fields ||\n|----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `refundId` | `string` Required. A unique id distinguishing this partial refund. If the refund is successful, subsequent refunds with the same id will fail. Must be unique across refunds for one individual transaction. |\n| `refundPreTaxAmount` | `object (`[Price](/android-publisher/api-ref/rest/v3/Price)`)` Required. The pre-tax amount of the partial refund. Should be less than the remaining pre-tax amount of the transaction. |\n\nFullRefund\n----------\n\nThis type has no fields.\nA full refund of the remaining amount of a transaction."]]