Method: externaltransactions.createexternaltransaction
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
एक नया बाहरी लेन-देन बनाता है.
एचटीटीपी अनुरोध
POST https://androidpublisher.googleapis.com/androidpublisher/v3/{parent=applications/*}/externalTransactions
यूआरएल में gRPC ट्रांसकोडिंग सिंटैक्स का इस्तेमाल किया गया है.
पाथ पैरामीटर
पैरामीटर |
parent |
string
ज़रूरी है. वह पैरंट रिसॉर्स जहां यह बाहरी लेन-देन बनाया जाएगा. फ़ॉर्मैट: applications/{packageName}
|
क्वेरी पैरामीटर
पैरामीटर |
externalTransactionId |
string
ज़रूरी है. बाहरी लेन-देन के लिए इस्तेमाल किया जाने वाला आईडी. यह वैल्यू, ऐप्लिकेशन के सभी अन्य लेन-देन के लिए यूनीक होनी चाहिए. इस वैल्यू में 1 से 63 वर्ण होने चाहिए. साथ ही, इसमें /a-zA-Z0-9_-/ वर्ण इस्तेमाल किए जा सकते हैं. इस फ़ील्ड का इस्तेमाल, व्यक्तिगत पहचान से जुड़ी जानकारी (पीआईआई) को सेव करने के लिए न करें. जैसे, ईमेल. इस फ़ील्ड में व्यक्तिगत पहचान से जुड़ी जानकारी सेव करने की कोशिश करने पर, अनुरोधों को ब्लॉक किया जा सकता है.
|
अनुरोध का मुख्य भाग
अनुरोध के मुख्य भाग में ExternalTransaction
का उदाहरण है.
जवाब का मुख्य भाग
कामयाब रहने पर, जवाब के मुख्य हिस्से में ExternalTransaction
का नया इंस्टेंस शामिल किया जाता है.
नमूना
अनुरोध का सैंपल यहां दिया गया है:
curl \
-X POST \
'https://androidpublisher.googleapis.com/androidpublisher/v3/applications/com.example.app/externalTransactions?externalTransactionId=exampleExternalTransactionId' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
-H 'Content-Type: application/json' \
-d '{ \
"originalPreTaxAmount": { \
"currency": "USD", \
"priceMicros": "1000000" \
}, \
"originalTaxAmount": { \
"currency": "USD", \
"priceMicros": "100000" \
}, \
"transactionTime": "2023-05-05T12:00:00Z", \
"oneTimeTransaction": { \
"externalTransactionToken": "token-123" \
}, \
"userTaxAddress": { \
"regionCode": "US" \
} \
}'
यहां जवाब का एक सैंपल दिया गया है:
{
"createTime": "2023-04-20T14:23:18.121Z",
"currentPreTaxAmount": {
"currency": "USD",
"priceMicros": "12000000"
},
"currentTaxAmount": {
"currency": "USD",
"priceMicros": "1200000"
},
"externalTransactionId": "ext-trans-id-1234",
"oneTimeTransaction": {
"externalTransactionToken": "one-time-token-abc"
},
"originalPreTaxAmount": {
"currency": "USD",
"priceMicros": "15000000"
},
"originalTaxAmount": {
"currency": "USD",
"priceMicros": "1500000"
},
"packageName": "com.example.app",
"recurringTransaction": {
"externalSubscription": {
"subscriptionType": "RECURRING"
},
"externalTransactionToken": "recurring-token-xyz",
"initialExternalTransactionId": "ext-trans-id-5678",
"otherRecurringProduct": {}
},
"testPurchase": {},
"transactionProgramCode": 11,
"transactionState": "TRANSACTION_REPORTED",
"transactionTime": "2023-04-20T14:20:00.000Z",
"userTaxAddress": {
"regionCode": "US"
}
}
अनुमति के दायरे
नीचे दिए गए OAuth के लिंक की ज़रूरत हाेती है:
https://www.googleapis.com/auth/androidpublisher
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-07-26 (UTC) को अपडेट किया गया.
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2025-07-26 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eCreates a new external transaction using an HTTP POST request to a specified URL.\u003c/p\u003e\n"],["\u003cp\u003eRequires providing path and query parameters, including \u003ccode\u003eparent\u003c/code\u003e to specify the app package and a unique \u003ccode\u003eexternalTransactionId\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe request body needs to contain an \u003ccode\u003eExternalTransaction\u003c/code\u003e object, while a successful response returns a newly created \u003ccode\u003eExternalTransaction\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eAuthorization is needed using the \u003ccode\u003ehttps://www.googleapis.com/auth/androidpublisher\u003c/code\u003e OAuth scope.\u003c/p\u003e\n"]]],["This describes how to create an external transaction using a POST request to the specified URL. The URL includes a required `parent` path parameter representing the application's package name. It also requires an `externalTransactionId` query parameter that must be unique and follow specific character constraints. The request and response bodies utilize the `ExternalTransaction` format. The process is authorized through the `androidpublisher` OAuth scope. It uses gRPC Transcoding syntax.\n"],null,["# Method: externaltransactions.createexternaltransaction\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nCreates a new external transaction.\n\n### HTTP request\n\n`POST https://androidpublisher.googleapis.com/androidpublisher/v3/{parent=applications/*}/externalTransactions`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|----------------------------------------------------------------------------------------------------------------------------|\n| `parent` | `string` Required. The parent resource where this external transaction will be created. Format: applications/{packageName} |\n\n### Query parameters\n\n| Parameters ||\n|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `externalTransactionId` | `string` Required. The id to use for the external transaction. Must be unique across all other transactions for the app. This value should be 1-63 characters and valid characters are /a-zA-Z0-9_-/. Do not use this field to store any Personally Identifiable Information (PII) such as emails. Attempting to store PII in this field may result in requests being blocked. |\n\n### Request body\n\nThe request body contains an instance of [ExternalTransaction](/android-publisher/api-ref/rest/v3/externaltransactions#ExternalTransaction).\n\n### Response body\n\nIf successful, the response body contains a newly created 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?externalTransactionId=exampleExternalTransactionId' \\\n -H 'Accept: application/json' \\\n -H 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \\\n -H 'Content-Type: application/json' \\\n -d '{ \\\n \"originalPreTaxAmount\": { \\\n \"currency\": \"USD\", \\\n \"priceMicros\": \"1000000\" \\\n }, \\\n \"originalTaxAmount\": { \\\n \"currency\": \"USD\", \\\n \"priceMicros\": \"100000\" \\\n }, \\\n \"transactionTime\": \"2023-05-05T12:00:00Z\", \\\n \"oneTimeTransaction\": { \\\n \"externalTransactionToken\": \"token-123\" \\\n }, \\\n \"userTaxAddress\": { \\\n \"regionCode\": \"US\" \\\n } \\\n }'\n```\n\nThe following is a sample response: \n\n```json\n{\n \"createTime\": \"2023-04-20T14:23:18.121Z\",\n \"currentPreTaxAmount\": {\n \"currency\": \"USD\",\n \"priceMicros\": \"12000000\"\n },\n \"currentTaxAmount\": {\n \"currency\": \"USD\",\n \"priceMicros\": \"1200000\"\n },\n \"externalTransactionId\": \"ext-trans-id-1234\",\n \"oneTimeTransaction\": {\n \"externalTransactionToken\": \"one-time-token-abc\"\n },\n \"originalPreTaxAmount\": {\n \"currency\": \"USD\",\n \"priceMicros\": \"15000000\"\n },\n \"originalTaxAmount\": {\n \"currency\": \"USD\",\n \"priceMicros\": \"1500000\"\n },\n \"packageName\": \"com.example.app\",\n \"recurringTransaction\": {\n \"externalSubscription\": {\n \"subscriptionType\": \"RECURRING\"\n },\n \"externalTransactionToken\": \"recurring-token-xyz\",\n \"initialExternalTransactionId\": \"ext-trans-id-5678\",\n \"otherRecurringProduct\": {}\n },\n \"testPurchase\": {},\n \"transactionProgramCode\": 11,\n \"transactionState\": \"TRANSACTION_REPORTED\",\n \"transactionTime\": \"2023-04-20T14:20:00.000Z\",\n \"userTaxAddress\": {\n \"regionCode\": \"US\"\n }\n}\n```\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/androidpublisher`"]]