phpCOIN

Forum Rules Miscellaneous Add-Ons

For questions and issues dealing with miscellaneous add-ons that do not warrant their own forum, including questions about non-existant addons.

Pages: (6) 1 [2] 3 4 ... Last » ( Go to first unread post ) Reply to this topicStart new topicStart Poll

> how do I integrate JAM Phpcoin and paypal? Please
mike-sol
Posted: August 05, 2009 06:47 am
Quote Post


Advanced Member
***

Group: Members
Posts: 126
Member No.: 3,910
Joined: July 22, 2009



Progress....

I have all following API's turned on:

API Output Enable: Trans Created
API Output Enable: Trans Deleted
API Output Enable: Order COR Proc
API Output Enable: Order Created
API Output Enable: Order New Client
API Output Enable: Order New Domain
API Output Enable: Order Out Proc
PI Output Enable: Order Return Proc

Think I could turn some of them off too?

All others off.


My bank paylink is (without image tag):

CODE
<table cellspacing="10" cellpadding="10">
 <tr>
   <td> <form method="POST" action="mod.php">
       <input type="hidden" name="mod" value="orders">
       <input type="hidden" name="mode" value="return">
       <input type="hidden" name="transfer" value="1">
       <input type="hidden" name="item_name" value="<prod_desc>">
       <input type="hidden" name="item_number" value="<prod_id>">
       <input type="hidden" name="currency_code" value="EUR">
       <input type="hidden" name="amount" value="<total_amt>">
 <input type="hidden" name="invoice" value="<invoice_id>">
       <input type="submit" value="confirm" name="confirm">
     </form></td>
   <td> </td>
   <td> <form method="POST" action="mod.php">
       <input type="hidden" name="mod" value="orders">
       <input type="hidden" name="mode" value="return">
       <input type="hidden" name="transfer" value="0">
       <input type="submit" value="Cancel" name="cancel">
     </form></td>
 </tr>
</table>


I have my "Duplicate Transaction Monitor in Minutes" in JAM turned off.

Payments and refunds are being processed and refunded in phpcoin and in JAM.

All seems to be going as it should and no duplicates :-)

Although I see "none" at the bottom left of my centre module after a payment has been made.

"ooh there is just one more thing..." (I sound like columbo here:)

This is for "nimasdj" as I know you other guys not into JAM.

The transaction id in my jam shows the paypal id for paypal transactions, that's cool.

When I was doing the image tag in the paylink I had set it to show order and invoice number in the JAM transaction id.

QUOTE
trans_id=bt_o_<order_id>_i_<invoice_id>


So a transaction ID would show bt_o_5_i_7

It was a bank transfer order number 5 and invoice number 7


Now the transaction ID in JAM refers to the phpcoin order number only.

As I will pay commissions based on actual invoices paid I would like JAM to show the invoice number in the transaction ID rather than the order number.

If I can get both in there as before even better but I'll be happy with just the invoice number.

Thanks again

Regards

Mike

PMEmail Poster
Top
mike-sol
Posted: August 05, 2009 07:57 am
Quote Post


Advanced Member
***

Group: Members
Posts: 126
Member No.: 3,910
Joined: July 22, 2009



I guess it's somewhere here but not sure of what to add and how.

CODE
if ($_APIO_AData['transfer'] == '1' || $_APIO_AData['cheque'] == '1') {
 $JAMIntegrate = file_get_contents("http://www.yourdomain.com/affiliates
  /sale.php?amount=".$_APIO_AData['ord_unit_cost']."&trans_id=".$_APIO_AData['ord_id']
  ."&custom_mid=".$_COOKIE['jrox']."");
}



I thought I figured it out...

In API.php I changed this: "&trans_id=".$_APIO_AData['ord_id']."

to this: "&trans_id=".$_APIO_AData['it_invc_id']."

and Jam did not even log the commission.

Changed it back and it is not logging commissions at all now.

Crikey how do I fix it now?

Mike

"a little knowledge is dangerous"


PMEmail Poster
Top
nimasdj
Posted: August 05, 2009 09:10 am
Quote Post


Advanced Member
***

Group: Members
Posts: 510
Member No.: 6
Joined: August 26, 2006



You only need to turn on "API Output Enable: Order Return Proc" for this.
I assume you don't want to use JAM auto-signup. If you want to use this too, turn on "API Output Enable: Order New Client" as well. any other api can be off.

To remove "none", find the function in api.php:

