php


How to complete a shopping application? [closed]


I've read many many guides and tutorials on how to make a shopping application, the only one thing they never covered is how to preform the actual checkout, how to charge the user's credit card/paypal after the checkout.
So can anyone point me to the right direction with this one? How do I preform a complete checkout, charging the user's provided credit card/PayPal account, verifying the payment, and then returning a result (success/fail) back to the user?
Thanks in advance.
For completing the transaction, you'll need separate methods for each payment. For PayPal, you'll need to integrate with your API, and the same with google. For normal credit card transactions, you'll need to hook up with a Payment Gateway. You may wish to look at Authorize.net. They're large and well established.
You'll need to look at the gateway and determine if it meets your needs for business flow, as well as their API for communication (SOAP, XML-RPC, REST, etc).
Aside from them, a few other popular transaction gateways are:
1800Pay
2Checkout.com
2Checkout.com 2.0
381808
Accesspoint
Atlantic-Pacific Processing
BeanStream Gateway
Bluefin Gateway
BluePay 2.0
Braintree Payment Solutions
Broadpay
CCBill
Chargeback Guardian Gateway
Check21.com
CheckGateway.com
ChronoPay
ClearCommerce
Comstar Gateway
Concord EFSnet 2.4
CyberSource
DalPay
DHD Media
Direct Payment Solutions
Durango
E-Commerce Exchange Pro
eAccounts Gateway
ECHO
EcorePay Gateway
Enterpayment
eProcessingNetwork
Evoke 360
eWay
Fast Charge
FASTeCom
FastTransact
FirePay
First Data Global Gateway
Gate2Shop
Global Electronic Technology Gateway
GoEmerchant
Group ISO Gateway
Impact Payments
Innovative Gateway
Instabill Gateway
IntelliPay
Internet Secure
Iongate
iTransact
LinkPoint Gateway
LiveMerchant.com
LUCY Gateway
Merchant e-Solutions Gateway
MerchantWarehouse.com
Modern Payments
Moneris e-Select Gateway
Moneris e-Select Plus
Moneris e-Select Plus US
MSC
MultiCards
NET1
Netbilling
Network Merchants Gateway
NobelPay Gateway
Novapointe
Optimal Payments
PacNet Services Raven
PayByCheck
PayDollar
PayJunction
Paymentech
Payments Gateway
Payovation Gateway
PayPal PayFlow Pro
PayTrace
Plug N Pay
ProPay Gateway
Protx VPS Direct
PsiGate
Quantum Payment
QuickBooks Merchant Services
ReoPay
Sage Payments
SecureNet
SecurePay
SkipJack
Transact24
Transaction Central
Transaction Pro
TransFirst eLink Gateway
UltraCart Test Gateway
US Financial Services Group
USA ePay
Verepay
Verifi Gateway
VeriSign PayFlow Link
viaKlix 2
Virtual Merchant
VPG
WorldPay
WorldPay Direct
YourPay Connect
ZipZap
http://developer.paypal.com should have piles of documentation regarding how IPN and its other payment gateway services work.
I would use Paypal or Google Wallet if you are not handling credit card details through the site. If you are planning to use something like Barclays or HSBC merchant services then you are going to need to become PCI compliant with Security Metrics. You'll also need to make sure that you have an SSL certificate installed etc. For more details... https://www.securitymetrics.com/
You can utilise the Paypal API and send the details back to a process page on your server.
In Paypal account you can specify the return url for the IPN... This might be https://
Here's an example of a process page sending to Paypal. This is using the native HTML format.
/// actual url
$formurl = "https://www.paypal.com/cgi-bin/webscr";
$business = "Your email";
}
?>
<form name="client_details_form" id="client_details_form" method="post" action="<?php echo $formurl; ?>" accept-charset="utf-8" >
<h1 id="message_main_message"></h1>
<?php if($_POST['checkout_type'] == "paypal"){ ?>
<input type="hidden" name="business" value="<?php echo $business; ?>">
<input type="hidden" name="upload" id="upload" value="http://www.hlandhlantiquities.com/index.php?page=send_recieve_cart" />
<input type="hidden" name="cmd" value="_cart" />
<!-- standard type <input type="hidden" name="cmd" value="_cart" />
webstuff <input type="hidden" name="cmd" value="_cart" />
-->
<input type="hidden" name="currency_code" value="GBP" />
<input type="hidden" name="email" value="<?php echo $client_email; ?>" />
<input type="hidden" name="RETURNURL" value="returnurl/index.php?page=send_recieve_cart" />
<input type="hidden" name="CANCELURL" value="cancelurl/index.php?page=send_recieve_cart" />
<!-- for updating client transactions... list the trasaction id and the client and session -->
<input type='hidden' name='custom' value='<?php echo $_SESSION['userid']; ?>|<?php echo $_SESSION['transaction_id']; ?>|<?php echo $_SESSION['PHPSESSIONID']; ?>|<?php echo $discount_id; ?>'>
<input type='hidden' name='invoice' value='<?php echo $_SESSION['uniqueid']; ?>'>
<?php if ($discount_value > 0) { ?>
<p style="color:red;" ><?php echo $client_message; ?></p>
<?php } ?>
while($row = mssql_fetch_assoc($query_transaction)) {
if($_POST['checkout_type'] == "paypal"){
echo '<input type="hidden" name="transaction_item_id_' . $count . '" id="transaction_item_id_' . $count . '" value="' . $row['transaction_item_id'] . '" />';
echo '<input type="hidden" name="antiquity_id_' .$count . '" id="antiquity_id_' . $count . '" value="' . $row['ID'] . '" />';
if($av_discount > 0) {
echo '<input type="hidden" name="amount_' .$count . '" id="amount_' . $count . '" value="' . round(($row['current_price']-$av_discount),2) . '" />';
} else {
echo '<input type="hidden" name="amount_' .$count . '" id="amount_' . $count . '" value="' . $row['current_price'] . '" />';
}
echo '<input type="hidden" name="item_name_' .$count . '" id="item_name_' . $count . '" value="' . $row['ItemName'] . '" />';
///echo '<input type="hidden" name="item_number_' .$count . '" name="item_number_' . $count . '" value="' . $row['transaction_item_id'] . '" />';
echo '<input type="hidden" name="custom_' .$count . '" id="custom_' . $count . '" value="' . $row['ID'] . '" />';
$Total += $row['current_price'];
$count++;
}
<input type="submit" name="submit" value="transact" />
Ok so that goes to paypal for every item in your cart you incriment the name by 1 (that's the use of the $count variable)
ONce the user has processed the payment it can send back to the page I split the custom field to identify my transaction and update my database that the items were sold... That page explodes the posted transaction_subject which related to my custom field back into individual parts...
$transitems = explode("|",$_POST['transaction_subject']);
$client_details_id = $transitems[0];
$transaction_id = $transitems[1];
$PHPSESSIONID = $transitems[2];
$discount_id = $transitems[3];
$handler_trans_id = $_POST['txn_id'];
$supplier_email = $_POST['receiver_email'];
$purchaser_email = $_POST['payer_email'];
$date = date('Y-m-d H:i:s');
You can now use this information to update your database.
Hope this is somewhat helpful.
Andi

Related Links

php check if domain equals value, then perform action
How can I implement RSS 2 in Code Igniter?
Error with MySQL syntax using REPLACE INTO
how to store chechbox value in php
mysql muliple queries in one statement
PHP Static Variables
php code analysis
PHP Object Validation
How to use cms systems like drupal and so on for crawl only? [closed]
How do I loop through MySQL results easily?
Accessing Mac applications from Ruby or PHP or Cocoa
How do I run PHP code when a user clicks on a link?
How do you just get the vars in a url using php?
ArrayCollection in PHP
Recursively build XML from PSQL Result Set (using PHP)
How to display weekly(Mon to Sun) data in php and mysql?

Categories

HOME
verification
focus
dotnetnuke
adfs3.0
code-formatting
plpgsql
risk-management
histogram
malware
nsis
mathematical-optimization
openflow
amp
tibco
drag-and-drop
capistrano
wagtail
mailing-list
xades4j
fireloop
slide
fullcalendar-scheduler
live-streaming
freertos
powermock
bnf
pinterest
asciimath
android-custom-view
sharedpreferences
kaggle
jstree
offline-caching
android-cardview
php-5.3
amazon-cloudtrail
tsung
google-play-developer-api
universal
knights-tour
counting
cloveretl
char-pointer
rails-postgresql
buildforge
rdp
icepdf
dagger
notesview
autorelease
scala-breeze
head.js
patternlab.io
dblink
1010
multi-touch
node.js-connect
powerpoint-2013
textblock
seadragon
m4
http.client
gitlab-omnibus
wlanapi
swagger-maven-plugin
mobilefirst-server
python-curses
debug-symbols
symja
vs-unit-testing-framework
aho-corasick
two.js
boolean-algebra
usb-flash-drive
strdup
armv6
django-settings
discovery
donut-chart
icenium
ip-geolocation
spark-view-engine
taskkill
monocross
prototypal-inheritance
netstream
boost-foreach
datacontracts
sql-parametrized-query
airprint
mongrel2
odac
icicles
getimagesize
firephp
jquery-effects
downcasting
autobench
suggestbox
chronic

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App