Validate purchase in Paddle, provide access level, and import transaction history from Paddle with server-side API
Validates a purchase using the provided Paddle token using the credentials of Paddle in your App Settings inside Adapty Dashboard. If the purchase is valid, the transaction history is imported from Paddle to the profile in Adapty with the specified customer_user_id
. If there was no profile with this customer_user_id
before — it will be created.
Request header
warning
This request requires a different set of headers than usual. Only the Content-Type header can be used.
Note that customer_user_id
should be included in the request body, not in a header, and profile_id
should not be provided at all.
Header | Description |
---|---|
Content-Type | Set to application/json for the API to process the request. |
Method and endpoint
POST https://api.adapty.io/api/v2/server-side-api/purchase/paddle/token/validate/
Example request
- cURL
- Python
- JavaScript
curl --location 'https://api.adapty.io/api/v2/server-side-api/purchase/paddle/token/validate/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Api-Key <YOUR_SECRET_API_KEY>' \
--data '{
"customer_user_id": "<YOUR_CUSTOMER_USER_ID>",
"paddle_token": "live_7d279f61a3339fed520f7cd8c08"
}'
import requests
import json
url = "https://api.adapty.io/api/v2/server-side-api/purchase/paddle/token/validate/"
payload = json.dumps({
"customer_user_id": "<YOUR_CUSTOMER_USER_ID>",
"paddle_token": "live_7d279f61a3339fed520f7cd8c08"
})
headers =
"Content-Type": "application/json",
"Authorization": "Api-Key <YOUR_SECRET_API_KEY>"
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Api-Key <YOUR_SECRET_API_KEY>");
const raw = JSON.stringify({
"customer_user_id": "<YOUR_CUSTOMER_USER_ID>",
"paddle_token": "live_7d279f61a3339fed520f7cd8c08"
});
const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("https://api.adapty.io/api/v2/server-side-api/purchase/paddle/token/validate/", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
Placeholders:
<YOUR_SECRET_API_KEY>
: Your secret API key for authorization.<YOUR_CUSTOMER_USER_ID>
: The unique ID of the customer in your system.
Parameters
:::
Parameters | Type | Required | Nullable | Description |
---|---|---|---|---|
customer_user_id | String | ➕ | ➖ | The ID of your user in your system. You can see it in the Customer user ID field on the Adapty Dashboard -> Profiles -> specific profile page. For it to work, you must identify the users in your mobile app code via Adapty SDK. |
paddle_token | String |