CODE
function APIO_order_ret_proc($_APIO_AData) {


and comment the line:

CODE
 //$_APIO_Ret['msg'] = 'none';


Assuming you are going to turn of any other API, no need to comment the line above in other functions.

To use invoice id instead of order id as jam transaction id:

replace this in the function:

CODE
                   $JAMIntegrate = file_get_contents("http://www.yourdomain.com/affiliates/sale.php?amount=".$_APIO_AData['ord_unit_cost']."&trans_id=".$_APIO_AData['ord_id']."&custom_mid=".$_COOKIE['jrox']."");


with this one:

$JAMIntegrate = file_get_contents("http://www.yourdomain.com/affiliates/sale.php?amount=".$_APIO_AData['ord_unit_cost']."&trans_id=".$_APIO_AData['invoice_id']."&custom_mid=".$_COOKIE['jrox']."");

I don't recall if invoice_id is a valid $_APIO_AData array element, or it was inv_id or what. cantex, please correct me here.

If you want both order and invoive for exampke in this format: orderid_invoiceid
you could use:

$JAMIntegrate = file_get_contents("http://www.yourdomain.com/affiliates/sale.php?amount=".$_APIO_AData['ord_unit_cost']."&trans_id=".$_APIO_AData['ord_id']."_".$_APIO_AData['invoice_id']."&custom_mid=".$_COOKIE['jrox']."");


--------------------
:: My Contributions to phpCOIN:
:: Geographic whois
:: JAM Integration

If you need help/assistance for phpCOIN and/or addon modules installation. Please read here.

Affiliate marketing is the best way to attract clients for your hosting. Why not starting an Affiliate Program with your phpCOIN? please read here.
PMEmail Poster
Top
mike-sol
Posted: August 05, 2009 10:29 am
Quote Post


Advanced Member
***

Group: Members
Posts: 126
Member No.: 3,910
Joined: July 22, 2009



For the API to trigger in jam I have to have last two API's on:

API Output Enable: Order Out Proc
API Output Enable: Order Return Proc

If only one is on, either one the commission will not trigger in JAM

One is for displaying the paylink and one for clicking the paylink!

Have tested all ways and that's what I get.

As long as it works that's ok for me
PMEmail Poster
Top
nimasdj
Posted: August 05, 2009 10:41 am
Quote Post


Advanced Member
***

Group: Members
Posts: 510
Member No.: 6
Joined: August 26, 2006



No, If you look at api.php, you'll see "API Output Enable: Order Out Proc" has nothing to do with JAM but "API Output Enable: Order Return Proc" only.

If it doesn't work you for you with "API Output Enable: Order Out Proc" off, then something else might be wrong. Cantex will help you more why this is not working for you with "Order Out Proc" off.

now, everything is working fine for you, and transaction id is shown how you want?
commission and everything is working as expected with no image tag within paylink form and only with api.php?



--------------------
:: My Contributions to phpCOIN:
:: Geographic whois
:: JAM Integration

If you need help/assistance for phpCOIN and/or addon modules installation. Please read here.

Affiliate marketing is the best way to attract clients for your hosting. Why not starting an Affiliate Program with your phpCOIN? please read here.
PMEmail Poster
Top
mike-sol
Posted: August 05, 2009 12:33 pm
Quote Post


Advanced Member
***

Group: Members
Posts: 126
Member No.: 3,910
Joined: July 22, 2009



Yes I see that in api.php

Earlier today I ran test payments through and some commissions came through to jam and some did not.

OK I just set "API Output Enable: Order Return Proc" as the ONLY enabled API in phpcoin.

I made one test payment by bank transfer via affiliate ID30 to phpcoin user account "testuser". All was ok and commission is in JAM.

A few minutes later using the same affiliate link I made another test payment by bank transfer to phpcoin to the same user account "testuser". This time the commission did not show up in JAM.

The transaction ID's (in this case order numbers) are different and I have "Duplicate Transaction Monitor" in JAM turned off. So I cannot think of any reason why the first commission makes it to JAM and the second does not.

Is there a reason that maybe I am not aware of?

Thanks

Mike

I just created another affiliate in JAM and made a fresh sale in phpcoin to the same user account. The sale completed but again the commission has not shown up in JAM.

If I switched on some other API's I would get some commissions go through.

Its all very unpredictable.

PM me and you can login and take a look.



PMEmail Poster
Top
cantex
Posted: August 05, 2009 02:31 pm
Quote Post


Chief Cook & Bottle Washer
***

Group: Archive
Posts: 3,252
Member No.: 1
Joined: August 25, 2006



API Output Enable: Order Return Proc -> is only triggered is a user clicks on the "return to vendor website" link after making a payment. They are then returned to our site and the API is triggered.

If they do NOT "return to vendor" then they are not returned to our site and the API would never be triggered. This is why we use IPN for PayPal payments, instead of relying on the customer to "return".


API Output Enable: Order Out Proc -> is triggered when the customer is *shown* the paylink. They may or may not proceed to pay, so it is not wise to calculate a commission at this point in time.


API Output Enable: Trans Created -> is called whenever a transaction (invoice/payment/etc.) is created. It does not matter whether the transaction is from IPN or from order/order-return or from invoice/payment applied manually by an admin, so it is a very accurate way of determining when a payment has been applied ~ and would be excellent for calculating a commission such as JAM.


Switching on other APIs is a waste of time *unless you have code within the relevant function(s) in the api.php file*.
IF an API is switched ON, then when the specific action occurs phpCOIN will call the relevant function in api.php
By default, the relevant function would only return a string to let us know that something happened. NO processing of any type would occur because no code was there to be processed.

This is why we say to only turn on the necessary API calls ~ no need to slow phpCOIN down by making calls to functions that do absolutely nothing.




--------------------
================================================================
Please do not email or PM me with a question:
1: I handle over a thousand emails a day, so chances are yours would be buried in the pile.
2: All questions will only be answered in the support forums, so the answers will be useful to others.

Help will be given to install/configure/use phpCOIN, but not programming help to modify phpCOIN operations. If you are competent enough to make programming changes, you should be competent enough to read the source code and figure things out :)

