メインコンテンツへスキップ
POST
/
subscriptions
/
{subscription_id}
/
update-payment-method
JavaScript
import DodoPayments from 'dodopayments';

const client = new DodoPayments({
  bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted
});

const response = await client.subscriptions.updatePaymentMethod('subscription_id', {
  payment_method: { type: 'new' },
});

console.log(response.payment_id);
{
  "client_secret": "<string>",
  "expires_on": "2023-11-07T05:31:56Z",
  "payment_id": "<string>",
  "payment_link": "<string>"
}
サブスクリプションの支払い方法を更新します。このエンドポイントは、アクティブなサブスクリプションとon_hold状態のサブスクリプションの両方をサポートしています。
on_hold状態のサブスクリプションに対して支払い方法を更新すると、未払い分の請求が自動的に作成され、請求書が発行され、支払い成功時にサブスクリプションがactive状態へ再アクティブ化されます。

使用例

  • アクティブなサブスクリプション: カードが期限切れになったときや、顧客が別の支払い方法を使用したいときに支払い方法を更新
  • 保留中のサブスクリプション: 支払い失敗により保留になったサブスクリプションを支払い方法を更新することで再活性化
  • 支払い方法の管理: 保存された支払い方法の間で切り替えたり、新しいものを追加したりする
既存の顧客の支払い方法を一覧表示するには、支払い方法一覧 APIを使用してください。これにより、サブスクリプションの支払い方法を更新する際にtype: "existing"を使用するための利用可能な支払い方法IDを取得できます。

アクティブなサブスクリプションの動作

アクティブなサブスクリプションの支払い方法を更新する場合:
  • 支払い方法は即座に更新されます
  • 請求は作成されません
  • サブスクリプションはアクティブのままです
  • 今後の更新は新しい支払い方法を使用します

保留中のサブスクリプションの動作

on_hold状態のサブスクリプションの支払い方法を更新する場合:
  1. 未払い分に対する請求が自動的に作成されます
  2. 請求に対して請求書が生成されます
  3. 新しい支払い方法で支払いが処理されます
  4. 支払いが成功すると、サブスクリプションはactive状態へ再アクティブ化されます
  5. 次のWebhookイベントを受信します:payment.succeeded、その後subscription.active
on_holdサブスクリプションの支払い方法を更新した後に支払いが失敗した場合、サブスクリプションはon_hold状態のままになります。支払い状況を追跡するにはWebhookイベントを監視してください。

Webhookイベント

on_holdサブスクリプションの支払い方法を更新すると、次のWebhookイベントを受信します:
  1. payment.succeeded - 未払い分の請求が成功しました
  2. subscription.active - サブスクリプションが再アクティブ化されました

承認

Authorization
string
header
必須

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

パスパラメータ

subscription_id
string
必須

Subscription Id

ボディ

application/json
type
enum<string>
必須
利用可能なオプション:
new
allowed_payment_method_types
enum<string>[] | null

List of payment methods allowed during checkout.

Customers will never see payment methods that are not in this list. However, adding a method here does not guarantee customers will see it. Availability still depends on other factors (e.g., customer location, merchant settings).

All supported payment method types (from Hyperswitch).

Used for disabled-payment-methods filtering and validation.

利用可能なオプション:
ach,
affirm,
afterpay_clearpay,
alfamart,
ali_pay,
ali_pay_hk,
alma,
amazon_pay,
apple_pay,
atome,
bacs,
bancontact_card,
becs,
benefit,
bizum,
blik,
boleto,
bca_bank_transfer,
bni_va,
bri_va,
card_redirect,
cimb_va,
classic,
credit,
crypto_currency,
cashapp,
dana,
danamon_va,
debit,
duit_now,
efecty,
eft,
eps,
fps,
evoucher,
giropay,
givex,
google_pay,
go_pay,
gcash,
ideal,
interac,
indomaret,
klarna,
kakao_pay,
local_bank_redirect,
mandiri_va,
knet,
mb_way,
mobile_pay,
momo,
momo_atm,
multibanco,
online_banking_thailand,
online_banking_czech_republic,
online_banking_finland,
online_banking_fpx,
online_banking_poland,
online_banking_slovakia,
oxxo,
pago_efectivo,
permata_bank_transfer,
open_banking_uk,
pay_bright,
paypal,
paze,
pix,
pay_safe_card,
przelewy24,
prompt_pay,
pse,
red_compra,
red_pagos,
samsung_pay,
sepa,
sepa_bank_transfer,
sofort,
sunbit,
swish,
touch_n_go,
trustly,
twint,
upi_collect,
upi_intent,
vipps,
viet_qr,
venmo,
walley,
we_chat_pay,
seven_eleven,
lawson,
mini_stop,
family_mart,
seicomart,
pay_easy,
local_bank_transfer,
mifinity,
open_banking_pis,
direct_carrier_billing,
instant_bank_transfer,
billie,
zip,
revolut_pay,
naver_pay,
payco
return_url
string | null

レスポンス

Payment method updated

client_secret
string | null
expires_on
string<date-time> | null
payment_id
string | null
Last modified on February 27, 2026