How to implement Recurring Payment using Paypal Express Checkout?

Implementing recurring payments or automatic billing for the subscriptions using Paypal’s Express Checkout method is not that much tough.

You just need to follow a series of steps to do so. First of all, You need a website where you want to implement the Recurring Payment functionality using Paypal’s API than Paypal API code for Express Checkout.

Know about Paypal’s recurring payment:

Source Paypal : Handling Recurring Payments – Paypal Documentation

When you are about to support the recurring payment or subscription services on your website using Paypal. You can do so by using Paypal APIs. For every subscription, you need to create a paypal recurring profile that will automatically charge buyer on your behalf.

Please find the below steps that you can use to full fill your dream of implementing Recurring Payment using Paypal Express Checkout:

1. Setting up the Billing Agreement(s) using SetExpressCheckout API call.
2. Redirecting the customer to PayPal for authorization. Customer login & confirms shipping and other details.
3. Redirecting customer to the specified return url passed to SetExpressCheckout in step 1.
4. Call to GetExpressCheckoutDetails to get buyers information (optional). It displays merchant review page for buyer.
5. Call to DoExpressCheckoutPayment in case order contains both one-time purchase as well as recurring payments and response of this might be required in case we have passed some information in step 1 and we want it while making call to CreateRecurringPaymentsProfile
6. Call to recurring payments profile. Call has to be made one time for each recurring payment item included in the order. In response we get profile id if the call is successful.
7. Display the successful transaction page

To know more about how to make call to CreateRecurringPaymentsProfile API.
Call to CreateRecurringPaymentsProfile API

Now, to track the recurring payment events such as recurring_payment, recurring_payment_failed, recurring_payment_profile_cancel, recurring_payment_profile_created, recurring_payment_suspended, etc. you need to create an IPN listener script and link the IPN listener script url to the Paypal IPN Notification URL using your Paypal account. The listener script can be helpful in case you want to track the subscription orders or make entries into database tables.

Sample Response for recurring event transaction type “recurring_payment_profile_created” :

Array ( 
[payment_cycle] => Daily 
[txn_type] => recurring_payment_profile_created 
[last_name] => Ranjan 
[next_payment_date] => 02:00:00 Dec 23, 2014 PST 
[residence_country] => US 
[initial_payment_amount] => 0.00 
[currency_code] => GBP 
[time_created] => 23:36:28 Dec 21, 2014 PST 
[verify_sign] => AJEbti4H39qa7dLkfW98LP0s8gwpAdqBS16waKbMUqckNwnc4ncK8aIH 
[period_type] => Regular 
[payer_status] => verified 
[test_ipn] => 1 
[tax] => 0.00 
[payer_email] => [email protected] 
[first_name] => Rajeev 
[receiver_email] => [email protected] 
[payer_id] => TMV3ZKQ6QQWGL 
[product_type] => 1 
[shipping] => 1.99 
[amount_per_cycle] => 15.99 
[profile_status] => Active 
[charset] => windows-1252 
[notify_version] => 3.8 
[amount] => 15.99 
[outstanding_balance] => 0.00 
[recurring_payment_id] => I-A5PB42GLNBSM 
[product_name] => abc product 
[ipn_track_id] => 2ebe4263b08f2 ) 

Please visit this link to download or view complete paypal recurring payment example using Paypal Express Checkout.

Hope this might be useful for you. Thanks!

Related Post