If you are trying to integrate posted sample code into your website, please take into account any changes in phpCOIN made after the code sample was posted. It is discouraging to spend hours answering questions or trying to track down an issue only to find that the user has a version of phpCOIN that makes the sample irrelevant
PM
Top
nimasdj
Posted: August 05, 2009 05:23 pm
Quote Post


Advanced Member
***

Group: Members
Posts: 510
Member No.: 6
Joined: August 26, 2006



in JAM admin area, there is an option to whether overwrite on old cookie or not. When you click an affiliate link a cookie will be set to track the sale when you created the second url to test, it was not working because no new cookie was set/overwrite on the old cookie so no commission.... If you want to use new affiliate cookie turn that option on JAM admin area.

QUOTE
The transaction ID's (in this case order numbers) are different and I have "Duplicate Transaction Monitor" in JAM turned off. So I cannot think of any reason why the first commission makes it to JAM and the second does not.


probably the cookie was expired or deleted. check how long you did setup affiliate cookie for.

It seems you've done integration with your phpCOIN and this sort of questions belongs to jam support forums and not here! smile.gif


--------------------
:: My Contributions to phpCOIN:
:: Geographic whois
:: JAM Integration

If you need help/assistance for phpCOIN and/or addon modules installation. Please read here.

Affiliate marketing is the best way to attract clients for your hosting. Why not starting an Affiliate Program with your phpCOIN? please read here.
PMEmail Poster
Top
mike-sol
Posted: August 06, 2009 11:07 am
Quote Post


Advanced Member
***

Group: Members
Posts: 126
Member No.: 3,910
Joined: July 22, 2009



I have it figured out.

I have had all along "Overwrite Existing Affiliate Cookie" set to yes in JAM.

The cookie is picked up every time as am showing it in my footer that I set to check for this.

My JAM settings are:
Affiliate tracking is set on cookie, ip address and session.
Cookie timer is set to 1 year
"Enable Duplicate Transaction Monitoring" is disabled.


One of the problems has been complicated because I have had "affiliate tracking" set to not just "cookie" but, "ip address" and "session" too. And when not clearing "cookies", breaking the "session" or changing "IP address" the affiliate data has been sticking!

Which has been confusing the life out me as where the problem was.

So I set "Affiliate tracking" to "cookie" only while testing and all seems to be going ok.

I tried to set the API Output Enable: Trans Created because as Cantex said its more accurate.

I updated api.php and moved the jam integration code in the section to:


/**************************************************************
* API Output (APIO) Trigger: APIO_trans_new ($_APIO_AData)
* Notes-
* - Trigger admin editing transactions / payments.
* - Fires on new transaction inserted into database.
* Scope is during admin editing.
**************************************************************/

But could not get it to work.

Reading that above maybe its because "Scope is during admin editing" and not when ordering. Or maybe I got the wrong API or I got something wrong somewhere else.

