doutan2111 2018-06-09 11:48
浏览 6

我们如何在PHP中的条带支付网关中应用未来的定期付款

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
));
  • 写回答

1条回答 默认 最新

  • dpy87530 2018-06-09 16:35
    关注

    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

    评论

报告相同问题?