How to implement paypal recurring payment in angular2 - paypal

I want to implement paypal recurring payments using angular2. I have successfully included the button for express checkout which works perfectly, but i don't have an idea of the api to use for recurring payments.
When i try to use checkout.js with this code
paypal.billingPlan.create(billingPlanAttributes, function (error, billingPlan) {
...
})
I get billingPlan is not defined. Has anybody done this successfully, please let me know.

The correct way to do Recurring payment in REST API with Paypal is that you are required to have an active billing plans.
The orders are ;
Create Billing Plans
Update Billing Plans to Active
Call Billing Agreement.
In your cases, you need an active billing plans before calling the billing agreement. PayPal use the billing plans to define the billing agreement between buyer and seller.

Related

paypal recurring payments and paypal pro

I am trying to implement paypal pro (our software should work for an italian account) for recurring payments.
I cannot use "express checkout" beacuse a subscription can vary more than the 15% limitation in 180 days and we don't have a trial period.
I have downloaded samples from paypal for .net, created a sandbox account from the developer dashboard but when i test it, i give an error message "DPRP is disabled for this merchant".
Later i have read that recurring payments are enabled for "direct payments" but they are enabled only in US, UK, Canada and New Zealand.
In Paypal Pro for Italy documentation i have not found any information for Recurring Payments.
How can I create a recurring payment in Paypal without "express checkout" then?
With an Italian PayPal account you're not going to be able to use Payments Pro.
What you could do, though, is use Express Checkout with Billing Agreements / Reference Transactions instead of setting up a recurring payments profile. This way you won't have the 15% limitation.
You would include the billing agreement parameters in your SetExpressCheckout request, and then that would setup the billing agreement so that you can run future calls to DoReferenceTransaction to process some amount in the future using the billing agreement.
This way the process happens without additional approval, no redirect required, etc. You just make the DoReferenceTransaction call and the money is moved immediately. Reference transactions can be any amount, so you would have no limitation there.
The only difference with this method is that you'll need to create a CRON job on your server that loops through all your due accounts each day to run the reference transaction for each one. So you're basically building your own recurring system instead of using PayPal's.
If you happen to be working with PHP this PayPal PHP SDK will make all of the API calls very quick and easy for you.

Preapproval API scenario in trial credit scenario

We want to offer a online service that uses a credit system.
Initially we want to offer x amount of credits as a free trial. To activate this trial the user agrees to a subscription via PayPal (but does not pay anything at that time)
1) Is it possible to set up using Preapproval API, if not is there a better suited API
2) Can it be setup through PayPal so that the user does not need an existing PayPal account or to create a new one. If there is a way to do this other than preapproval API please let me know as well.
3) We want the billing to be automatic when the user credits run out. Therefore there is no set time, e.g 1 month, when each user is charged. Is this possible?
Any help would be very much appreciated, thanks
You have a few different options:
Reference Transactions (no cost requires approval from PayPal)
Enhanced Recurring Billing/Automatic Payments (cannot be used with a Pro or Advanced Accounts) Has a cost associated with it ($19.99 monthly)
Recurring Billing with PayPal Payments Pro Payflow or PayPal Payments Advanced. Has a cost associated with it ($10.00 monthly in addition to the cost of the Payflow/Advanced account)
Here are the details from the three different options:
Reference Transactions, which does require that you call into PayPal Customer Support and that your account is approved for this feature.
Reference transactions does allow for guest checkout billing.
From the PayPal Documentation, Recurring payments using reference transactions enable you to handle payments for varying amounts of money on a varying schedule.
Reference Transaction Guide
Enhanced Recurring Billing/Automatic Billing
If you do not plan to uses PayPal Payments Pro or Advanced at any time you can get setup with Enhanced Recurring Billing/ Automatic Billing
Automatic Billing Guide
From the PayPal Documentation:
You can create Automatic Billing buttons for your website by using a tool on the PayPal website. If you're a power user, you can write the HTML code for PayPal hosted Automatic Billing buttons yourself.
With Automatic Billing buttons, buyers agree to pay you automatically when you bill them, up to a limit that they choose. You set the parameters for the limits they choose. Automatic billing allows Guest Checkout, so you can bill a credit card.
PayPal Payments Pro Payflow/Advanced
For PayPal Payments Pro Payflow/Advanced you can setup Recurring Billing as well. Payflow Pro allows you to process credit cards directly. Here is the information on Recurring Billing through Payflow:
Payflow Recurring Billing

How to use billing agreement with chained payments?

We are setting up our marketplace transactions with PayPal and thus want to use chained payments for simple processing and to prevent being a funds aggregator.
As we want to capture buyers payment method once (upfront) and allow them to buy services from sellers later without entering their payment details every time, PayPal has 2 options: 1) pre-approvals, or 2) billing agreements.
However since buyers should also be able to pay with credit card, we can only use option 2) billing agreements.
Is our understanding correct that billing agreements are not compatible with chained payments?
Also, if they are not compatible, how can we go about it to allow for:
- Users to pay with credit card
- Not have them enter the credit card details every time at the time of purchase
- Use chained payments (prevent funds aggregation which would happen if we receive funds first and payout in a second operation)?
Thanks!
Preapproved Payments is part of the Adaptive Payments platform. Depending on what you're doing with the transaction when the time comes to submit a payment with a preapproval profile you may use a simple payment, parallel payment, or chained payment.
What you're after, billing agreements, is part of the Express Checkout API or Payments Pro. The actual term for what you'll be working with is Reference Transactions.
If you process a credit card directly over Payments Pro (either sale or auth) then you can simply use that transaction ID you get back with the DoReferenceTransaction API at any point in the future to process another transaction automatically.
If you process the original sale or authorization with Express Checkout, that's where you need to include billing agreement parameters in your SetExpressCheckout request to create that billing agreement, but then you'd still use the DoReferenceTransaction API to process future payments.

recurring payment with paypal advanced NOT paypal pro

I am trying to make recurring payment work with PAYPAL ADVANCED
My script works in case of SALE transactions but there are issues when i try to create recurring profile.
ISSUES
When i am posting my request with CREATESECURETOKEN set to Y. It returns Invalid transaction type: Invalid Transaction Type for secure token creation request
Here is the string. Note i have changed user and pass here
PARTNER[6]=PayPal&VENDOR[10]=#####&USER[11]=#####&PWD[9]=#####&CREATESECURETOKEN[1]=Y&TRXTYPE[1]=R&RECURRING[1]=Y&TENDER[1]=C&ACTION[1]=A&PROFILENAME[6]=Gautam&ACCT[16]=4012888888881881&EXPDATE[4]=1214&AMT[5]=10.00&START[8]=06132013&PAYPERIOD[4]=MONT&TERM[1]=0&OPTIONALTRX[1]=S&OPTIONALTRXAMT[4]=2.00&EMAIL[20]=#####&SECURETOKENID[26]=MySecTokenID-51b93e0830f70&RETURNURL[51]=http://localhost:8080/php/test/payflow/advanced.php&CANCELURL[51]=http://localhost:8080/php/test/payflow/advanced.php&ERRORURL[51]=http://localhost:8080/php/test/payflow/advanced.php&BILLTOFIRSTNAME[4]=John&BILLTOLASTNAME[3]=Doe&BILLTOSTREET[12]=123 Main St.&BILLTOCITY[8]=San Jose&BILLTOSTATE[2]=CA&BILLTOZIP[5]=95101&BILLTOCOUNTRY[2]=US&SHIPTOFIRSTNAME[4]=Jane&SHIPTOLASTNAME[5]=Smith&SHIPTOSTREET[13]=1234 Park Ave&SHIPTOCITY[8]=San Jose&SHIPTOSTATE[2]=CA&SHIPTOZIP[5]=95101&SHIPTOCOUNTRY[2]=US
if i set CREATESECURETOKEN to N i receive Invalid merchant information: 10002-You do not have permissions to make this API call
I searched for documentation on recurring payment with paypal advanced but every where i found details about payflow pro. With no information about recurring payment with paypal advanced its not easy to make things work.
Any idea about what is wrong with my post data?.
I posted my query on paypal.com/mts a week back but have no reply.
NOTE: I have subscribed to paypal advanced and paypal recurring payment.
With paypal advanced the transactions are completed on the client website itself and user is never taken to paypal site. Yes it uses iframe for the purpose.
It works for SALE type transaction but not in case of recurring payment.
Payments Pro and Advanced don't support the Recurring Payment API calls. You would be using the Recurring Billing API calls through Payflow. The new Advanced and Pro accounts use Payflow Pro or Link.
Are you setting a billing type in the Secure Token call?
What is the ticket number you submitted? I'd to look up the account to see if the account is setup to use Recurring Billing and was created correctly.
Also, Advanced accounts shouldn't be using the Recurring Billing API calls. It is possible to create Recurring Billing profiles with an Advanced account but they have to be done through the PayPal Manager site.

Detecting cancellation of a paypal billing agreement setup with reference transactions

I am using the 'reference transactions' of the Paypal express checkout api to set up a recurring billing scenario for our customers. I have chosen this method since the amount billed per month will vary and there is no initial payment when entering into the billing agreement.
My question is, can I use the paypal IPN to detect when the user cancels this? I know that if the customer enters into this agreement they have the power to log into their own Paypal account and cancel the agreement. What variables should I be listening for through the IPN?
Whilst I see mention of recurring payments and recurring payment profiles in the IPN documentation these are not actually the same as setting up a recurring billing scenario via reference transactions (recurring payments and reference transactions are in two different parts of the general paypal api documentation).
Enable IPN in your PayPal account , then PayPal will notify you via IPN about the Billing agreement cancel from the customer.
If you include IPN with SetExpressCheckout, it will not work with Reference Transaction. You need to Enable IPN on PayPal site.