Anyway I have it set to one API which is "API Output Enable: Order Return Proc" and it triggers the commission when I click confirm on the paylink. That's ok for me.

I guess when I'm done testing and I'm confident that it logs all affiliate commissions I can reset "Affiliate tracking" back to all three: cookie, ip address and session.

Now I can see how it all works it all makes a lot of sense, but when you are in the dark trying to figure it out it's a headache.

"nimasdj" gave me a clue in the last post when he mentioned "cookie".

and

"It seems you've done integration with your phpCOIN and this sort of questions belongs to jam support forums and not here!"

My configuration was not correct in phpcoin because I had multiple API's set. Because of the "affiliate tracking" set too strong in JAM I could not see where I was going wrong. I would not have understood these API's and how they worked unless I had asked the questions here on this board and then received the helpful answers from you guys.

I understand that no one wants to support the other guy's product but when you have two programs talking to each other with these API's and the user is trying to get them to communicate then the questions have to be asked somewhere.

As "nimasdj" seems to be the main man with know how of getting phpcoin and JAM together then "here" seems a good place to ask.

I have posted on the JAM forum and the responses are very slow.

So thanks to you guys in having some patience and I appreciate your help.

Regards

Mike

It all seems to be working for now :-)

There is one more thing though...

I'll sleep on it for a while eh?
PMEmail Poster
Top
nimasdj
Posted: August 06, 2009 11:25 am
Quote Post


Advanced Member
***

Group: Members
Posts: 510
Member No.: 6
Joined: August 26, 2006



I think the "API Output Enable: Trans Created" switch relates to APIO_trans_new in api file. cantex would correct me. You can copy/paste the complete modified APIO_trans_new function here that I see why the jam is not working here.

cantex, tell me if
$_APIO_AData['ord_unit_cost'] and
$_APIO_AData['ord_id'] and
$_APIO_AData['invoice_id']
are available within APIO_trans_new function as I don't have time to test it.


--------------------
:: My Contributions to phpCOIN:
:: Geographic whois
:: JAM Integration

If you need help/assistance for phpCOIN and/or addon modules installation. Please read here.

Affiliate marketing is the best way to attract clients for your hosting. Why not starting an Affiliate Program with your phpCOIN? please read here.
PMEmail Poster
Top
nimasdj
Posted: August 06, 2009 11:28 am
Quote Post


Advanced Member
***

Group: Members
Posts: 510
Member No.: 6
Joined: August 26, 2006



cantex, also tell me if APIO_trans_new function will be called only when an invoice is set as paid?


--------------------
:: My Contributions to phpCOIN:
:: Geographic whois
:: JAM Integration

If you need help/assistance for phpCOIN and/or addon modules installation. Please read here.

Affiliate marketing is the best way to attract clients for your hosting. Why not starting an Affiliate Program with your phpCOIN? please read here.
PMEmail Poster
Top
mike-sol
Posted: August 06, 2009 11:48 am
Quote Post


Advanced Member
***

Group: Members
Posts: 126
Member No.: 3,910
Joined: July 22, 2009



Just been thinking over this from Cantex's post: API Output Enable: Trans Created

Maybe the API's triggered when a bank transfer is paid by admin this would make sense and be a better way to set a commission rather than just on order placed from a paylink.

I'll try it out.

Just read the post above and setting a payment as paid is not the same as making the payment.

I think.

This post has been edited by mike-sol on August 06, 2009 11:50 am
PMEmail Poster
Top
mike-sol
Posted: August 06, 2009 12:04 pm
Quote Post


Advanced Member
***

Group: Members
Posts: 126
Member No.: 3,910
Joined: July 22, 2009



No it did'nt work.

I change the API to "API Output Enable: Trans Created"

Moved the JAM code to below:

