Skip to main content
POST
/
subscriptions
/
{subscription_id}
/
charge
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.charge('sub_Iuaq622bbmmfOGrVTqdXv', {
  product_price: 0,
});

console.log(response.payment_id);
import os
from dodopayments import DodoPayments

client = DodoPayments(
bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"), # This is the default and can be omitted
)
response = client.subscriptions.charge(
subscription_id="sub_Iuaq622bbmmfOGrVTqdXv",
product_price=0,
)
print(response.payment_id)
package main

import (
"context"
"fmt"

"github.com/dodopayments/dodopayments-go"
"github.com/dodopayments/dodopayments-go/option"
)

func main() {
client := dodopayments.NewClient(
option.WithBearerToken("My Bearer Token"),
)
response, err := client.Subscriptions.Charge(
context.TODO(),
"sub_Iuaq622bbmmfOGrVTqdXv",
dodopayments.SubscriptionChargeParams{
ProductPrice: dodopayments.F(int64(0)),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.PaymentID)
}
package com.dodopayments.api.example;

import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.subscriptions.SubscriptionChargeParams;
import com.dodopayments.api.models.subscriptions.SubscriptionChargeResponse;

public final class Main {
private Main() {}

public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();

SubscriptionChargeParams params = SubscriptionChargeParams.builder()
.subscriptionId("sub_Iuaq622bbmmfOGrVTqdXv")
.productPrice(0)
.build();
SubscriptionChargeResponse response = client.subscriptions().charge(params);
}
}
package com.dodopayments.api.example

import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.subscriptions.SubscriptionChargeParams
import com.dodopayments.api.models.subscriptions.SubscriptionChargeResponse

fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()

val params: SubscriptionChargeParams = SubscriptionChargeParams.builder()
.subscriptionId("sub_Iuaq622bbmmfOGrVTqdXv")
.productPrice(0)
.build()
val response: SubscriptionChargeResponse = client.subscriptions().charge(params)
}
require "dodopayments"

dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)

response = dodo_payments.subscriptions.charge("sub_Iuaq622bbmmfOGrVTqdXv", product_price: 0)

puts(response)
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Dodopayments\Client;
use Dodopayments\Core\Exceptions\APIException;
use Dodopayments\Misc\Currency;

$client = new Client(
bearerToken: getenv('DODO_PAYMENTS_API_KEY') ?: 'My Bearer Token',
environment: 'test_mode',
);

try {
$response = $client->subscriptions->charge(
'sub_Iuaq622bbmmfOGrVTqdXv',
productPrice: 0,
adaptiveCurrencyFeesInclusive: true,
customerBalanceConfig: [
'allowCustomerCreditsPurchase' => true,
'allowCustomerCreditsUsage' => true,
],
metadata: ['foo' => 'string'],
productCurrency: Currency::AED,
productDescription: 'product_description',
);

var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}
using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Subscriptions;

DodoPaymentsClient client = new();

SubscriptionChargeParams parameters = new()
{
SubscriptionID = "sub_Iuaq622bbmmfOGrVTqdXv",
ProductPrice = 0,
};

var response = await client.Subscriptions.Charge(parameters);

Console.WriteLine(response);
use dodopayments::Client;

#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let subscription_id = "subscription_id";
let result = client
.subscriptions()
.charge()
.subscription_id(subscription_id)
.body(dodopayments::models::SubscriptionsChargeParams {
product_price: Some(0),
..Default::default()
})
.await?;
println!("{result:?}");
Ok(())
}
curl --request POST \
--url https://test.dodopayments.com/subscriptions/{subscription_id}/charge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"product_price": 123,
"adaptive_currency_fees_inclusive": true,
"customer_balance_config": {
"allow_customer_credits_purchase": true,
"allow_customer_credits_usage": true
},
"metadata": {},
"product_description": "<string>"
}
'
{
  "payment_id": "<string>"
}

Authorizations

Authorization
string
header
required

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

Path Parameters

subscription_id
string
required

Subscription Id

Body

application/json
product_price
integer<int32>
required

The product price. Represented in the lowest denomination of the currency (e.g., cents for USD). For example, to charge $1.00, pass 100.

adaptive_currency_fees_inclusive
boolean | null

Whether adaptive currency fees should be included in the product_price (true) or added on top (false). This field is ignored if adaptive pricing is not enabled for the business.

customer_balance_config
null | object

Specify how customer balance is used for the payment

metadata
null | Metadata · object

Metadata for the payment. If not passed, the metadata of the subscription will be taken

product_currency
null | enum<string>

Optional currency of the product price. If not specified, defaults to the currency of the product.

Available options:
AED,
ALL,
AMD,
ANG,
AOA,
ARS,
AUD,
AWG,
AZN,
BAM,
BBD,
BDT,
BGN,
BHD,
BIF,
BMD,
BND,
BOB,
BRL,
BSD,
BWP,
BYN,
BZD,
CAD,
CHF,
CLP,
CNY,
COP,
CRC,
CUP,
CVE,
CZK,
DJF,
DKK,
DOP,
DZD,
EGP,
ETB,
EUR,
FJD,
FKP,
GBP,
GEL,
GHS,
GIP,
GMD,
GNF,
GTQ,
GYD,
HKD,
HNL,
HRK,
HTG,
HUF,
IDR,
ILS,
INR,
IQD,
JMD,
JOD,
JPY,
KES,
KGS,
KHR,
KMF,
KRW,
KWD,
KYD,
KZT,
LAK,
LBP,
LKR,
LRD,
LSL,
LYD,
MAD,
MDL,
MGA,
MKD,
MMK,
MNT,
MOP,
MRU,
MUR,
MVR,
MWK,
MXN,
MYR,
MZN,
NAD,
NGN,
NIO,
NOK,
NPR,
NZD,
OMR,
PAB,
PEN,
PGK,
PHP,
PKR,
PLN,
PYG,
QAR,
RON,
RSD,
RUB,
RWF,
SAR,
SBD,
SCR,
SEK,
SGD,
SHP,
SLE,
SLL,
SOS,
SRD,
SSP,
STN,
SVC,
SZL,
THB,
TND,
TOP,
TRY,
TTD,
TWD,
TZS,
UAH,
UGX,
USD,
UYU,
UZS,
VES,
VND,
VUV,
WST,
XAF,
XCD,
XOF,
XPF,
YER,
ZAR,
ZMW
product_description
string | null

Optional product description override for billing and line items. If not specified, the stored description of the product will be used.

Response

Subscription Charge successfully created

payment_id
string
required
Last modified on March 25, 2026