Forums / Built-in Shipping and Payment Modules / I am using we pay and the shipping is not being collected..

I am using we pay and the shipping is not being collected..

Views: 2,300

Results 1 to 6 of 6
10 Nov 2013, 5:28 AM
#1
noppie avatar

noppie

Zen Follower

Join Date:
Mar 2004
Posts:
210
Plugin Contributions:
0

I am using we pay and the shipping is not being collected..

I really like the wepay but Iam losing money becasue the mod doesn't collect shipping.

this is hte code for the webipn..
but I have no idea how to see if shipping is being asked for
anyone else having this problem

over half of customer use wepay..but if they are collecting shipping.. i lose money.. can someone help
Naomi

<?php //// Wepay Production version 1.0 //// wepayipn.php file //// written by Alan Pinnt <https://www.alanpinnt.com> //// 2012 ZENCART ONLY require 'wepay.php'; chdir('../../../../'); require('includes/application_top.php'); if (!defined('MODULE_PAYMENT_WEPAY_CHECKOUT_STATUS') || (MODULE_PAYMENT_WEPAY_CHECKOUT_STATUS != 'True')) {exit;} if (!empty($_POST['checkout_id'])) {$thecheckoutid = $_POST['checkout_id'];} else {$thecheckoutid = $_GET['checkout_id'];} $client_id = MODULE_PAYMENT_WEPAY_CHECKOUT_CLIENT_ID; $client_secret = MODULE_PAYMENT_WEPAY_CHECKOUT_CLIENT_SECRET; $access_token = MODULE_PAYMENT_WEPAY_CHECKOUT_ACCESS_TOKEN; $account_id = MODULE_PAYMENT_WEPAY_CHECKOUT_ACCOUNT_ID; if (MODULE_PAYMENT_WEPAY_CHECKOUT_PRODUCTION == 'Staging') {$whattouse = useStaging;} elseif (MODULE_PAYMENT_WEPAY_CHECKOUT_PRODUCTION == 'Production') {$whattouse = useProduction;} Wepay::$whattouse($client_id, $client_secret); $wepay = new WePay($access_token); try {$checkout = $wepay->request('checkout', array('checkout_id' => $thecheckoutid,)); } catch (WePayException $e) {$error = $e->getMessage();} if ($checkout->state == "captured") { global $db; $query_id = $db->Execute("SELECT orders_id FROM ".TABLE_ORDERS_STATUS_HISTORY." WHERE comments = '".$checkout->reference_id."'"); $row_id = zen_db_fetch_array($query_id); $sql_data_array = array('orders_id' => $row_id['orders_id'], 'orders_status_id' => '2', 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => 'Payment captured - Wepay'); zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array); $db->Execute("update " . TABLE_ORDERS . " set orders_status = '2', last_modified = now() where orders_id = '".$row_id['orders_id']."'"); } require('includes/application_bottom.php'); ?>

My Multi_Site Zen Carts
http://herasonlinemarket.com

26 Nov 2013, 7:52 PM
#2
noppie avatar

noppie

Zen Follower

Join Date:
Mar 2004
Posts:
210
Plugin Contributions:
0

Re: I am using we pay and the shipping is not being collected..

can anyone help.. ... is anyone using this plug in.

My Multi_Site Zen Carts
http://herasonlinemarket.com

26 Nov 2013, 9:52 PM
#3
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: I am using we pay and the shipping is not being collected..

noppie:

can anyone help.. ... is anyone using this plug in.

Not using this plugin/mod; however, agree there is too little information in that one file to determine what (shipping or product cost) is being collected by WePay. It appears that the information being transmitted to WePay is captured in a class definition that defines the variable type WePay (See the line that says $wepay = new WePay($access_token); ?) There may also be something related to the line before that: Wepay::$whattouse($client_id, $client_secret); but I'm not familiar with that syntax to identify where/what that is/does.

Is there a link to be able to obtain this plug-in/additional code?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

27 Nov 2013, 1:27 PM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: I am using we pay and the shipping is not being collected..

noppie:

can anyone help.. ... is anyone using this plug in.

