Customers
Liệt kê email của khách hàng
Lấy mọi email giao dịch đã gửi cho một khách hàng trong 180 ngày qua, cùng với kết quả gửi của từng email.
GET
/
customers
/
{customer_id}
/
emails
JavaScript
import DodoPayments from 'dodopayments';
const client = new DodoPayments({
bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const emailLogItem of client.customers.emails.list('customer_id')) {
console.log(emailLogItem.email_log_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
)
page = client.customers.emails.list(
customer_id="customer_id",
)
page = page.items[0]
print(page.email_log_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"),
)
page, err := client.Customers.Emails.List(
context.TODO(),
"customer_id",
dodopayments.CustomerEmailListParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.customers.emails.EmailListPage;
import com.dodopayments.api.models.customers.emails.EmailListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
EmailListPage page = client.customers().emails().list("customer_id");
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.customers.emails.EmailListPage
import com.dodopayments.api.models.customers.emails.EmailListParams
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val page: EmailListPage = client.customers().emails().list("customer_id")
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
page = dodo_payments.customers.emails.list("customer_id")
puts(page)<?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 {
$page = $client->customers->emails->list(
'customer_id', pageNumber: 0, pageSize: 0
);
var_dump($page);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Customers.Emails;
DodoPaymentsClient client = new();
EmailListParams parameters = new() { CustomerID = "customer_id" };
var page = await client.Customers.Emails.List(parameters);
await foreach (var item in page.Paginate())
{
Console.WriteLine(item);
}use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let customer_id = "customer_id";
let result = client
.customers()
.emails()
.list()
.customer_id(customer_id)
.query(serde_json::json!({}))
.await?;
println!("{result:?}");
Ok(())
}curl --request GET \
--url https://test.dodopayments.com/customers/{customer_id}/emails \
--header 'Authorization: Bearer <token>'{
"items": [
{
"category": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"email_log_id": "<string>",
"email_type": "<string>",
"has_preview": true,
"policies": {
"requires_different_address": true,
"resend_allowed": true,
"resends_remaining": 123,
"retry_allowed": true,
"superseded": true
},
"status": "sent",
"failure_code": "mailbox_not_found",
"failure_reason": "<string>",
"from": "<string>",
"recipient": "<string>",
"subject": "<string>"
}
],
"total_count": 1
}Ủy quyền
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Tham số đường dẫn
The customer's id
Tham số truy vấn
How many emails to return. The default is 10 and the maximum is 100.
Phạm vi bắt buộc:
x >= 0Which page to return. The default is 0.
Phạm vi bắt buộc:
x >= 0Lần sửa đổi cuối 25 tháng 9, 2026
Trang này có hữu ích không?
⌘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
});
// Automatically fetches more pages as needed.
for await (const emailLogItem of client.customers.emails.list('customer_id')) {
console.log(emailLogItem.email_log_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
)
page = client.customers.emails.list(
customer_id="customer_id",
)
page = page.items[0]
print(page.email_log_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"),
)
page, err := client.Customers.Emails.List(
context.TODO(),
"customer_id",
dodopayments.CustomerEmailListParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.customers.emails.EmailListPage;
import com.dodopayments.api.models.customers.emails.EmailListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
EmailListPage page = client.customers().emails().list("customer_id");
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.customers.emails.EmailListPage
import com.dodopayments.api.models.customers.emails.EmailListParams
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val page: EmailListPage = client.customers().emails().list("customer_id")
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
page = dodo_payments.customers.emails.list("customer_id")
puts(page)<?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 {
$page = $client->customers->emails->list(
'customer_id', pageNumber: 0, pageSize: 0
);
var_dump($page);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Customers.Emails;
DodoPaymentsClient client = new();
EmailListParams parameters = new() { CustomerID = "customer_id" };
var page = await client.Customers.Emails.List(parameters);
await foreach (var item in page.Paginate())
{
Console.WriteLine(item);
}use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let customer_id = "customer_id";
let result = client
.customers()
.emails()
.list()
.customer_id(customer_id)
.query(serde_json::json!({}))
.await?;
println!("{result:?}");
Ok(())
}curl --request GET \
--url https://test.dodopayments.com/customers/{customer_id}/emails \
--header 'Authorization: Bearer <token>'{
"items": [
{
"category": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"email_log_id": "<string>",
"email_type": "<string>",
"has_preview": true,
"policies": {
"requires_different_address": true,
"resend_allowed": true,
"resends_remaining": 123,
"retry_allowed": true,
"superseded": true
},
"status": "sent",
"failure_code": "mailbox_not_found",
"failure_reason": "<string>",
"from": "<string>",
"recipient": "<string>",
"subject": "<string>"
}
],
"total_count": 1
}