#azharwaheed
1 messages ยท Page 1 of 1 (latest)
yes
i want to avoid creating a new customer if a customer already exist with the same email and name already exists
you can search for customers with a given email address https://stripe.com/docs/api/customers/list#list_customers-email
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
var service = new CustomerService();
var customers = service.List();
string lastId = null;
// Enumerate the first page of the list
foreach (Customer customer in customers)
{
lastId = customer.Id;
Console.WriteLine(customer.Email);
}
customers = service.List(new CustomerListOptions()
{
StartingAfter = lastId,
});
// Enumerate the subsequent page
foreach (Customer customer in customers)
{
lastId = customer.Id;
Console.WriteLine(customer.Email);
}
var options = new CustomerListOptions
{
Email = "abc@example.com",
Limit = 1,
};
var service = new CustomerService();
StripeList<Customer> customers = service.List(
options);
private void Start()
{
StripeConfiguration.ApiKey = "sk_test_51NYQkEDJMBBSt3MK6za7LiV4vXCpVkRBLOoNqtQgTEbWuyLPFfHHR57tVJ0iMEdZqtG4aV0iemPKN7ik0ZkySPqo00uuxF2d4e";
Successful_panel.gameObject.SetActive(false);
//var service = new CustomerService();
//Customer customer = service.Get("customer@example.com");
var options = new CustomerListOptions
{
Email = "customer@example.com",
Limit = 1,
};
var service = new CustomerService();
StripeList<Customer> customers = service.List(options);
var options1 = new CustomerCreateOptions
{
Email = "customer@example.com"
};
var service1 = new CustomerService();
Customer customer = service.Create(options1);
Debug.Log(customer.Email);
}
add these code in script but create new customer . customer already exist in dashborad
yes because you didn't add an "if" statement to prevent that from happening if you already have a customer that has that email address
can you share me any example
actually we can't really write code for you, this is a matter of a simple if statement. if you're not really technical I highly recommend hiring someone to help you write your code