QUOTE
/**************************************************************
* API Output (APIO) Trigger: APIO_trans_new ($_APIO_AData)
* Notes-
*  - Trigger admin editing transactions / payments.
*  - Fires on new transaction inserted into database.
*    Scope is during admin editing.
**************************************************************/
function APIO_trans_new($_APIO_AData) {
# Get security flags
  $_SEC = get_security_flags ( );

# Dim some Vars
  global $_CCFG, $_TCFG, $_DBCFG, $_UVAR, $_LANG, $_SERVER, $_nl, $_sp;

# Do whatever, set returns


Sent an affiliate link, placed a bank transfer order. Then logged in as admin and used the payment button on bottom menu of invoice and this marked the invoice as paid but it not not set a commission in JAM

That would have been real cool if it did.

PMEmail Poster
Top
cantex
Posted: August 06, 2009 12:36 pm
Quote Post


Chief Cook & Bottle Washer
***

Group: Archive
Posts: 3,252
Member No.: 1
Joined: August 25, 2006



QUOTE
Maybe the API's triggered when a bank transfer is paid by admin this would make sense and be a better way to set a commission rather than just on order placed from a paylink.

Yes.


QUOTE
I change the API to "API Output Enable: Trans Created"
Moved the JAM code to below:.....
Sent an affiliate link, placed a bank transfer order. Then logged in as admin and used the payment button on bottom menu of invoice and this marked the invoice as paid but it not not set a commission in JAM

When the transaction was processed, if the master APIO switch AND the "API Output Enable: Trans Created" werre both enabled, then phpCOIN would have called whatever code was in APIO_trans_new()

SO.......
Two things to check.
1: add some text to be returned to the calling function. This will ensure that the API is getting called.

2: show us the complete APIO_trans_new() with your JAM code inserted



To nima:
We are NOT at the order stage.
So in this case (bank payment), we would NOT have ord_xxxxx available.
invoice_id would be available only if it was part of the paylink.
Remember that API is only what is in scope


--------------------
================================================================
Please do not email or PM me with a question:
1: I handle over a thousand emails a day, so chances are yours would be buried in the pile.
2: All questions will only be answered in the support forums, so the answers will be useful to others.

Help will be given to install/configure/use phpCOIN, but not programming help to modify phpCOIN operations. If you are competent enough to make programming changes, you should be competent enough to read the source code and figure things out :)

If you are trying to integrate posted sample code into your website, please take into account any changes in phpCOIN made after the code sample was posted. It is discouraging to spend hours answering questions or trying to track down an issue only to find that the user has a version of phpCOIN that makes the sample irrelevant
PM
Top
mike-sol
Posted: August 06, 2009 12:50 pm
Quote Post


Advanced Member
***

Group: Members
Posts: 126
Member No.: 3,910
Joined: July 22, 2009



I have these API settings set to YES:

QUOTE
API Output Enable: API System Activated
YES: The individual API Output functions enabled are allowed to trigger
NO: Regardless of the individual API settings, no API functions will be triggered


and

QUOTE
API Output Enable: Trans Created
If the API Output function is called when a transaction record (invoice, payment, etc.) is created



APIO_trans_new()

CODE
/**************************************************************
* API Output (APIO) Trigger: APIO_trans_new ($_APIO_AData)
* Notes-
*  - Trigger admin editing transactions / payments.
*  - Fires on new transaction inserted into database.
*    Scope is during admin editing.
**************************************************************/
function APIO_trans_new($_APIO_AData) {
# Get security flags
 $_SEC = get_security_flags ( );

# Dim some Vars
 global $_CCFG, $_TCFG, $_DBCFG, $_UVAR, $_LANG, $_SERVER, $_nl, $_sp;

# Do whatever, set returns

// Added by nimasdj for JAM integration
               // Do edit http://www.yourdomain.com/affiliates below to your JAM installation URL
               // This php block works for both Wire Transfer and cheque payment options on return page.
               // Consult manual at http://docs.phpcoin.com/index.php/JAM_Affiliate_Tracking for more details.
               if ($_APIO_AData['transfer']== '1' || $_APIO_AData['cheque']== '1') {
                   $JAMIntegrate = file_get_contents("http://www.mydomain.com/affiliates/sale.php?amount=".$_APIO_AData['ord_unit_cost']."&trans_id=".$_APIO_AData['ord_id']."&custom_mid=".$_COOKIE['jrox']."");
               }
               // End of JAM integration

 $_APIO_Ret['dn'] = 1;
 $_APIO_Ret['msg'] = 'none';

# Return output
 return $_APIO_Ret;
}


QUOTE
add some text to be returned to the calling function. This will ensure that the API is getting called.
not sure what to do there?
PMEmail Poster
Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:

Topic OptionsPages: (6) 1 [2] 3 4 ... Last » Reply to this topicStart new topicStart Poll

 


Inscrita el Registro Mercantil de Mallorca Tomo 2140, Hoja No. PM-51034, Folio 135
This website owned and operated by: Technology Services RPVW S.L. CIF# B57345084
Avda Constitucion 48 Bajos Alaro 07340 Baleares SPAIN
Tel:+34 971518362    Fax: +34 971518368    eMail: support@phpcoin.com