johnokly
johnokly

Reputation: 1

Stripe subscription

I wanted to know if it is possible to not take credit card info when one of the drop down options for a subscriptions is a free plan.

So basically I have two plans. First is the basic plan and is free. The second is the premium plan and cost $20. When someone chooses the premium plan we capture their credit card info.

Now if someone chooses the free plan, is it possible to hide the credit card input fields when someone chooses the basic? And will stripe execute on it? Is there such an option on stripe?

thanks,

Upvotes: 0

Views: 634

Answers (4)

ashish bansal
ashish bansal

Reputation: 411

yeah that is possible, try to use this example:

1:first create plan (In plan we can pass amount 0 for free subscription )

2:create customer

3:create subscription

public function createPlan($data)
{
    $plan=\Stripe\Plan::create(array(
      "amount" => $data['Amount'],
      "interval" => $data['Interval'],
      "name" => $data['planName'],
      "currency" => "usd",
      "id" => $data['planName'])
    );
}
/*
* createcustomer function used to create customer for implementing recurring transactions rather asking again and again card details
*/
public function createCustomer($data,$token=null)
{
    $customer=\Stripe\Customer::create(array(
    "email"=>$data['email'],
    "description" => $data['name'],
    "source" => $token // obtained with Stripe.js
    ));
    $this->subscribe($customer,$data);
}
public function subscribe($customer,$data)
{
    $subsc=\Stripe\Subscription::create(array(
      "customer" => $customer->id,
      "plan" => $data['planName']
    ));
    \Stripe\Subscription::create(array(
     "customer" => customer['id'],
      "plan" => "home-delivery",
     ));
}

Upvotes: 0

Janaka Sampath
Janaka Sampath

Reputation: 85

yes You can do it based on your subscription plan. you can create Free and Pro plan(paid) and take those to your drop down list. when user select free plan hide your payment information capturing part and go further.

Upvotes: 0

Md Sirajus Salayhin
Md Sirajus Salayhin

Reputation: 5144

Yes you can hide the credit card option if this is a free subacription.

If you are using stripe.js then you can simply dissable the form based on your subscription plan.

Upvotes: 1

Matthew Arkin
Matthew Arkin

Reputation: 4658

Free subscriptions in Stripe don't require a card. Your application would need to recognize its a free plan and not require the credit card

Upvotes: 0

Related Questions