POST /api/v2/server-side-api/purchase/set/transaction/

トランザクションを設定する

Adapty でアプリのエンドユーザーに新しいトランザクションを作成し、アクセスレベルを付与します。このメソッドで作成されたトランザクションはアナリティクスおよびイベントフィードに表示され、すべてのインテグレーションに送信されます。

既存のサブスクリプションの更新: 新しい subscription_renewed イベントを発生させずに billing_issue_detected_at または renew_status_changed_at を更新するには、既存の store_transaction_id を(同じ store_original_transaction_id の下で)再利用してください。新しい store_transaction_id を送信すると、新しいトランザクションとして扱われ、subscription_renewed イベントが発火します。

Header parameters

adapty-customer-user-idstring

お客様のシステムにおける顧客の一意の ID。adapty-customer-user-id または adapty-profile-id のいずれかが必須です。

adapty-profile-idstring

お客様のシステムにおけるプロファイルの一意の ID。匿名プロファイルを扱う場合に最適な選択肢です。adapty-customer-user-id または adapty-profile-id のいずれかが必須です。

Request body

Option 1 — object

買い切り購入のトランザクションデータ

purchase_typestringrequired

購入の種類

One of: "one_time_purchase"

storestringrequired

購入が行われたストア。一般的な値には app_storeplay_storestripepaddle、またはカスタムストア識別子が含まれます

environmentstring

購入が行われた環境

One of: "Production", "Sandbox"

store_product_idstringrequired

ストアにおけるプロダクト ID

store_transaction_idstringrequired

ストアにおけるトランザクション ID。最大 50 文字。PayPal およびカスタムストアのトランザクション ID はこの制限を超える場合があります。その場合は送信前に値をトリムまたはハッシュ化してください。そうしないとリクエストが失敗します。

store_original_transaction_idstringrequired

ストアにおける元のトランザクション ID

is_family_sharedboolean

購入がファミリー共有されているかどうか

priceobjectrequired
countrystringrequired

