Customers
Lấy nội dung email của khách hàng
Lấy một email đã gửi chính xác như khi email đó được gửi, cùng với lý do email không gửi thành công nếu có.
GET
/
customers
/
{customer_id}
/
emails
/
{email_log_id}
/
body
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 emailBody = await client.customers.emails.retrieveBody('email_log_id', {
customer_id: 'customer_id',
});
console.log(emailBody.merchant_authored);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
)
email_body = client.customers.emails.retrieve_body(
email_log_id="email_log_id",
customer_id="customer_id",
)
print(email_body.merchant_authored)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"),
)
emailBody, err := client.Customers.Emails.GetBody(
context.TODO(),
"customer_id",
"email_log_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", emailBody.MerchantAuthored)
}
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.EmailBody;
import com.dodopayments.api.models.customers.emails.EmailRetrieveBodyParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
EmailRetrieveBodyParams params = EmailRetrieveBodyParams.builder()
.customerId("customer_id")
.emailLogId("email_log_id")
.build();
EmailBody emailBody = client.customers().emails().retrieveBody(params);
}
}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.EmailBody
import com.dodopayments.api.models.customers.emails.EmailRetrieveBodyParams
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val params: EmailRetrieveBodyParams = EmailRetrieveBodyParams.builder()
.customerId("customer_id")
.emailLogId("email_log_id")
.build()
val emailBody: EmailBody = client.customers().emails().retrieveBody(params)
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
email_body = dodo_payments.customers.emails.retrieve_body("email_log_id", customer_id: "customer_id")
puts(email_body)<?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 {
$emailBody = $client->customers->emails->retrieveBody(
'email_log_id', customerID: 'customer_id'
);
var_dump($emailBody);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Customers.Emails;
DodoPaymentsClient client = new();
EmailRetrieveBodyParams parameters = new()
{
CustomerID = "customer_id",
EmailLogID = "email_log_id",
};
var emailBody = await client.Customers.Emails.RetrieveBody(parameters);
Console.WriteLine(emailBody);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let customer_id = "customer_id";
let email_log_id = "email_log_id";
let result = client
.customers()
.emails()
.retrieve_body()
.customer_id(customer_id)
.email_log_id(email_log_id)
.await?;
println!("{result:?}");
Ok(())
}curl --request GET \
--url https://test.dodopayments.com/customers/{customer_id}/emails/{email_log_id}/body \
--header 'Authorization: Bearer <token>'{
"merchant_authored": true,
"failure_code": "mailbox_not_found",
"failure_reason": "<string>",
"html": "<string>",
"text": "<string>"
}Ủy quyền
Send your API key as a bearer token: Authorization: Bearer <api_key>. A test mode key starts with dodo_test_, for example dodo_test_AbCd1234EfGh5678.<secret>. A live mode key starts with dodo_live_. Use a test mode key on test.dodopayments.com and a live mode key on live.dodopayments.com. Keys from before these tags have no tag and operate as before.
Tham số đường dẫn
Phản hồi
The email's stored body
Lầ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
});
const emailBody = await client.customers.emails.retrieveBody('email_log_id', {
customer_id: 'customer_id',
});
console.log(emailBody.merchant_authored);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
)
email_body = client.customers.emails.retrieve_body(
email_log_id="email_log_id",
customer_id="customer_id",
)
print(email_body.merchant_authored)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"),
)
emailBody, err := client.Customers.Emails.GetBody(
context.TODO(),
"customer_id",
"email_log_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", emailBody.MerchantAuthored)
}
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.EmailBody;
import com.dodopayments.api.models.customers.emails.EmailRetrieveBodyParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
EmailRetrieveBodyParams params = EmailRetrieveBodyParams.builder()
.customerId("customer_id")
.emailLogId("email_log_id")
.build();
EmailBody emailBody = client.customers().emails().retrieveBody(params);
}
}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.EmailBody
import com.dodopayments.api.models.customers.emails.EmailRetrieveBodyParams
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val params: EmailRetrieveBodyParams = EmailRetrieveBodyParams.builder()
.customerId("customer_id")
.emailLogId("email_log_id")
.build()
val emailBody: EmailBody = client.customers().emails().retrieveBody(params)
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
email_body = dodo_payments.customers.emails.retrieve_body("email_log_id", customer_id: "customer_id")
puts(email_body)<?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 {
$emailBody = $client->customers->emails->retrieveBody(
'email_log_id', customerID: 'customer_id'
);
var_dump($emailBody);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Customers.Emails;
DodoPaymentsClient client = new();
EmailRetrieveBodyParams parameters = new()
{
CustomerID = "customer_id",
EmailLogID = "email_log_id",
};
var emailBody = await client.Customers.Emails.RetrieveBody(parameters);
Console.WriteLine(emailBody);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let customer_id = "customer_id";
let email_log_id = "email_log_id";
let result = client
.customers()
.emails()
.retrieve_body()
.customer_id(customer_id)
.email_log_id(email_log_id)
.await?;
println!("{result:?}");
Ok(())
}curl --request GET \
--url https://test.dodopayments.com/customers/{customer_id}/emails/{email_log_id}/body \
--header 'Authorization: Bearer <token>'{
"merchant_authored": true,
"failure_code": "mailbox_not_found",
"failure_reason": "<string>",
"html": "<string>",
"text": "<string>"
}