- Create a database record, indicating purchased file, hashing users IP and browser agent, add a cookie too
- Send to PayPal for payment
- Provide user a unique URL for this download
- Once payment has been confirmed, enable download in database for set period of time
<?php
/*
Get the download where the browser and ip is the
same as the user who paid, and has the cookie value,
and is paid for, and where the number of downloads
is less than or equal to 2.
*/
$sql = sprintf(
"SELECT
file
FROM
purchases
WHERE
paid = 1
AND
ua = '%s'
AND
ip = '%s'
AND
hash = '%s'
AND
downloads <= 2;",
mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']),
mysql_real_escape_string($_SERVER['REMOTE_ADDR']),
mysql_real_escape_string($_COOKIE['hash'])
);
This class is usefull to process Instant Payment Notification (IPN) from Paypal.
See www.paypal.com for more information about IPN.
Note : This class requires cURL PHP module.
So... how should I use this ? This requires that:
a) you already know what IPN is
b) you setup your Paypal account so that IPN are sent to a URL on your website
In this example, let's consider it is http://yourserver.com/backoffice/ipn.php
1) Paypal server posts a request to http://yourserver.com/backoffice/ipn.php
2) Create the IPN object: $pp = new paypal_ipn ();
3) Provide the IPN object with 2 functions: the first one will be called as soon as you receive the post. The second one will be called when Paypal's server
confirms or denies your response.
$pp->set_process_functions ("my_pre_processing", "my_post_processing");
4) Pass the POST table to the Paypal processor
$pp->process_notification ($_POST, true);
5) The "my_pre_processing" function is automatically called
6) The class calls-back Paypal secure server, using cURL and Paypal server
confirms or denies your response.
7) The "my_post_processing" function is automatically called
Copy and Paste Buy Now/Add to Cart Buttons to Sell Digital Downloads from your site
ShopIntegrator makes it easy to copy and paste ecommerce buttons in to your website to turn it in to a download store to sell your e-books, audio tracks, multimedia or any other files.
Shopper creates their order and moves through your ShopIntegrator store checkout.
Secure Payment - Choose How To Pay
People without a Pay Pal account may choose to pay you for their order with a Debit/Credit Card or people with a Pay Pal account may logon to complete their order quickly with a Pay Pal payment.
Secure Payment - Confirm Order and Make Payment
This example shows the shopper using Pay Pal to confirm their order and complete their payment in to your Pay Pal account.
Secure Payment - Purchase Completed
ShopIntegrator Completed Order Details
Your shopper is automatically returned back to your ShopIntegrator store's completed order details page where they may click straight through to download their purchased files.
The shopper is also sent an email with instructions on how to download their purchased files in case they wish to download the purchased files at a later date.
ShopIntegrator Shopper Digital Download Portal
Your Shopper's Digital Download Portal presents all of the files available for download for each of the products they've purchased in their order.
The shopper is able to see how many times you've granted them to download each purchased file in the order and how long you're allowing them before their ability to download expires. You may also show the shopper a message from your store, maybe informing them of special offers or to issue them a discount code to encourage repeat business.
Your shopper will also see any previous orders they've made with you over the last 14 days.
You may optionally send you shopper a receipt email for their order which contains the link to your ShopIntegrator powered digital download portal.
This gives your shopper the flexiblity to return later to download their purchased file or makes it easy for them to download the file on to multiple devices, like their mobile smart-phone (Apple iPhone/Android), their tablet (Apple iPad/Android tablet) and their PC. Providing they are within the constraints you have set for the maximum number of downloads and download expiry date on their purchased files.
Chào mừng bạn đến với
Sáng kiến kinh nghiệm hay
Xem điểm chuẩn lớp 10
Hướng dẫn mua bán BITCOIN => Bấm vào đây
Sách hay bấm vào đây
0 nhận xét Blogger 0 Facebook
Post a Comment
Cám ơn bạn đã phản hồi