ISO 3166-1 alpha-2 形式の国コード(例:US

currencystringrequired

ISO 4217 形式の通貨コード(例:USD

valuenumberrequired

価格の値

purchased_atstringrequired

購入が行われた日時

variation_idstring

A/B テスト用のバリエーション ID

offerobject
categorystringrequired

オファーカテゴリー

One of: "introductory", "promotional", "offer_code", "win_back"

typestringrequired

オファータイプ

One of: "free_trial", "pay_as_you_go", "pay_up_front"

idstring

オファーID

refunded_atstring

購入が返金された日時

cancellation_reasonstring

キャンセルの理由

One of: "billing_error", "cancelled_by_developer", "new_subscription_replace", "price_increase", "product_was_not_available", "refund", "unknown", "upgraded", "voluntarily_cancelled", "adapty_revoked"

Option 2 — object

サブスクリプション購入のトランザクションデータ

purchase_typestringrequired

購入の種類

One of: "subscription"

storestringrequired

購入が行われたストア。一般的な値には app_storeplay_storestripepaddle、またはカスタムストア識別子が含まれます

environmentstring

購入が行われた環境

One of: "Production", "Sandbox"

store_product_idstringrequired

ストアにおけるプロダクト ID

store_transaction_idstringrequired

ストアにおけるトランザクション ID。最大 50 文字。PayPal および一部のカスタムストアのトランザクション ID はこの上限を超える場合があります。その場合は送信前に値をトリムまたはハッシュ化してください。そうしないとリクエストが失敗します。

store_original_transaction_idstringrequired

ストアにおける元のトランザクション ID

is_family_sharedboolean

購入がファミリー共有されているかどうか

priceobjectrequired
countrystringrequired

ISO 3166-1 alpha-2 形式の国コード(例:US

currencystringrequired

ISO 4217 形式の通貨コード(例:USD

valuenumberrequired

価格の値

purchased_atstringrequired

購入が行われた日時

variation_idstring

A/B テスト用のバリエーション ID

offerobject
categorystringrequired

オファーカテゴリー

One of: "introductory", "promotional", "offer_code", "win_back"

typestringrequired

オファータイプ

One of: "free_trial", "pay_as_you_go", "pay_up_front"

idstring

オファーID

refunded_atstring

購入が返金された日時

cancellation_reasonstring

キャンセルの理由

One of: "billing_error", "cancelled_by_developer", "new_subscription_replace", "price_increase", "product_was_not_available", "refund", "unknown", "upgraded", "voluntarily_cancelled", "adapty_revoked"

originally_purchased_atstringrequired

サブスクリプションが最初に購入された日時

expires_atstringrequired

サブスクリプションの有効期限

renew_statusbooleanrequired

サブスクリプションが更新されるかどうか

renew_status_changed_atstring

更新ステータスが変更された日時

billing_issue_detected_atstring

請求の問題が検出された日時

grace_period_expires_atstring

グレース期間が終了する日時

Responses

トランザクションが正常に記録されました

Schema
dataobjectrequired
app_idstringrequired

アプリの内部ID

profile_idstringrequired

AdaptyのプロファイルID

customer_user_idstringrequired

お客様のシステムにおけるユーザーのID

total_revenue_usdnumberrequired

プロファイルで獲得した総収益(USD)を表すfloat値

segment_hashstringrequired

内部パラメーター

timestampintegerrequired

レスポンス時間(ミリ秒)。競合状態の解決に使用します

custom_attributesarray of objectrequired

プロファイルに設定できるカスタム属性は最大30件です

keystringrequired

キーは30文字以下の文字列である必要があります。使用できるのは英字、数字、ダッシュ、ピリオド、アンダースコアのみです

valuestring | numberrequired

属性値は50文字以下である必要があります。値として使用できるのは文字列と浮動小数点数のみです

access_levelsarray of objectrequired

アクセスレベルオブジェクトの配列。顧客がアクセスレベルを持っていない場合は空の配列

access_level_idstring

アクセスレベルの識別子

storestring

アクセスレベルが購入されたストア

store_product_idstring

ストア内のプロダクトID

store_base_plan_idstring

ストア内のベースプランID

store_transaction_idstring

ストア内のトランザクションID

store_original_transaction_idstring

ストア内の元のトランザクションID

offerallOf

プロモーションオファーまたは初回オファーが適用された場合のオファーの詳細

categorystring

オファーカテゴリー

One of: "introductory", "promotional", "offer_code", "win_back"

typestring

オファータイプ

One of: "free_trial", "pay_as_you_go", "pay_up_front"

idstring

オファーID

starts_atstring

アクセスレベルが開始される日時

purchased_atstring

アクセスレベルが購入された日時

originally_purchased_atstring

アクセスレベルが最初に購入された日時

expires_atstring

アクセスレベルが期限切れになる日時

renewal_cancelled_atstring

更新がキャンセルされた日時

billing_issue_detected_atstring

請求の問題が検出された日時

is_in_grace_periodboolean

アクセスレベルがグレース期間中かどうか

cancellation_reasonstring

キャンセルの理由

subscriptionsarray of objectrequired

サブスクリプションオブジェクトの配列。顧客がサブスクリプションを持っていない場合は空の配列

storestring

サブスクリプションが購入されたストア

store_product_idstring

ストア内のプロダクトID

store_base_plan_idstring

ストア内のベースプランID

store_transaction_idstring

ストア内のトランザクションID

store_original_transaction_idstring

ストア内の元のトランザクションID

offerallOf

プロモーションオファーまたは初回オファーが適用された場合のオファー詳細

categorystring

オファーカテゴリー

One of: "introductory", "promotional", "offer_code", "win_back"

typestring

オファータイプ

One of: "free_trial", "pay_as_you_go", "pay_up_front"

idstring

オファーID

environmentstring

環境(サンドボックス、本番)

purchased_atstring

サブスクリプションが購入された日時

originally_purchased_atstring

サブスクリプションが最初に購入された日時

expires_atstring

サブスクリプションの有効期限

renewal_cancelled_atstring

更新がキャンセルされた日時

billing_issue_detected_atstring

請求の問題が検出された日時

is_in_grace_periodboolean

サブスクリプションがグレース期間中かどうか

cancellation_reasonstring

キャンセルの理由

non_subscriptionsarray of objectrequired

買い切り購入オブジェクトの配列。顧客が購入履歴を持っていない場合は空の配列

purchase_idstring

購入の一意識別子

storestring

購入が行われたストア

store_product_idstring

ストア内のプロダクトID

store_base_plan_idstring

ストア内のベースプランID

store_transaction_idstring

ストア内のトランザクションID

store_original_transaction_idstring

ストア内の元のトランザクションID

purchased_atstring

購入が行われた日時

environmentstring

環境(サンドボックス、本番)

is_refundboolean

返金かどうか

is_consumableboolean

消耗型アイテムの購入かどうか

リクエストが不正です

Schema
errorsarray of objectrequired
sourcestring

エラーの発生源

errorsarray of string

エラーメッセージの配列

error_codestringrequired

エラーの短い名称

status_codeintegerrequired

HTTPステータスコード

認証されていません

Schema
errorsarray of objectrequired
sourcestring

エラーの発生源

errorsarray of string

エラーメッセージの配列

error_codestringrequired

エラーの短い名称

status_codeintegerrequired

HTTPステータスコード

プロファイルが見つかりません

Schema
errorsarray of objectrequired
sourcestring

エラーの発生源

errorsarray of string

エラーメッセージの配列

error_codestringrequired

エラーの短い名称

status_codeintegerrequired

HTTPステータスコード

内部サーバーエラー