Set user consent and refund settings with API

Adapty Refund Saver helps you handle refund requests from Apple’s App Store automatically and more efficiently.

By default, Refund Saver always asks Apple to decline a user’s refund request. You can change this default behavior for all users in the Adapty Dashboard, or adjust it for a specific user using the Dashboard, the Adapty SDK, or the server-side API, as explained below.

To use Refund Saver, you need to get the user’s consent to share their data with Apple. You can record user’s consent through the Adapty SDK or the server-side API, as shown below.

Method and endpoint

POST https://api.adapty.io/api/v2/server-side-api/purchase/profile/refund-saver/settings/

Example request

Placeholders:

  • <YOUR_CUSTOMER_USER_ID>: The unique ID of the customer in your system.
  • <YOUR_SECRET_API_KEY>: Your secret API key for authorization.

Parameters

ParameterTypeRequiredNullableDescription
custom_preferenceStringNoYesSet the refund preference individually for the user.
Possible values are:
grant: approve each refund request
no_preference: do not provide any recommendations
consentBooleanNoYesRecord if the user gave their consent to share their data.
True means that if you receive an in-app refund request, you may provide Apple with information about the user

Successful response: 200: OK

ParameterTypeDescription
profile_idStringCustomer profile ID.
consentBooleanDefines whether the user consented to share their data.
custom preferenceStringThe refund preference.

Successful response example

{
    "profile_id": "e5aab402-b1bd-4039-b632-57a91ebc0779",
    "settings": {
        "consent": true,
        "custom_preference": "no_preference"
    }
}

Errors

400: Bad request

profile_does_not_exist

İstek başlığındaki profil bulunamadığı için istek başarısız oldu. İstek başlığına girdiğiniz profile_id veya customer_user_id değerinde yazım hatası olmadığından emin olun ve doğru uygulama için olduğunu kontrol edin.

Body

ParametreTürAçıklama
errorsObject
  • source: (string) Her zaman non_field_errors
  • errors: Hatanın açıklaması.
error_codeStringKısa hata adı. Olası değer: profile_does_not_exist.
status_codeIntegerHTTP durumu. Her zaman 400.

Yanıt örneği

Profil bulunamadı

{
  "errors": [
    {
      "source": "non_field_errors",
      "errors": [
        "Profile not found"
      ]
    }
  ],
  "error_code": "profile_does_not_exist",
  "status_code": 400
}

401: Unauthorized

İstek, eksik veya hatalı yetkilendirme nedeniyle başarısız oldu. Authorization header’a özellikle dikkat ederek Yetkilendirme sayfasını inceleyin.

İstek aynı zamanda belirtilen profil bulunamadığı için de başarısız oldu.

Body

ParametreTürAçıklama
errorsObject
  • source: (string) Her zaman non_field_errors.
  • errors: Hatanın açıklaması.
error_codeStringKısa hata adı. Her zaman not_authenticated.
status_codeIntegerHTTP durum kodu. Her zaman 401.

Yanıt örneği

{
  "errors": [
    {
      "source": "non_field_errors",
      "errors": [
        "Authentication credentials were not provided."
      ]
    }
  ],
  "error_code": "not_authenticated",
  "status_code": 401
}

See also: