Response to server-side API requests: 400: Bad request

billing_issue_detected_at_date_comparison_error

請求の問題は、サブスクリプションの更新試行中に問題が発生した際に起こるため、常にトランザクション日(purchased_at)より後に発生します。

これを解決するには、請求問題の日付(billing_issue_detected_at)がトランザクション日(purchased_at)より後になるように設定してください。

Body

ParameterTypeDescription
errorsObject
  • source: (string) 常に billing_issue_detected_at
  • errors: エラーの説明。
error_codeStringエラーの短縮名。常に billing_issue_detected_at_date_comparison_error
status_codeIntegerHTTP ステータス。常に 400

レスポンス例

{
  "errors": [
    {
      "source": "billing_issue_detected_at",
      "errors": [
        "billing_issue_detected_at must be later than purchased_at."
      ]
    }
  ],
  "error_code": "billing_issue_detected_at_date_comparison_error",
  "status_code": 400
}

expires_date_error

ユーザーはすでに期限切れのサブスクリプションを購入することはできません。そのため、expires_atの日付(サブスクリプションの有効期限)は、purchased_atの日付(トランザクションの発生日)より後である必要があります。

これを修正するには、これらの日付を確認し、expires_atpurchased_atより後になっていることを確認してください。

ボディ

パラメータ説明
errorsObject
  • source: (string) 常に expires_at
  • errors: エラーの説明。
error_codeStringエラーの短縮名。常に expires_date_error
status_codeIntegerHTTPステータス。常に 400

レスポンス例

{
  "errors": [
    {
      "source": "expires_at",
      "errors": [
        "expires_at must be later than purchased_at."
      ]
    }
  ],
  "error_code": "expires_date_error",
  "status_code": 400
}

family_share_price_error

is_family_shared パラメータが true に設定されているため、リクエストが失敗しました。これはアクセスレベルがファミリーメンバーと無料で共有されることを意味します。しかし、Price オブジェクトの value パラメータがゼロに設定されていません。

is_family_sharedtrue にする場合は、Price オブジェクトの value パラメータを 0 に設定してください。

Body

ParameterTypeDescription
errorsObject
  • source: (string) 常に is_family_shared
  • errors: エラーの説明。
error_codeStringエラーの短い名前。常に family_share_price_error
status_codeIntegerHTTP ステータス。常に 400

レスポンス例

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

{
  "errors": [
    {
      "source": "is_family_shared",
      "errors": [
        "If is_family_shared is true, price.value must be 0."
      ]
    }
  ],
  "error_code": "family_share_price_error",
  "status_code": 400
}

free_trial_price_error

offer_type パラメーターが free_trial に設定されているにもかかわらず、Price オブジェクトの value パラメーターがゼロに設定されていないため、リクエストが失敗しました。

別の原因として、offer_id パラメーターが含まれているにもかかわらず null のままになっているケースが考えられます。このパラメーターに null は指定できません。offer_id に値を指定するか、パラメーター自体を削除してください。

Body

パラメーター説明
errorsObject
  • source: (string) 常に offer.type
  • errors: エラーの説明。
error_codeStringエラーの短い名前。常に free_trial_price_error
status_codeIntegerHTTP ステータス。常に 400

レスポンス例

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

{
  "errors": [
    {
      "source": "offer_type",
      "errors": [
        "If offer_type is 'free_trial', price.value must be 0."
      ]
    }
  ],
  "error_code": "free_trial_price_error",
  "status_code": 400
}

grace_period_expires_date_error

グレース期間とは、期限内にサブスクリプションを更新できなかったユーザー(例:クレジットカードの決済が通らなかった場合など)に対して、延長の猶予を与えるための仕組みです。問題を解決する間もユーザーの設定をそのまま維持できるため、解約を防ぐ効果があります。グレース期間の提供は任意です。

グレース期間を設定する場合、グレース期間の有効期限(grace_period_expires_at)はサブスクリプションの有効期限(expires_at)より後の日時である必要があります。そうでない場合、グレース期間の有効期限はサブスクリプションの有効期限と同じになります。いずれの場合も、グレース期間の有効期限がサブスクリプションの有効期限より前になることはありません。

この問題を解決するには、グレース期間の有効期限(grace_period_expires_at)がサブスクリプションの有効期限(expires_at)より後の日時になるよう設定してください。

Body

パラメータ説明
errorsObject
  • source: (string) 常に grace_period_expires_at
  • errors: エラーの説明。
error_codeStringエラーの短い名称。常に grace_period_expires_date_error
status_codeIntegerHTTPステータス。常に 400

レスポンス例

{
  "errors": [
    {
      "source": "grace_period_expires_at",
      "errors": [
        "grace_period_expires_at must be later or equal to expires_at."
      ]
    }
  ],
  "error_code": "grace_period_expires_date_error",
  "status_code": 400
}

grace_period_billing_error

グレース期間の開始は請求の問題としてカウントされます。そのため、グレース期間が開始している場合(grace_period_expires_at パラメーターに値が設定されていることで確認できます)、その開始日を billing_issue_detected_at パラメーターに記録する必要があります。

これを修正するには、billing_issue_detected_at にグレース期間の開始日を設定するか、グレース期間がまだ開始していない場合は grace_period_expires_at パラメーターを削除してください。

ボディ

パラメーター説明
errorsObject
  • source: (string) 常に grace_period_billing_error
  • errors: エラーの説明。
error_codeStringエラーの短い名前。常に grace_period_billing_error
status_codeIntegerHTTP ステータス。常に 400

レスポンス例

{
  "errors": [
    {
      "source": "grace_period_billing_error",
      "errors": [
        "If grace_period_expires_at is specified, billing_issue_detected_at must also be specified."
      ]
    }
  ],
  "error_code": "grace_period_billing_error",
  "status_code": 400
}

missing_offer_id

offer_category パラメーターの値が introductory 以外であるか、offer_type が指定されているにもかかわらず offer_id が含まれていない場合、リクエストは失敗します。この場合、offer_id を指定するか、リクエストから offer_category または offer_type を削除してください。

また、offer_id パラメーターが追加されているにもかかわらず null のままになっている場合も原因として考えられます(null は許容されません)。その場合は、offer_id に値を設定するか、パラメーター自体を削除してください。

Body

パラメーター説明
errorsObject
  • source: (string) 常に offer.category
  • errors: エラーの説明。
error_codeStringエラーの短い名前。設定可能な値: missing_offer_id
status_codeIntegerHTTP ステータス。常に 400

レスポンス例

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

{
  "errors": [
    {
      "source": "offer_category",
      "errors": [
        "offer_id must be specified for all offer types except 'introductory'."
      ]
    }
  ],
  "error_code": "missing_offer_id",
  "status_code": 400
}

one_time_purchase_trial_error

リクエストは、買い切り購入にトライアルが指定されていたため失敗しました。サブスクリプションとは異なり、買い切り購入にはトライアルを設定できません。修正するには、One-Time Purchase オブジェクト内の Offer オブジェクトにある offer_type を確認してください。offer_type の値に free_trial は指定できません。offer_type フィールドの値を変更するか、買い切り購入の代わりに Subscription オブジェクトを使用してください。

Body

パラメーター説明
errorsObject
  • source: (string) 常に offer.type
  • errors: エラーの説明。
error_codeStringエラーの短い名前。常に one_time_purchase_trial_error
status_codeIntegerHTTP ステータス。常に 400

レスポンス例

{
  "errors": [
    {
      "source": "offer.type",
      "errors": [
        "One-time purchase cannot have a trial."
      ]
    }
  ],
  "error_code": "one_time_purchase_trial_error",
  "status_code": 400
}

originally_purchased_date_error

継続するサブスクリプションでは、トランザクションのチェーンが作成されます。最初のトランザクションがこのチェーンの起点となり、以降のすべてのトランザクションをリンクします。各更新はこの最初のトランザクションの延長に過ぎません。トランザクションが初回購入の場合、それ自体が元のトランザクションとなります。

originally_purchased_at タイムスタンプは最初の購入日時を示し、purchased_at は現在のトランザクションの日時を示します。そのため、purchased_atoriginally_purchased_at より早くなることはありません。最初のトランザクションの場合に限り、両者が同じ値になることがあります。

originally_purchased_atpurchased_at より後の日付に設定されているため、リクエストが失敗しました。originally_purchased_atpurchased_at 以前の日付になるよう確認してください。

ボディ

パラメータ説明
errorsObject
  • source: (string) 常に originally_purchased_at
  • errors: エラーの説明。
error_codeStringエラーの短い名前。常に originally_purchased_date_error
status_codeIntegerHTTP ステータス。常に 400

レスポンス例

{
  "errors": [
    {
      "source": "originally_purchased_at",
      "errors": [
        "originally_purchased_at must be earlier than or equal to purchased_at."
      ]
    }
  ],
  "error_code": "originally_purchased_date_error",
  "status_code": 400
}

リクエストで指定されたアクセスレベルが見つからなかったため、リクエストが失敗しました。access_level_id にタイポがないか、また正しいアプリに対応しているかを確認してください。

ボディ

パラメーター説明
errorsObject
  • source: (string) 常に non_field_errors
  • errors: エラーの説明。
error_codeStringエラーの短い名称。取りうる値: paid_access_level_does_not_exist
status_codeIntegerHTTP ステータス。常に 404

レスポンス例

アクセスレベルが見つかりませんでした。

{
  "errors": [
    {
      "source": "non_field_errors",
      "errors": [
        "Paid access level `premium` does not exist"
      ]
    }
  ],
  "error_code": "paid_access_level_does_not_exist",
  "status_code": 400
}

profile_does_not_exist

リクエストヘッダーのプロファイルが見つからなかったためリクエストが失敗しました。リクエストヘッダーに入力した profile_id または customer_user_id にタイポがないか確認し、正しいアプリ用のものかどうかをチェックしてください。

ボディ

パラメーター説明
errorsObject
  • source: (string) 常に non_field_errors
  • errors: エラーの説明。
error_codeStringエラーの短い名前。使用可能な値: profile_does_not_exist
status_codeIntegerHTTPステータス。常に 400

レスポンス例

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

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

profile_paid_access_level_does_not_exist

リクエスト内のプロファイルが、指定されたアクセスレベルと一致しないため、リクエストが失敗しました。ヘッダーのプロファイルIDとボディのアクセスレベルIDが正しいか、タイプミスがないかを確認してください。

ボディ

パラメーター説明
errorsObject
  • source: (string) 常に non_field_errors
  • errors: エラーの説明。
error_codeStringエラーの短縮名。常に profile_paid_access_level_does_not_exist
status_codeIntegerHTTPステータス。常に 400

レスポンス例

{
  "errors": [
    {
      "source": "non_field_errors",
      "errors": [
        "Profile `478b2e7f-d557-4b8b-9c5f-cbd46fc2dee2` has no `premium` access level"
      ]
    }
  ],
  "error_code": "profile_paid_access_level_does_not_exist",
  "status_code": 400
}

refund_date_error

リクエストが失敗しました。購入日(purchased_at)が返金日(refunded_at)以前の日時になっているためです。返金はトランザクションの取り消しであるため、必ず購入後に行われます。

修正するには、purchased_atrefunded_at パラメータを確認し、返金日が購入日より後になっていることを確認してください。

Body

パラメータ説明
errorsObject
  • source: (string) 常に refunded_at
  • errors: エラーの説明。
error_codeStringエラーの短い名前。常に refund_date_error
status_codeIntegerHTTP ステータス。常に 400

レスポンス例

{
  "errors": [
    {
      "source": "refunded_at",
      "errors": [
        "refunded_at must be later than purchased_at."
      ]
    }
  ],
  "error_code": "refund_date_error",
  "status_code": 400
}

refund_fields_error

リクエストに cancellation_reason が含まれているにもかかわらず refunded_at の日付がない場合、またはその逆の場合にリクエストが失敗します。

返金を設定する際は、返金日と返金理由の両方を指定する必要があります。

ボディ

パラメーター説明
errorsObject
  • source: (string) 常に refunded_at
  • errors: エラーの説明。
error_codeStringエラーの短縮名。常に refund_fields_error
status_codeIntegerHTTP ステータス。常に 400

レスポンス例

{
  "errors": [
    {
      "source": "refunded_at",
      "errors": [
        "refunded_at and cancellation_reason=refund must be specified together."
      ]
    }
  ],
  "error_code": "refund_fields_error",
  "status_code": 400
}

renew_status_changed_date_error

Renewalはサブスクリプションの延長を指します。ユーザーはサブスクリプションの延長をキャンセルし、その後再度延長することができます。これらのアクションが行われた時刻は renew_status_changed_at パラメータに保存されます。この値がトランザクション自体よりも早くなることはありません。

この問題を解決するには、renew_status_changed_at がトランザクションの時刻(purchased_at)より後であることを確認してください。

Body

パラメータ説明
errorsObject
  • source: (string) 常に originally_purchased_at
  • errors: エラーの説明。
error_codeStringエラーの短い名称。常に originally_purchased_date_error
status_codeIntegerHTTPステータス。常に 400

レスポンス例

{
  "errors": [
    {
      "source": "renew_status_changed_at",
      "errors": [
        "renew_status_changed_at must be later than purchased_at."
      ]
    }
  ],
  "error_code": "renew_status_changed_date_error",
  "status_code": 400
}

revocation_date_more_than_expiration_date

リクエストで指定した revoke_at が、現在のアクセスレベルの expires_at パラメータよりも後の日時であるため、リクエストに失敗しました。アクセスレベルを延長したい場合は、アクセスレベルの付与リクエストを使用してください。

Body

パラメータ説明
errorsObject
  • source: (string) 常に non_field_errors
  • errors: エラーの説明。
error_codeStringエラーの短縮名。常に revocation_date_more_than_expiration_date
status_codeIntegerHTTP ステータス。常に 400

レスポンス例

  {
  "errors": [
    {
      "source": "revoke_at",
      "errors": [
        "Revocation date (2029-08-29 09:33:42+00:00) is more than current expiration date (2028-08-29 09:33:42+00:00)"
      ]
    }
  ],
  "error_code": "revocation_date_more_than_expiration_date",
  "status_code": 400
}

store_transaction_id_error

サブスクリプションが継続される場合、サブスクリプションのチェーンが生成されます。オリジナルトランザクションはこのチェーンの最初のトランザクションであり、チェーンはそれによってリンクされています。チェーン内の他のトランザクションは継続分です。そのトランザクションがサブスクリプションチェーンの最初の購入である場合、それ自身がオリジナルトランザクションになることがあります。

もう一つのケースは買い切り購入です。継続が発生しないため、チェーンは作成されません。買い切り購入の場合、store_transaction_id は常に store_original_transaction_id と同じ値になります。

買い切り購入オブジェクトの store_transaction_id の値が store_original_transaction_id と異なるため、リクエストが失敗しました。この問題を解決するには、両者を同じ値にするか、オブジェクトを変更して 買い切り購入の代わりにサブスクリプションを使用してください。

ボディ

パラメーター説明
errorsObject
  • source: (string) 常に store_transaction_id
  • errors: エラーの説明。
error_codeStringエラーの短い名称。常に store_transaction_id_error
status_codeIntegerHTTPステータス。常に 400

レスポンス例

{
  "errors": [
    {
      "source": "store_transaction_id",
      "errors": [
        "store_transaction_id must be equal to store_original_transaction_id for purchase."
      ]
    }
  ],
  "error_code": "store_transaction_id_error",
  "status_code": 400
}

value_error

リクエストは、指定された失効日が過去の日付であるために失敗しました。revoke_at を将来の日付に設定するか、アクセスを即時失効させる場合は null を設定してください。

Body
パラメーター説明
errorsObject
  • source: (string) 常に revoke_at
  • errors: エラーの説明。
error_codeStringエラーの短い名前。常に value_error
status_codeIntegerHTTP ステータス。常に 400
レスポンス例
{
    "errors": [
        {
            "source": null,
            "errors": [
                "Must be greater than the current time or null"
            ]
        }
    ],
    "error_code": "value_error",
    "status_code": 400
}