application/libraries/Stripe.php
//create a plan which will be attached to a product
create a plan which will be attached to a product
create a plan which will be attached to a product
function create_plan($product_id, $interval, $currency,  $amount, $nickname=''){
        try{
            $plan = \Stripe\Plan::create([
                    'product' => $product_id,
                    'nickname' => $nickname,
                    'interval' => $interval,
                    'currency' => $currency,
                    'amount' => $amount, 
                  ]);
            if(empty($plan))
                return array('status'=>false,'message'=>'Something went wrong');
            return array('status'=>true,'message'=>'Plan created successfully', 'data'=>$plan); 
        }catch(Exception $e){
            $message = $e->getMessage();
            return array('status'=>false,'message'=>$message);
        }
    }
function create_plan ( $ product_id , $ interval , $ currency , $ amount , $ nickname = '' ) { try { $ plan = \ Stripe \ Plan :: create ( [ 'product' => $ product_id , 'nickname' => $ nickname , 'interval' => $ interval , 'currency' => $ currency , 'amount' => $ amount , ] ) ; if ( empty ( $ plan ) ) return array ( 'status' => false , 'message' => 'Something went wrong' ) ; return array ( 'status' => true , 'message' => 'Plan created successfully' , 'data' => $ plan ) ; } catch ( Exception $ e ) { $ message = $ e -> getMessage ( ) ; return array ( 'status' => false , 'message' => $ message ) ; } }
create a plan which will be attached to a product
create a plan which will be attached to a product
//amount in cents, for $1 it should be 100 cents //success