XEM THỐNG KÊ ĐIỂM CHUẨN VÀO LỚP 10 CÁC TỈNH
I'm not sure if this is the correct place to post this, please let me know if so, but I am well and truly stuck.
I need to set up payments through PayPal, that will take the user from the site to PayPal to pay, then, once paid, redirect back to the site to then download the purchased file.
Is this doable via PayPal? Been through their docs and can't work it out.
Also, is it possible to encrypt the download link to protect it being shared?
Sorry if this is the wrong place.
many thanks for any help in advance


Sure, you can use PayPal's IPN service to permit the download once payment has been confirmed.
  • 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
That's usually the, very rough, gist of it.
<?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



Hi Si,
If you don't want to have to write and manage the code for this yourself, you can use a pre-built off the shelf solution for your digital download store which works with your PayPal account to take the payments but handles the secure delivery of the files to your customer. I have used this 3rd party digital download service before and it is a real time saver and means you avoid ongoing support for your own cobbled together code:


Copy and Paste Buy Now/Add to Cart Buttons to Sell Digital Downloads from your site

Add Download Buy Now Button 

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. 

Confirm Order 

Shopper creates their order and moves through your ShopIntegrator store checkout. 

Secure Payment - Choose How To Pay

Choose How to Pay 
This example shows the shopper checking out through the Pay Pal payment gateway. It could just as easily be any of theother payment processors you want to use for your download store that your ShopIntegrator checkout already has pre-built checkout connectors for. 

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

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

This example shows the Pay Pal page following a completed payment. After 10 seconds, your shopper is then automatically transferred from Pay Pal to your ShopIntegrator account's completed order details page. 

ShopIntegrator Completed Order Details


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

Download Purchased Files 

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. 
Email Receipt & Download Link 

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 VÀO LỚP 10 CÁC TỈNH

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


Subscribe to: Posts (Atom)


 
Sang kien kinh nghiem HAY - NCKHSPUD HAY ©Email: tailieuchogiaovien@gmail.com. All Rights Reserved. Powered by >How to best
Link:Bantintuvan|tailieusupham|khoahocsupham|Soidiemchontruong|inluon|Tài liệu|Xuất ngoại Nhật|Travel-Du lịch|Tử vi|Science
Top