From PhpCOIN Documentation
Using 2Checkout as a payment method is a simple process:
- Goto http://www.2checkout.com and set yourself up with an account
- Log into phpCOIN on your website as an admin
- Add the vendor
- Add paylinks
Admin -> Vendors
If 2Checkout exists in the list of available vendors, you can simply edit the existing record. If it does not exist, then click [Add New] to add 2Checkout as a payment method that you will accept. The info should look like the following:
Vendor ID: (will be auto-completed by phpCOIN) Status: On (Off to disable this payment method) Vendor Name: 2Checkout (for the drop-down lists) Buy Return Param Name: credit_card_processed (IMPORTANT) Buy Return Param Value: Y (IMPORTANT) URL / Website: http://www.2checkout.com Use IPN: No Notes:
Admin -> PayLinks
Select the PayLink you want to edit, or click [Create New] to create a new one. Paste the following code into the order link, changing the parameters shown in bold:
Vendor Product Id: (Auto-created by phpCOIN) Vendor ID: (From the drop-down, choose "2Checkout") Product ID: (From the drop-down, choose the product that this paylink applies to) Description: 2Checkout Product x (for listing) Order Link: (This is for the "pay link" html provided by 2Checkout, such as: <form action="https://www.2checkout.com/2co/buyer/purchase" method="post"> <input type="hidden" name="id_type" value="1"> <input type="hidden" name="sid" value="XXXXX"> <input type="hidden" name="c_prod" value="YYYYY"> <input type="hidden" name="c_name" value="<prod_name>"> <input type="hidden" name="c_description" value="<prod_desc>"> <input type="hidden" name="c_price" value="<prod_unit_cost>"> <input type="hidden" name="c_tangible" value="N"> <input type="hidden" name="cart_order_id" value="<order_id>"> <input type="hidden" name="total" value="<total_amt>"> <input type="submit" value="Click to pay thru 2CheckOut"> </form>
In the above link, the <> tells phpCOIN that it should replace the tag name with the actual value at run-time. It means that you could move your site to another URL entirely but would not need to adjust your paylinks. XXXXX is your 2Checkout SID, and YYYYY is the product_id as stored on 2Checkout website.
For 2Checkout you enter return URL's at 2Checkout, so only use:
or https://my.phpcoin.com/mod.php?mod=orders&mode=return as appropriate to your site. Other fields are passed from 2Checkout to determine if the sale was completed or canceled.
An important note: Once your account at 2Checkout is set up, login to their site at https://www.2checkout.com/va/home/ and go to Account -> Site Management and set Direct Return to "Given links back to my site". The direct return option will NOT work with phpCOIN due to the way it operates.
Lather, Rinse, Repeat
Repeat the above steps as many times as necessary, so that you end up with one PayLink for each product or service that will allow 2Checkout as a payment method.
Using 2Checkout's INS with the phpCOIN IPN system
Admin -> Parameters -> Group: All SubGroup: IPN
In order to use the IPN system, there are parameters in phpCOIN that must be set:
IPN: Accept IPN data: Yes IPN: Invoice Find Method: (Your choice. I use 4.) IPN: Process Incoming Data: Yes IPN: Require receiving amount to match invoice: (Your choice. I set this to No.) IPN: Send transaction ack email: (Your choice. I set this to Yes.) Select invoice by name: Yes 2Checkout: INS Secret Word: (Match what you set in your 2CO account at Account Tab -> Site Management.) 2Checkout: Vendor ID: (Your 2CO Vendor ID)
There are many other options that can be set. These are just the minimum settings for 2CO.
Configure Your 2CO Account
Login to your 2CO account and navigate to the INS page of your vendor area:
Account Tab -> Notifications
There are several options of what notifications 2CO can send. Turning them all on will clutter your IPN log. Only three (3) are required for the phpCOIN IPN to work properly with 2CO:
- New Order Created
- Fraud Status Changed
- Refund Issued
Check the enable box and set the URL 2CO connects to on each to:
Of course you must substitute the domain and path above to the location of your own phpCOIN installation.
Click "Save Settings" and that's all there is to it. Your system should start processing payments. Enjoy!