Method: purchases.subscriptionsv2.revoke
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
subscriptionsv2.revoke mencabut pembelian langganan untuk pengguna.
Permintaan HTTP
POST https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/purchases/subscriptionsv2/tokens/{token}:revoke
URL menggunakan sintaksis gRPC Transcoding.
Parameter jalur
Parameter |
packageName |
string
Wajib. Paket aplikasi yang langganannya ini dibeli (misalnya, 'com.some.thing').
|
token |
string
Wajib. Token yang diberikan ke perangkat pengguna saat langganan dibeli.
|
Isi permintaan
Isi permintaan memuat data dengan struktur berikut:
Kolom |
revocationContext |
object (RevocationContext )
Wajib. Detail tambahan seputar pencabutan langganan.
|
Isi respons
Jika berhasil, isi respons akan kosong.
Contoh
Berikut adalah contoh permintaan:
curl -X POST \
'https://androidpublisher.googleapis.com/androidpublisher/v3/applications/com.example.myapp/purchases/subscriptionsv2/tokens/sample_purchase_token:revoke' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"revocationContext": {
"proratedRefund": {}
}
}'
Cakupan otorisasi
Memerlukan cakupan OAuth berikut:
https://www.googleapis.com/auth/androidpublisher
RevocationContext
Konteks pencabutan API purchases.subscriptionsv2.revoke.
Representasi JSON |
{
// Union field RefundType can be only one of the following:
"fullRefund": {
object (FullRefund )
},
"proratedRefund": {
object (ProratedRefund )
},
"itemBasedRefund": {
object (ItemBasedRefund )
}
// End of list of possible types for union field RefundType .
} |
Kolom |
Kolom union RefundType . Menentukan jenis pengembalian dana yang harus diberikan. Jenis pengembalian dana harus ditentukan sebagai bagian dari permintaan yang valid. RefundType hanya dapat berupa salah satu dari berikut: |
fullRefund |
object (FullRefund )
Opsional. Digunakan saat pengguna harus mendapatkan pengembalian dana dengan jumlah penuh tagihan terbaru untuk setiap item dalam langganan.
|
proratedRefund |
object (ProratedRefund )
Opsional. Digunakan saat pengguna harus mendapatkan pengembalian dana dengan jumlah prorata yang mereka bayarkan untuk langganan berdasarkan jumlah waktu yang tersisa dalam langganan.
|
itemBasedRefund |
object (ItemBasedRefund )
Opsional. Digunakan saat item tertentu harus dikembalikan dananya dalam langganan dengan item add-on.
|
FullRefund
Jenis ini tidak memiliki kolom.
Digunakan untuk menentukan apakah jenis pengembalian dana dalam RevocationContext merupakan pengembalian dana penuh.
ProratedRefund
Jenis ini tidak memiliki kolom.
Digunakan untuk menentukan apakah jenis pengembalian dana dalam RevocationContext merupakan pengembalian dana prorata.
ItemBasedRefund
Digunakan untuk menentukan item tertentu yang akan dicabut dalam langganan dengan beberapa item.
Representasi JSON |
{
"productId": string
} |
Kolom |
productId |
string
Wajib. Jika langganan adalah langganan dengan add-on, ID produk item langganan yang akan dicabut.
|
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-26 UTC.
[null,null,["Terakhir diperbarui pada 2025-07-26 UTC."],[[["\u003cp\u003eRevoke a user's subscription purchase using the \u003ccode\u003esubscriptionsv2.revoke\u003c/code\u003e API.\u003c/p\u003e\n"],["\u003cp\u003eThe API requires the package name and purchase token in the request path.\u003c/p\u003e\n"],["\u003cp\u003eYou can optionally specify a full or prorated refund in the request body.\u003c/p\u003e\n"],["\u003cp\u003eSuccessful revocation results in an empty response body.\u003c/p\u003e\n"],["\u003cp\u003eRequires the \u003ccode\u003ehttps://www.googleapis.com/auth/androidpublisher\u003c/code\u003e OAuth scope for authorization.\u003c/p\u003e\n"]]],["This document outlines the process for revoking a user's subscription purchase via the `subscriptionsv2.revoke` API. The `POST` request, sent to `https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/purchases/subscriptionsv2/tokens/{token}:revoke`, requires the application's package name and the user's subscription token. The request body must include a `revocationContext`, specifying either a `fullRefund` or `proratedRefund`. Successful requests yield an empty response. This API action also needs the `androidpublisher` authorization scope.\n"],null,["- [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- [RevocationContext](#RevocationContext)\n - [JSON representation](#RevocationContext.SCHEMA_REPRESENTATION)\n- [FullRefund](#FullRefund)\n- [ProratedRefund](#ProratedRefund)\n- [ItemBasedRefund](#ItemBasedRefund)\n - [JSON representation](#ItemBasedRefund.SCHEMA_REPRESENTATION)\n- [Try it!](#try-it)\n\nsubscriptionsv2.revoke a subscription purchase for the user.\n\nHTTP request\n\n`POST https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/purchases/subscriptionsv2/tokens/{token}:revoke`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\nPath parameters\n\n| Parameters ||\n|---------------|------------------------------------------------------------------------------------------------------------------------------|\n| `packageName` | `string` Required. The package of the application for which this subscription was purchased (for example, 'com.some.thing'). |\n| `token` | `string` Required. The token provided to the user's device when the subscription was purchased. |\n\nRequest body\n\nThe request body contains data with the following structure:\n\n| JSON representation |\n|-------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"revocationContext\": { object (/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#RevocationContext) } } ``` |\n\n| Fields ||\n|---------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `revocationContext` | `object (`[RevocationContext](/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#RevocationContext)`)` Required. Additional details around the subscription revocation. |\n\nResponse body\n\nIf successful, the response body is empty.\n\nSample\n\nThe following is a sample request: \n\n```json\ncurl -X POST \\\n 'https://androidpublisher.googleapis.com/androidpublisher/v3/applications/com.example.myapp/purchases/subscriptionsv2/tokens/sample_purchase_token:revoke' \\\n -H 'Accept: application/json' \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"revocationContext\": {\n \"proratedRefund\": {}\n }\n }'\n```\n\nAuthorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/androidpublisher`\n\nRevocationContext Revocation context of the purchases.subscriptionsv2.revoke API.\n\n| JSON representation |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { // Union field `RefundType` can be only one of the following: \"fullRefund\": { object (/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#FullRefund) }, \"proratedRefund\": { object (/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#ProratedRefund) }, \"itemBasedRefund\": { object (/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#ItemBasedRefund) } // End of list of possible types for union field `RefundType`. } ``` |\n\n| Fields ||\n|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Union field `RefundType`. Determines the type of refund that should be granted. A refund type must be specified as part of a valid request. `RefundType` can be only one of the following: ||\n| `fullRefund` | `object (`[FullRefund](/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#FullRefund)`)` Optional. Used when users should be refunded the full amount of latest charge on each item in the subscription. |\n| `proratedRefund` | `object (`[ProratedRefund](/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#ProratedRefund)`)` Optional. Used when users should be refunded a prorated amount they paid for their subscription based on the amount of time remaining in a subscription. |\n| `itemBasedRefund` | `object (`[ItemBasedRefund](/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/revoke#ItemBasedRefund)`)` Optional. Used when a specific item should be refunded in a subscription with add-on items. |\n\nFullRefund\n\nThis type has no fields.\nUsed to determine if the refund type in the RevocationContext is a full refund.\n\nProratedRefund\n\nThis type has no fields.\nUsed to determine if the refund type in the RevocationContext is a prorated refund.\n\nItemBasedRefund Used to determine what specific item to revoke in a subscription with multiple items.\n\n| JSON representation |\n|---------------------------------|\n| ``` { \"productId\": string } ``` |\n\n| Fields ||\n|-------------|---------------------------------------------------------------------------------------------------------------------------|\n| `productId` | `string` Required. If the subscription is a subscription with add-ons, the product id of the subscription item to revoke. |"]]