Is there any way to retrieve a Customer ID from the e-mail they enter in the payment form via the API?
For my application customers will pay multiple times on an on
I did this API request. This API request is not available in stripe docs.I got their search request at dashboard customize according to my requirements.
url :https://api.stripe.com/v1/search?query="+email+"&prefix=false",
method: GET
headers: {
"authorization": "Bearer Your_seceret Key",
"content-type": "application/x-www-form-urlencoded",
}
That depends on whether or not you're already following other best practices. ;)
With Stripe, as with most payment solutions, you're intended to retain the IDs for resources you'll use repeatedly. If you're doing this, then your database of users should contain each user's Stripe Customer ID, and you can:
It sounds like you're still in development, in which case you easily add any missing pieces and keep on trucking.
For example, if you're using Laravel, you might do something like this:
// When creating a customer
$customer = new Customer;
$customer->name = 'John Smith';
$customer->email = 'jsmith@example.com';
$stripe_customer = Stripe_Customer::create(array(
"description" => $customer->name,
"email" => $customer->email
));
$customer->stripe_id = $stripe_customer->id; // Keep this! We'll use it again!
$customer->save();
// When creating a charge
Stripe_Charge::create(array(
"amount" => 2999,
"currency" => "usd",
"customer" => Auth::user()->stripe_id, // Assign it to the customer
"description" => "Payment for Invoice 4321"
));
But I've already launched!
If you've already launched and have live invoices, your ability to associate past charges with customers is going to vary with the data you've been passing in to Stripe up to this point.
Without more details it's impossible offer any specific guidance, but the list of all charges is likely a good place to start.