variable monthly charges to users - variables

I have a situation where I am to bill the site users monthly. But the invoice amount that is raised depends on the the leads that our site generates for his business. For example if the user gets 5 leads from my site and I charge him $10 per lead, at the end of month he will be charged $50. similarly leads might vary each month so will the amount.
Now I cant store his cc/ paypal credentials on my site for security reasons nor can I pre bill him or ask him to take credits and then use it. Please let me know the way to handle this situation. How can I handle this using paypal?

There are a few different ways to handle this, but I would recommend Preapproved Payments, which are part of the Adaptive Payments API.
With this method your users would create a profile with you (using the Preapproval API) when they first create their account on your site. That will give you a preapproval key that you can store with your user account. Then in the future when you need to bill them you can use the Pay API with the preapproval key to process funds immediately without further approval.
If you're working with PHP my class library for PayPal will make these calls very simple for you. You would just use the Preapproval.php template to setup the profiles for people, and then use PayWithOptions.php to process payments using the preapproval key(s) accordingly.
If you end up using it and need more help you can contact me directly for support.

Related

Handling payments in react-native

So I am building an app with react-native (expo) where a user fixes appointment with some other person and to do so, he has pay the other person.
Now how can I handle payments here. What i want is the user makes the payment and the receiver should be the other person but how much i understood the payment gateways, the payment is received by the app owner or in simple words, receiver is a single person.
I also tried deep linking to directly take the user to some UPI app like google pay or paytm but it seems that those apps require some special type of account (merchant account) to make the transaction if we access them using deep links (which is a problem as it is not necessary that every user will have a merchant account).
As I said, it is always better that you have your own payment gateway account, and all the transaction goes through your gateway, meaning you get the money and you build a system which will forward the payment to the receiver. I have worked on 2 such apps:
1: Where we have our own razorpay account, and we get the payment first, and then we forward it.
2: Where in we were directly having transaction between 2 users, but not through app, instead we display them the account details of the receiver and give them 48hrs time to pay that account. But we had to manually handle this scenario since one cannot know if the user has paid to the said account, since it's not your account.
3: There is one more method where in payment gateway has a webhook which consists of a virtual account number, and every user that lands on your app, you can create a virtual account number for him/her and store the user-virtual account number relationship in your db, whenever there is a payment, you can find out about the user through this virtual account number. Read about this.
The deep link is a good idea, but again, as you mentioned, it will require the end user to be a merchant user(have a merchant account), you can find more details here
Maybe you can ask your users to create a merchant account, which again I am not sure if it's possible, and if it's possible, if it's feasible?
The best way according to me is, you handle this through your payment gateway, and instantly forward it to the user who should have received it. Again there are some rules and clause to it(some commission is taken by those payment gateway,etc), check those things out.
I think the most close answer to my question is to use razorpay routes where we can link multiple accounts with our account and transfer money accordingly.
More details here

Paypal API for recurring payment based on usage

I am currently upgrading an old system writing in JSF, which communicates with Paypal to create an "Acceptance term" for recurring payment, it generates a Token and when the client accepts the term, it creates an Agreement Id, later we use these to charge the client based on the services he used.
On the Paypal developer website, the Billing Agreement API is marked as deprecated, so I can´t work with it, they offer the Subscription as an alternative, but it doesn´t give the Agreement Id or the possibility to charge the user based on the usage, at least, not that I´ve seen.
Is there a way to create the Token and Agreement, or to use the Subscription (or other methods) to charge the user based on that?
eg. We offer a mobile plan for U$ 10, plus U$ 5 if the user sends more than 1000 messages, we first check if that happened, then we charge the user.
If the account is approved for reference transactions, and it sounds like it may be, you can use the Vault API which is in open beta, in conjunction with the orders API. See this example.

Paypal Pro API for monthly payment with variable amount each month

I need suggestion for paypal pro API which allow me to pass variable amount each month. For some months,it can be zero too.
I tried with UpdateRecurringPaymentsProfile but it gives me error of 11592 (Subscription profiles are not supported for recurring payments).
Please someone help me with easiest solution.
Based on the error you mentioned it sounds like you're using a PayPal Standard Subscription button, not Pro. If that's the case, then as the error says, you cannot update standard subscriptions with the APIs. You would have to use the recurring payments API to create the profile in order to then update it.
That said, you won't be able to do variable amounts with recurring payments profiles. you can only raise them by 10% every 120 days, so that typically doesn't work with what you're trying to do.
Instead, you'll need to use reference transactions. So if you're using Payments Pro that will be real simple. You just pass in the transaction ID of an original authorization or sale transaction along with a new amount you need to charge. PayPal uses the card details on file to process the new amount.
If you're using DoDirectPayment then you'll use DoReferenceTransaction for the future payments. If you're using PayFlow you would use the PayFlow API, of course, and change the parameters to match a reference transaction request.
You can also do the same thing with PayPal Express Checkout, but in that case you'll need to include billing agreement parameters in the SetExpressCheckout request, and then you'd use the billing agreement ID you get back from that in the DoReferenceTransaction request.
In any case you'll need to build your own script to run everyday, pull profiles that need to be charged, and charge them accordingly.

subscription payment processing

Looking for some advice on which service to use to implement the following on my site:
I would like to sell 4 levels of subscriptions each to be billed on a monthly basis
The customer should be able to cancel their subscription at any time
The customer should be able to upgrade and downgrade their subscription at any time
I would like to keep the cost down until I have enough subscribers.
I have looked at Paypal but could not figure out how I can do requirements #3. Posting to their community forums yielded no response.
I am also located in Canada which seems to limit the options available to me.
I am currently looking at www.preedly.com and www.chargify.com but they seem to require a merchant account so I'd end up paying 2 service providers.
My site is written in PHP so a PHP-friendly solution is needed.
One last thing, I could not find a way to get Paypal to tell me the new subscription expiry date (following the successful processing of a transation) in order for me to update my customer table and lock out those who have not paid.
You may want to look into gettings a US based merchant account (I used to work for a merchant account provider and we were able to successfully establish merchant account for Canadian businesses. IIRC it required some hoops to be jumped through, though). If you can get a US merchant account you then can use Authorize.Net's Automated Recurring Billg (ARB) API. It allows you to create subscriptions and modify them accordingly (upadting and deleting).

Paypal for a buy/sell website

So I'm working on this website where users post their items, other users add some items to their cart and purchase them online.
The flow i was thinking about goes like this:
A merchant posts an item along with their credit cart/ paypal information.
A buyer adds items (from different merchants) to his/her shopping cart and purchases.
The buyer pays by filling a form that includes the payment method fields within the website's layout (no redirection to paypal).
The website will work as a gateway, it will capture the payments from the buyers and pays the merchants accordingly and automatically.
Is this possible using PayPal? if so, what API should I use?
Any input/idea is appreciated...
Thanks,
/t
I have also investigated using PayPal in this way for a site with a similar concept. Unfortunately, PayPal does not allow this. This makes you something known as a Third Party Payment Aggregator which drastically increases the risk associated with providing you a Merchant Account (which is what PayPal is doing). You can read more here.
Though, you could probably do it for a while before PayPal caught on, they could cancel at anytime leaving you high and dry. I recommend investigating Third Party Payment Aggregator solutions (Braintree has something that helps with this).
I guess it is. Use Paypal API
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_api_reference
https://developer.paypal.com/