• Resolved amsweb1

    (@amsweb1)


    I am trying to migrate our site from one stripe plugin to your Simple Stripe Checkout, but it is not going as smoothly as I imagined. I am currently getting the following error whenever I try to require the init.php file.

    Fatal error: Cannot redeclare class Stripe\Util\Set in /home/devgac/public_html/wp-content/plugins/stripe/libraries/stripe-php/lib/Util/Set.php on line 8

    I have a screenshot of the problem with Simple Stripe Checkout plugin and a screenshot of how the page looks with a different plugin.

    Simple Stripe Checkout
    WP Integration with Stripe

    https://www.ads-software.com/plugins/stripe/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter amsweb1

    (@amsweb1)

    function stripe_admin(){
    
      if(is_user_logged_in()){
    
        $user_id = get_current_user_id();
    
        if ($user_id == 1){
    
          global $stripe_options;
    
            // load the stripe libraries
            if ( !class_exists( 'Stripe' ) )
              require(dirname(__DIR__).'/libraries/stripe-php/init.php');
    
            // check if we are using test mode
            if ( isset( $stripe_options['test_mode'] ) && $stripe_options['test_mode'] ) {
              $secret_key = trim( $stripe_options['test_secret_key'] );
            } else {
              $secret_key = trim( $stripe_options['live_secret_key'] );
            }
    
            \Stripe\Stripe::setApiKey( $secret_key );
    
            $customers = \Stripe\Customer::all();
            /*
            ?>
    
            <h2>Payers</h2>
    
            <table class="stripe-admin-table" id="payerTable">
             <thead>
              <tr>
                <th>Name</th>
                <th>Email</th>
                <th>Phone</th>
              </tr>
              </thead>
              <tbody>
              <?php foreach($payers as $payer){ ?>
    
              <tr>
                <td><?php echo $payer->name; ?></td>
                <td><?php echo $payer->email; ?></td>
                <td><?php echo $payer->phone; ?></td>
              </tr>
    
              <?php } ?>
              </tbody>
            </table>
            */ ?>
            <h2>Stripe Customers</h2>
    
            <table class="stripe-admin-table" id="myTable">
             <thead>
              <tr>
                <th>Name</th>
                <th>Email</th>
                <th>Plan</th>
                <th>Payer</th>
                <th>Premium</th>
                <th>Delinquent</th>
                <th>Customer Created</th>
              </tr>
              </thead>
              <tbody>
              <?php foreach($customers->data as $cus){ ?>
    
              <tr>
                <td><a href="https://dashboard.stripe.com/test/customers/<?php echo $cus->id; ?>" target="_BLANK"><?php echo $cus->metadata->name; ?></a></td>
                <td><?php echo $cus->email; ?></td>
                <td><?php echo $cus->subscriptions->data[0]['plan']['name']; ?></td>
                <td><?php echo $cus->metadata->payer; ?></td>
                <td><?php echo $cus->metadata->premium; ?></td>
                <td <?php if($cus->delinquent){ echo 'style="color:red;"'; }?>><?php if($cus->delinquent){echo 'YES';}else{echo 'NO';} ?></td>
                <td><?php echo date_i18n('m-d-y',$cus->created); ?></td>
              </tr>
    
              <?php } ?>
              </tbody>
            </table>
    
            <?php
    
        }else{
          wp_redirect('https://gacdev.amsvps12.com/new-subscriber'); exit;
        }
      }else{
        wp_redirect('https://gacdev.amsvps12.com/new-subscriber'); exit;
      }
    
    }
    add_shortcode('stripe-admin', 'stripe_admin');
    Thread Starter amsweb1

    (@amsweb1)

    Can we remove this post? I am going another direction with the project instead.

    Plugin Contributor Nick Young

    (@nickyoung87)

    It looks like the original issue was that you had 2 plugins trying to load the Stripe library. If you deactivate one then it should go away. We make a check in out plugin for this but can’t guarantee other developers do the same thing.

    Can we remove this post? I am going another direction with the project instead.

    I don’t think we can remove posts completely, but I will mark it resolved.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Fatal error: Cannot redeclare class Stripe\Util\Set’ is closed to new replies.