Customers
Criar Sessão do Portal do Cliente
Criar uma sessão do Portal do Cliente para um cliente específico.
POST
/
customers
/
{customer_id}
/
customer-portal
/
session
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 customerPortalSession = await client.customers.customerPortal.create(
'cus_TV52uJWWXt2yIoBBxpjaa',
);
console.log(customerPortalSession.link);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
)
customer_portal_session = client.customers.customer_portal.create(
customer_id="cus_TV52uJWWXt2yIoBBxpjaa",
)
print(customer_portal_session.link)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"),
)
customerPortalSession, err := client.Customers.CustomerPortal.New(
context.TODO(),
"cus_TV52uJWWXt2yIoBBxpjaa",
dodopayments.CustomerCustomerPortalNewParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", customerPortalSession.Link)
}
package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.customers.CustomerPortalSession;
import com.dodopayments.api.models.customers.customerportal.CustomerPortalCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
CustomerPortalSession customerPortalSession = client.customers().customerPortal().create("cus_TV52uJWWXt2yIoBBxpjaa");
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.customers.CustomerPortalSession
import com.dodopayments.api.models.customers.customerportal.CustomerPortalCreateParams
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val customerPortalSession: CustomerPortalSession = client.customers().customerPortal().create("cus_TV52uJWWXt2yIoBBxpjaa")
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
customer_portal_session = dodo_payments.customers.customer_portal.create("cus_TV52uJWWXt2yIoBBxpjaa")
puts(customer_portal_session)<?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 {
$customerPortalSession = $client->customers->customerPortal->create(
'cus_TV52uJWWXt2yIoBBxpjaa', returnURL: 'return_url', sendEmail: true
);
var_dump($customerPortalSession);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Customers.CustomerPortal;
DodoPaymentsClient client = new();
CustomerPortalCreateParams parameters = new()
{
CustomerID = "cus_TV52uJWWXt2yIoBBxpjaa"
};
var customerPortalSession = await client.Customers.CustomerPortal.Create(parameters);
Console.WriteLine(customerPortalSession);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let customer_id = "customer_id";
let result = client
.customers()
.customer_portal()
.create()
.customer_id(customer_id)
.query(serde_json::json!({}))
.await?;
println!("{result:?}");
Ok(())
}curl --request POST \
--url https://test.dodopayments.com/customers/{customer_id}/customer-portal/session \
--header 'Authorization: Bearer <token>'{
"link": "<string>"
}Autorizações
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.
Parâmetros de caminho
Customer Id
Parâmetros de consulta
If true, will send link to user.
Optional return URL for this session. Overrides the business-level default. This URL will be shown as a "Return to {business}" back button in the portal.
Resposta
Successfully send email to customer (if they exist)
Última modificação em 1 de abril de 2026
Esta página foi útil?
⌘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 customerPortalSession = await client.customers.customerPortal.create(
'cus_TV52uJWWXt2yIoBBxpjaa',
);
console.log(customerPortalSession.link);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
)
customer_portal_session = client.customers.customer_portal.create(
customer_id="cus_TV52uJWWXt2yIoBBxpjaa",
)
print(customer_portal_session.link)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"),
)
customerPortalSession, err := client.Customers.CustomerPortal.New(
context.TODO(),
"cus_TV52uJWWXt2yIoBBxpjaa",
dodopayments.CustomerCustomerPortalNewParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", customerPortalSession.Link)
}
package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.customers.CustomerPortalSession;
import com.dodopayments.api.models.customers.customerportal.CustomerPortalCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
CustomerPortalSession customerPortalSession = client.customers().customerPortal().create("cus_TV52uJWWXt2yIoBBxpjaa");
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.customers.CustomerPortalSession
import com.dodopayments.api.models.customers.customerportal.CustomerPortalCreateParams
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val customerPortalSession: CustomerPortalSession = client.customers().customerPortal().create("cus_TV52uJWWXt2yIoBBxpjaa")
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
customer_portal_session = dodo_payments.customers.customer_portal.create("cus_TV52uJWWXt2yIoBBxpjaa")
puts(customer_portal_session)<?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 {
$customerPortalSession = $client->customers->customerPortal->create(
'cus_TV52uJWWXt2yIoBBxpjaa', returnURL: 'return_url', sendEmail: true
);
var_dump($customerPortalSession);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Customers.CustomerPortal;
DodoPaymentsClient client = new();
CustomerPortalCreateParams parameters = new()
{
CustomerID = "cus_TV52uJWWXt2yIoBBxpjaa"
};
var customerPortalSession = await client.Customers.CustomerPortal.Create(parameters);
Console.WriteLine(customerPortalSession);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let customer_id = "customer_id";
let result = client
.customers()
.customer_portal()
.create()
.customer_id(customer_id)
.query(serde_json::json!({}))
.await?;
println!("{result:?}");
Ok(())
}curl --request POST \
--url https://test.dodopayments.com/customers/{customer_id}/customer-portal/session \
--header 'Authorization: Bearer <token>'{
"link": "<string>"
}