Method: externaltransactions.createexternaltransaction
Stay organized with collections
Save and categorize content based on your preferences.
Creates a new external transaction.
HTTP request
POST https://androidpublisher.googleapis.com/androidpublisher/v3/{parent=applications/*}/externalTransactions
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters |
parent |
string
Required. The parent resource where this external transaction will be created. Format: applications/{packageName}
|
Query parameters
Parameters |
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.
|
Request body
The request body contains an instance of ExternalTransaction
.
Response body
If successful, the response body contains a newly created instance of ExternalTransaction
.
Sample
The following is a sample request:
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" \
} \
}'
The following is a sample response:
{
"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"
}
}
Authorization scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/androidpublisher
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-27 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-27 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`"]]