Skip to content

aronprins/warriorplus-for-wc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WarriorPlus for WooCommerce

Seamlessly integrate WarriorPlus payments with your WooCommerce store. Automatically create orders, users, and handle refunds when customers purchase through WarriorPlus.

Features

  • Automatic Order Creation - Orders are created in WooCommerce when WarriorPlus payments are received
  • User Management - Automatically creates WordPress user accounts for new customers
  • Refund Processing - Handles refunds from WarriorPlus and updates WooCommerce orders
  • Subscription Support - Cancel and reactivate subscriptions via WooCommerce Subscriptions
  • Product Variations - Support for variable products with unique IPN URLs per variation
  • Affiliate Tracking - Captures and stores affiliate ID information on orders
  • Admin Dashboard - View WarriorPlus transaction details, search orders by transaction ID
  • Secure IPN Processing - Security key verification, rate limiting, and input validation

Requirements

  • WordPress 5.0+
  • WooCommerce 3.0.0 - 8.0+
  • PHP 7.2+
  • SSL certificate (recommended)

Optional

  • WooCommerce Subscriptions (for subscription management features)

Installation

  1. Download the plugin and upload to /wp-content/plugins/warriorplus-for-wc/
  2. Activate the plugin through the WordPress admin
  3. Navigate to WooCommerce → Settings → WarriorPlus for WC
  4. Enter your Security Key from WarriorPlus

Configuration

Plugin Settings

Go to WooCommerce → Settings → WarriorPlus for WC to configure:

Setting Description
Security Key Your WarriorPlus security key for IPN verification
Send New Account Email Email new customers their login credentials
Affiliate ID Parameter POST parameter name for affiliate ID (default: WP_AFFID)

Product Setup

  1. Edit a WooCommerce product
  2. Go to the WarriorPlus tab
  3. Enter your WarriorPlus Product ID
  4. Select the order status to set after payment (Processing or Completed)
  5. Copy the generated IPN URL

WarriorPlus Setup

  1. Log into your WarriorPlus account
  2. Go to your product settings
  3. Find the IPN/Webhook settings
  4. Paste the IPN URL from your product settings
  5. Enter your Security Key
  6. Save

How It Works

Customer purchases on WarriorPlus
        ↓
WarriorPlus sends IPN to your site
        ↓
Plugin verifies security key
        ↓
Creates WordPress user (if new)
        ↓
Creates WooCommerce order
        ↓
Marks payment complete
        ↓
Sends order confirmation email

IPN Endpoint

The plugin creates a custom endpoint for receiving IPN notifications:

  • Simple products: https://yoursite.com/warriorplus-ipn/{product_id}
  • Variations: https://yoursite.com/warriorplus-ipn/{product_id}/{variation_id}

Supported Transaction Types

Type Action
sale Creates WooCommerce order
RFND Processes refund
CANCEL-REBILL Cancels subscription
subscr_cancelled Cancels subscription
UNCANCEL-REBILL Reactivates subscription

Admin Features

Orders

  • WarriorPlus transaction details displayed on order pages
  • Sortable "WarriorPlus Transaction" column in orders list
  • Search orders by transaction ID

Dashboard Widget

  • Shows recent WarriorPlus orders
  • Quick access to filtered orders list

User Profiles

  • Flag users as "Referred via WarriorPlus"
  • Track customer acquisition source

Hooks & Filters

The plugin provides extensive hooks for customization:

Actions

// Before/after IPN processing
do_action('warriorplus_for_wc_before_ipn_processing', $post_data, $product_id);
do_action('warriorplus_for_wc_after_ipn_processing', $result, $post_data);

// Before/after order creation
do_action('warriorplus_for_wc_before_order_creation', $user_id, $product, $post_data);
do_action('warriorplus_for_wc_after_order_creation', $order, $post_data);

// Before/after user creation
do_action('warriorplus_for_wc_before_user_creation', $email, $name);
do_action('warriorplus_for_wc_after_user_creation', $user_id, $email);

Filters

// Modify customer data before order creation
add_filter('warriorplus_for_wc_customer_data', function($data, $post_data) {
    // Modify $data array
    return $data;
}, 10, 2);

// Change order status
add_filter('warriorplus_for_wc_sale_order_status', function($status, $product) {
    return 'completed';
}, 10, 2);

// Customize rate limiting
add_filter('warriorplus_for_wc_ipn_rate_limit', function($limit) {
    return 60; // requests per window
});

add_filter('warriorplus_for_wc_ipn_rate_window', function($seconds) {
    return 120; // window in seconds
});

Troubleshooting

Orders not being created

  1. Verify your Security Key matches in both plugin settings and WarriorPlus
  2. Check that the WarriorPlus Product ID is set on your WooCommerce product
  3. Enable WP_DEBUG and check wp-content/debug.log for IPN processing logs

IPN URL returns 404

  1. Go to Settings → Permalinks
  2. Click "Save Changes" to flush rewrite rules

Price mismatch warnings

The plugin validates that the sale amount is within 50% of the product price. Ensure your WarriorPlus and WooCommerce prices align.

Rate limiting

By default, the plugin limits IPN requests to 30 per minute per IP. If you're receiving many legitimate requests, increase the limit using the warriorplus_for_wc_ipn_rate_limit filter.

Security

  • Security Key Verification - Timing-safe comparison prevents timing attacks
  • Rate Limiting - Protects against IPN flooding (configurable)
  • Input Validation - All inputs are sanitized and validated
  • CSRF Protection - Nonce verification on all admin forms
  • Idempotency - Prevents duplicate orders from IPN retries
  • PII Redaction - Sensitive data is redacted in debug logs

Changelog

1.2.2

  • Version bump

1.2.1

  • Added comprehensive security fixes
  • Timing-safe security key comparison
  • Rate limiting for IPN requests
  • CSRF protection improvements
  • Enhanced input validation

1.2.0

  • Added debug logging with PII redaction
  • HPOS (High-Performance Order Storage) compatibility
  • Improved error handling

1.1.0

  • Added product variations support
  • Per-variation IPN URLs and settings

1.0.0

  • Initial release

License

GPL v2 or later

Support

For bug reports and feature requests, please open an issue on GitHub.

About

Seamlessly integrate WarriorPlus payments with your WooCommerce store. Automatically create orders, users, and handle refunds when customers purchase through WarriorPlus.

Resources

Stars

Watchers

Forks

Contributors

Languages