I am working on subscription, i want to do subscription from future date, i did code for that, but i am not sure is it correct or not, here i have added my code, can anyone please look in this code and tell me i am correct or not, or you can also you give your thoughts on that, here is my subscription code.
$customer = \Stripe\Customer::create(array(
'source' => $token,
'description'=> 'Test Customer',
'email' => 'NIKULTAKA@GMAIL.com',
'plan' => $plan_id,
));
// Charge the order:
$dateTime = new DateTime('2018-07-10');
$date_timestamp = $dateTime->format('U');
$charge = \Stripe\Subscription::create(array(
'customer' => $customer->id,
"items" => array(
array(
"plan" => $plan_id,
),
),
"billing_cycle_anchor"=> $date_timestamp
));
I'm not sure about your code, but I can give you some tips.
Implement recurring payment can be harder than you expect.
You can use other payment gateway, the recurly can make you life easier. Here you can see a client api in PHP for recurly