Couple of things.

  1. looks like you haven't updated your wepay software. There is a version 2.0 out there, that includes more options.
  2. Wepay offers to include shipping fees into the amount requested. I haven't found the ZC variable that represents the calculated shipping fee yet; however, you would need to add a line similar to this in the shopdirectory/includes/modules/payment/wepay_checkout.php file in the pre_confirmation_check() function as part of the

code that starts:

    try {
      $checkout = $wepay->request('/checkout/create', array('account_id' => $account_id ,       // ID of the account that you want the money to go to

Recommend that somewhere before the last line you add:

                                  'shipping_fee' => $ShippingFeeAmount ,       // The variable ShippingFeeAmount is generically provided here and needs to be replaced by the variable that represents ZC's calculated shipping fee.  More to follow if someone doesn't provide an answer here faster than I can find it.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

27 Nov 2013, 2:17 PM
#5
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: I am using we pay and the shipping is not being collected..

mc12345678:

Couple of things.

  1. looks like you haven't updated your wepay software. There is a version 2.0 out there, that includes more options.
  2. Wepay offers to include shipping fees into the amount requested. I haven't found the ZC variable that represents the calculated shipping fee yet; however, you would need to add a line similar to this in the shopdirectory/includes/modules/payment/wepay_checkout.php file in the pre_confirmation_check() function as part of the

code that starts:

try {
  $checkout = $wepay->request('/checkout/create', array('account_id' => $account_id ,       // ID of the account that you want the money to go to
> 
> Recommend that somewhere before the last line you add:
> 
> ```
                                  'shipping_fee' => $ShippingFeeAmount ,       // The variable ShippingFeeAmount is generically provided here and needs to be replaced by the variable that represents ZC's calculated shipping fee.  More to follow if someone doesn't provide an answer here faster than I can find it.

On second thought, it looks like version 2 includes $orderamount = $order->info['total'] and by review of ZC code, it appears that $order->info['total'] is = $order->info['sub_total'] + $order->info['shipping_cost'], but if under version 2.0 your customer(s) are not being charged the shipping fee(s) at this point in the process of making the payment then the variable $orderamount should have $order->info['shipping_cost'] added to it.

But with the new version of WePay, you should be covered now... If you would like to provide the purchaser more information on WePay then in the above you can keep the variable that I defined, but before the "try { " statement add:

$ShippingFeeAmount = $order->info['shipping_cost']

Personally, I would think that should be passed to WePay anyways so that the customer is able to see on WePay what the different costs are that make up the total. WePay expects to receive the total dollar amount that the customer is being charged, so this additional statement does not appear that it will affect the total dollar amount, only that WePay will be able to identify that a fee had been applied. (Didn't dig deeply into the API documentation to identify the truth of that, but deduced it from https://www.wepay.com/developer/reference/checkout#create).

Good luck, hope that you got your software updated.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

5 Dec 2013, 3:08 AM
#6
noppie avatar

noppie

Zen Follower

Join Date:
Mar 2004
Posts:
210
Plugin Contributions:
0

Re: I am using we pay and the shipping is not being collected..

Hello mc12345678 thank you so much.. it worked adding the shipping info..it now collects the shipping.. thank you so much.. noppie

mc12345678:

On second thought, it looks like version 2 includes $orderamount = $order->info['total'] and by review of ZC code, it appears that $order->info['total'] is = $order->info['sub_total'] + $order->info['shipping_cost'], but if under version 2.0 your customer(s) are not being charged the shipping fee(s) at this point in the process of making the payment then the variable $orderamount should have $order->info['shipping_cost'] added to it.

But with the new version of WePay, you should be covered now... If you would like to provide the purchaser more information on WePay then in the above you can keep the variable that I defined, but before the "try { " statement add:

$ShippingFeeAmount = $order->info['shipping_cost']

> 
> Personally, I would think that should be passed to WePay anyways so that the customer is able to see on WePay what the different costs are that make up the total.  WePay expects to receive the total dollar amount that the customer is being charged, so this additional statement does not appear that it will affect the total dollar amount, only that WePay will be able to identify that a fee had been applied.  (Didn't dig deeply into the API documentation to identify the truth of that, but deduced it from <https://www.wepay.com/developer/reference/checkout#create>).
> 
> Good luck, hope that you got your software updated.

My Multi_Site Zen Carts
http://herasonlinemarket.com