• Resolved jbenedict2

    (@jbenedict2)


    Hi,
    I am integrating with WP Affiliate Plateform Version 6.3.7 and installed Affiliate Stripe Payments Integration Version 1.4.

    I set commission for 75% but noted the total awarded is incorrect.
    Example:
    =========

    Product Name: Cloudifi SIP Trunk
    Quantity: 1
    Item Price: SG$10.00
    Channel Qty: Selected - 5 Channels: SG$40.00
    Singapore DDI number Qty: Selected - 1 DDI numbers: SG$1.50
    Tax: SG$3.61
    --------------------------------
    Total Amount: SG$55.11

    =========

    the user should get 75% of SG$55.11 = SG$41.33, but instead it calculated base on Item Price: SG$10.00 which gives 75% of SG$10 = SG$7.5

    Any help is appreciated as I do not know is it the issue with “Affiliate Stripe Payments Integration Version 1.4.” or I should go report straight to “WP Affiliate Plateform Version 6.3.7”

    looking forward to hearing from you. Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter jbenedict2

    (@jbenedict2)

    I had resolved.

    Error is in the plugin “Affiliate Stripe Payments Integration Version 1.4”. It uses “item_price” which should use “paid_amount”

    Plugin Author mra13

    (@mra13)

    Thank you for this.

    A slightly better calculation would be to do the following I think:

    
    $amount = ($item_price * $item_quantity) - $tax_amt - $shipping_amt;
    

    I have updated the addon with this fix. You can download it from the following page:
    https://www.tipsandtricks-hq.com/wordpress-affiliate/stripe-payments-plugin-affiliate-platform-integration-1457

    Thread Starter jbenedict2

    (@jbenedict2)

    Yes, that would be better. Let me try it out….Thanks.

    Thread Starter jbenedict2

    (@jbenedict2)

    I tested. Calculation is error. That is due to when variant is used in stripe payment plugin. the plugin “Affiliate Stripe Payments Integration Version 1.5” did not calculate those.

    Hence, I modified the code section as shown. I did not go further to find out those variant variable, for simple hack I just use the “paid amount” – [“tax amt” + “shipping amt”]:
    =========================
    `//Required Parameters
    $item_price = $post_data[‘item_price’];//Sale amount
    $item_quantity = isset($post_data[‘item_quantity’]) ? $post_data[‘item_quantity’] : 1;//Item quantity
    $tax_amt = isset($post_data[‘tax’]) ? $post_data[‘tax’] : 0;//Tax amount if any;
    $shipping_amt = isset($post_data[‘shipping’]) ? $post_data[‘shipping’] : 0;//Shipping amount if any;
    $paid_amount = $post_data[‘paid_amount’];//Total Amount Paid

    //Amount calculation (for commission purpose)
    wp_affiliate_log_debug(‘Stripe Payments integration – Item price: ‘.$item_price.’, Item quantity: ‘.$item_quantity.’, Tax: ‘.$tax_amt.’, Shipping: ‘. $shipping_amt.’, Total Paid Amount: ‘.$paid_amount, true);
    //$amount = ($item_price * $item_quantity) – $tax_amt – $shipping_amt;
    $amount = $paid_amount – ($tax_amt + $shipping_amt);
    =========================

    Hope helpful.

    You can account for the product price variations using the following code…

    $varPrice = isset( $post_data['var_applied'] ) ? $post_data['var_applied'] : '';
    
    		// check if we have variations applied
    		if ( $varPrice ) {
    			$varPrice = array_sum(array_column($varPrice, 'price'));
    		}
    Thread Starter jbenedict2

    (@jbenedict2)

    I uses :

    $varPrice = isset( $post_data['var_applied'] ) ? $post_data['var_applied'] : '';
    
    		// check if we have variations applied
    		if ( $varPrice ) {
    			$varPrice = array_sum(array_column($varPrice, 'price'));
    		}

    and
    set:
    $amount = ($item_price * $item_quantity) + $varPrice - $tax_amt - $shipping_amt;

    the commission is calculated based on incorrect amount.
    Actual amt = 123.05 – tax – shipping = 115, instead it based on 106.05 to calculate commission.

    Thread Starter jbenedict2

    (@jbenedict2)

    Hi,
    I am sorry of confusion… My calculation is wrong. Since the sum up price is before Tax and Shipping fee, hence the formulate should be:
    $amount = ($item_price + $varPrice) * $item_quantity;

    Should be good now. Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Using with WP Affiliate Platform’ is closed to new replies.