dongzan0108 2016-07-15 12:55 采纳率: 0%
浏览 21
已采纳

在付费方案上创建新的条带用户,设置试用期,不使用信用卡

Using the Stripe API, Creating a new user on a paid plan with a trial period doesn't seem to work without a credit card token.

I am using the PHP SDK and doing the following:

$customer = \Stripe\Customer::create(array(
    "source" => NULL,
    "plan" => 'PROFESSIONAL',
    "email" => $email_address,
    "trial_end" => $unix_timestamp
);

Which returns the error:

Error: Invalid source object: must be a dictionary or a non-empty string.

There are two reasons I think this should work, which is why I think I am doing something wrong.

  1. Adding trial_end adds a trial to the subscription, so no payment is needed which means it doesn't need a Credit Card at that point in time.
  2. Using the Stripe online Portal, you can create a user on a paid subscription, and also move existing users on to a paid subscription without the need for a Credit Card, when you specify a trial period. If you can do it in the portal, why can't you do it via the API?

Is there something I have missed in the Documentation to allow me to do this?

  • 写回答

2条回答 默认 最新

  • dsgdf45654 2016-07-15 13:14
    关注

    Just tried the following which worked.

    $customer = \Stripe\Customer::create(array(
        "plan" => 'PROFESSIONAL',
        "email" => $email_address,
        "trial_end" => $unix_timestamp
    );
    

    Basically I just removed the source key/value completely. It then created the user on the paid plan with the trial.

    Odd behaviour as when you create a user on a FREE plan, you can have the source key there with a value of NULL and it works. Also not documented as far as I can see.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗
  • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路
  • ¥15 经gamit解算的cors站数据再经globk网平差得到的坐标做形变分析
  • ¥15 GD32 SPI通信时我从机原样返回收到的数据怎么弄?
  • ¥15 phython读取excel表格报错 ^7个 SyntaxError: invalid syntax 语句报错
  • ¥20 @microsoft/fetch-event-source 流式响应问题
  • ¥15 ogg dd trandata 报错
  • ¥15 高缺失率数据如何选择填充方式
  • ¥50 potsgresql15备份问题