Buat Pelanggan
Buat pelanggan baru di akun Dodo Payments Anda.
import DodoPayments from 'dodopayments';
const client = new DodoPayments({
bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted
});
const customer = await client.customers.create({ email: 'email', name: 'name' });
console.log(customer.business_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
)
customer = client.customers.create(
email="email",
name="name",
)
print(customer.business_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"),
)
customer, err := client.Customers.New(context.TODO(), dodopayments.CustomerNewParams{
Email: dodopayments.F("email"),
Name: dodopayments.F("name"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", customer.BusinessID)
}
package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.customers.Customer;
import com.dodopayments.api.models.customers.CustomerCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
CustomerCreateParams params = CustomerCreateParams.builder()
.email("email")
.name("name")
.build();
Customer customer = client.customers().create(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.Customer
import com.dodopayments.api.models.customers.CustomerCreateParams
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val params: CustomerCreateParams = CustomerCreateParams.builder()
.email("email")
.name("name")
.build()
val customer: Customer = client.customers().create(params)
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
customer = dodo_payments.customers.create(email: "email", name: "name")
puts(customer)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Dodopayments\Client;
use Dodopayments\Core\Exceptions\APIException;
use Dodopayments\Misc\Locale;
$client = new Client(
bearerToken: getenv('DODO_PAYMENTS_API_KEY') ?: 'My Bearer Token',
environment: 'test_mode',
);
try {
$customer = $client->customers->create(
email: 'email',
name: 'name',
metadata: ['foo' => 'string'],
phoneNumber: 'phone_number',
preferredLocale: Locale::AR,
);
var_dump($customer);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Customers;
DodoPaymentsClient client = new();
CustomerCreateParams parameters = new()
{
Email = "email",
Name = "name",
};
var customer = await client.Customers.Create(parameters);
Console.WriteLine(customer);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let result = client
.customers()
.create()
.body(dodopayments::models::CustomersCreateParams {
email: Some("email".to_string()),
name: Some("name".to_string()),
..Default::default()
})
.await?;
println!("{result:?}");
Ok(())
}curl --request POST \
--url https://test.dodopayments.com/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"name": "<string>",
"metadata": {},
"phone_number": "<string>"
}
'{
"business_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"customer_id": "<string>",
"email": "<string>",
"name": "<string>",
"blocked_at": "2023-11-07T05:31:56Z",
"blocklist_entry_id": "<string>",
"metadata": {},
"phone_number": "<string>",
"preferred_locale": "ar"
}Otorisasi
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Additional metadata for the customer
Show child attributes
Show child attributes
The language of the customer emails, a code from GET /locales. With no value, the
emails are in English until a checkout or the customer portal sets a language.
ar, ca, zh, nl, en, fr, de, he, id, it, ja, ka, ko, ms, pl, pt, ro, ru, es, sv, th, tr Respons
When the merchant blocked this customer. The dashboard shows the "Blocked" badge and the unblock action from it. The list route leaves it empty; only the single-customer route resolves it.
Blocklist entry behind blocked_at, so the dashboard can link to it.
Additional metadata for the customer
Show child attributes
Show child attributes
The language of the customer emails. null gives English.
ar, ca, zh, nl, en, fr, de, he, id, it, ja, ka, ko, ms, pl, pt, ro, ru, es, sv, th, tr Apakah halaman ini membantu?
import DodoPayments from 'dodopayments';
const client = new DodoPayments({
bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted
});
const customer = await client.customers.create({ email: 'email', name: 'name' });
console.log(customer.business_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
)
customer = client.customers.create(
email="email",
name="name",
)
print(customer.business_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"),
)
customer, err := client.Customers.New(context.TODO(), dodopayments.CustomerNewParams{
Email: dodopayments.F("email"),
Name: dodopayments.F("name"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", customer.BusinessID)
}
package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.customers.Customer;
import com.dodopayments.api.models.customers.CustomerCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
CustomerCreateParams params = CustomerCreateParams.builder()
.email("email")
.name("name")
.build();
Customer customer = client.customers().create(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.Customer
import com.dodopayments.api.models.customers.CustomerCreateParams
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val params: CustomerCreateParams = CustomerCreateParams.builder()
.email("email")
.name("name")
.build()
val customer: Customer = client.customers().create(params)
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
customer = dodo_payments.customers.create(email: "email", name: "name")
puts(customer)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Dodopayments\Client;
use Dodopayments\Core\Exceptions\APIException;
use Dodopayments\Misc\Locale;
$client = new Client(
bearerToken: getenv('DODO_PAYMENTS_API_KEY') ?: 'My Bearer Token',
environment: 'test_mode',
);
try {
$customer = $client->customers->create(
email: 'email',
name: 'name',
metadata: ['foo' => 'string'],
phoneNumber: 'phone_number',
preferredLocale: Locale::AR,
);
var_dump($customer);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Customers;
DodoPaymentsClient client = new();
CustomerCreateParams parameters = new()
{
Email = "email",
Name = "name",
};
var customer = await client.Customers.Create(parameters);
Console.WriteLine(customer);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let result = client
.customers()
.create()
.body(dodopayments::models::CustomersCreateParams {
email: Some("email".to_string()),
name: Some("name".to_string()),
..Default::default()
})
.await?;
println!("{result:?}");
Ok(())
}curl --request POST \
--url https://test.dodopayments.com/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"name": "<string>",
"metadata": {},
"phone_number": "<string>"
}
'{
"business_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"customer_id": "<string>",
"email": "<string>",
"name": "<string>",
"blocked_at": "2023-11-07T05:31:56Z",
"blocklist_entry_id": "<string>",
"metadata": {},
"phone_number": "<string>",
"preferred_locale": "ar"
}