Subscriptions
استرداد استهلاك الرصيد
استرداد استهلاك الرصيد لاشتراك.
GET
/
subscriptions
/
{subscription_id}
/
credit-usage
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.retrieveCreditUsage('sub_Iuaq622bbmmfOGrVTqdXv');
console.log(response.subscription_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.retrieve_credit_usage(
"sub_Iuaq622bbmmfOGrVTqdXv",
)
print(response.subscription_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.GetCreditUsage(context.TODO(), "sub_Iuaq622bbmmfOGrVTqdXv")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.SubscriptionID)
}package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.subscriptions.SubscriptionRetrieveCreditUsageParams;
import com.dodopayments.api.models.subscriptions.SubscriptionRetrieveCreditUsageResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
SubscriptionRetrieveCreditUsageResponse response = client.subscriptions().retrieveCreditUsage("sub_Iuaq622bbmmfOGrVTqdXv");
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.subscriptions.SubscriptionRetrieveCreditUsageParams
import com.dodopayments.api.models.subscriptions.SubscriptionRetrieveCreditUsageResponse
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val response: SubscriptionRetrieveCreditUsageResponse = client.subscriptions().retrieveCreditUsage("sub_Iuaq622bbmmfOGrVTqdXv")
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
response = dodo_payments.subscriptions.retrieve_credit_usage("sub_Iuaq622bbmmfOGrVTqdXv")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Dodopayments\Client;
use Dodopayments\Core\Exceptions\APIException;
$client = new Client(
bearerToken: getenv('DODO_PAYMENTS_API_KEY') ?: 'My Bearer Token',
environment: 'test_mode',
);
try {
$response = $client->subscriptions->retrieveCreditUsage(
'sub_Iuaq622bbmmfOGrVTqdXv'
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Subscriptions;
DodoPaymentsClient client = new();
SubscriptionRetrieveCreditUsageParams parameters = new()
{
SubscriptionID = "sub_Iuaq622bbmmfOGrVTqdXv"
};
var response = await client.Subscriptions.RetrieveCreditUsage(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()
.retrieve_credit_usage()
.subscription_id(subscription_id)
.await?;
println!("{result:?}");
Ok(())
}curl --request GET \
--url https://test.dodopayments.com/subscriptions/{subscription_id}/credit-usage \
--header 'Authorization: Bearer <token>'{
"items": [
{
"balance": "250.00",
"credit_entitlement_id": "<string>",
"credit_entitlement_name": "<string>",
"limit_reached": true,
"overage": "15.50",
"overage_enabled": true,
"unit": "<string>",
"overage_limit": "100.00",
"remaining_headroom": "84.50"
}
],
"subscription_id": "<string>"
}التفويضات
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
معلمات المسار
Subscription ID
آخر تعديل في ١ أبريل ٢٠٢٦
هل كانت هذه الصفحة مفيدة؟
السابق
تحديث طريقة الدفعتحديث طريقة الدفع لاشتراك موجود. يمكنك إما إضافة طريقة دفع جديدة أو استخدام واحدة موجودة من طرق الدفع المحفوظة للعميل.
التالي
⌘I
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.retrieveCreditUsage('sub_Iuaq622bbmmfOGrVTqdXv');
console.log(response.subscription_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.retrieve_credit_usage(
"sub_Iuaq622bbmmfOGrVTqdXv",
)
print(response.subscription_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.GetCreditUsage(context.TODO(), "sub_Iuaq622bbmmfOGrVTqdXv")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.SubscriptionID)
}package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.subscriptions.SubscriptionRetrieveCreditUsageParams;
import com.dodopayments.api.models.subscriptions.SubscriptionRetrieveCreditUsageResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
SubscriptionRetrieveCreditUsageResponse response = client.subscriptions().retrieveCreditUsage("sub_Iuaq622bbmmfOGrVTqdXv");
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.subscriptions.SubscriptionRetrieveCreditUsageParams
import com.dodopayments.api.models.subscriptions.SubscriptionRetrieveCreditUsageResponse
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val response: SubscriptionRetrieveCreditUsageResponse = client.subscriptions().retrieveCreditUsage("sub_Iuaq622bbmmfOGrVTqdXv")
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
response = dodo_payments.subscriptions.retrieve_credit_usage("sub_Iuaq622bbmmfOGrVTqdXv")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Dodopayments\Client;
use Dodopayments\Core\Exceptions\APIException;
$client = new Client(
bearerToken: getenv('DODO_PAYMENTS_API_KEY') ?: 'My Bearer Token',
environment: 'test_mode',
);
try {
$response = $client->subscriptions->retrieveCreditUsage(
'sub_Iuaq622bbmmfOGrVTqdXv'
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Subscriptions;
DodoPaymentsClient client = new();
SubscriptionRetrieveCreditUsageParams parameters = new()
{
SubscriptionID = "sub_Iuaq622bbmmfOGrVTqdXv"
};
var response = await client.Subscriptions.RetrieveCreditUsage(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()
.retrieve_credit_usage()
.subscription_id(subscription_id)
.await?;
println!("{result:?}");
Ok(())
}curl --request GET \
--url https://test.dodopayments.com/subscriptions/{subscription_id}/credit-usage \
--header 'Authorization: Bearer <token>'{
"items": [
{
"balance": "250.00",
"credit_entitlement_id": "<string>",
"credit_entitlement_name": "<string>",
"limit_reached": true,
"overage": "15.50",
"overage_enabled": true,
"unit": "<string>",
"overage_limit": "100.00",
"remaining_headroom": "84.50"
}
],
"subscription_id": "<string>"
}