Paypal Pro API for monthly payment with variable amount each month - variables

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.

Related

How to use Big Commerce Order API and make customer pay?

I would like to make an API call to Big Commerce backend to complete a purchase on a customer's behalf. Based on the API reference:
https://developer.bigcommerce.com/api/stores/v2/orders#create-an-order
By default, I believe that one can only create an order that not yet paid by the customer. Please correct me if I am wrong.
So, my question is - How do you make a payment on behalf of a customer for the order? It is safe to assume that we have a tokenized credit card of our known customer in a payment gateway like Stripe.
My guess of how it could be done is when an order is created, I can set up a webhook to call the payment gateway to make a charge on the customer's credit card. Is this correct? Are there anything that I should watch out for?
Currently, you cannot use the BigCommerce API to process a payment or full transaction. We only allow payments through the control panel where you can enter credit card details or on the storefront made by the customer. If you'd like to make use of tokenization or recurring payments, it is better to use Rebillia or Recharge (apps).
As you stated, you would need to make a call to Stripe's API to charge the card on file with the customer's token. This should be fine. It won't make any calls back to BigCommerce, so I'd be mindful of error handling (such as if the card has expired) and how you'd retry or mark the order in BigCommerce. Depending on how it was configured, you would want to check order details to ensure you were only processing payments from API created orders.
I'm not sure of what PCI implications might be for the storage of the Stripe tokens. That would be another point for consideration.

variable monthly charges to users

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.

Current PayPal Fees in web API?

Does anyone know if there is a publicly available PayPal resource that would allow me to calculate transaction fees in my Magento code?
For example, if someone buys something for $1.00, I'd like to know if $0.15 of that is a PayPal fee.
If there were a resource, like paypal.com/currentfees.xml or something that I could readout in my PHP code, I could that. Does it exist? I know there are different fees for different payment methods (e.g., AMEX) and fees could change at any time -> So it'd be good to have a dynamic way to calculate how much of Magento's order totals are really PayPal fees.
EDIT: To clarify, I'm not interested in charging customers more, just in knowing how much of my price is going to fees. For bookkeeping.
Thanks!
PayPal fees are not the same across accounts or even by transaction; there are different fees for cross-border transactions, PayPal Here transactions, large-merchant discounts, et cetera.
Have a look at https://www.paypal.com/webapps/mpp/paypal-fees for more detail.
So no, unfortunately you can't pull a resource to find the current fee.
However, PayPal does return the fees paid for each transaction in the API response.
For example, if you're integrated with PayPal Express Checkout, the DoExpressCheckoutPayment API (doc) is used to finalize a transaction. This API call returns a 'PAYMENTINFO_0_FEEAMT' parameter which contains the total fee amount paid for the transaction.
Should you wish to retrieve this information after the transaction has been completed; PayPal also offers the GetTransactionDetails API call (doc). This API call also returns 'FEEAMT' as a parameter.
Simply submit the TRANSACTIONID and read out the FEEAMT.
Note: Fees are only calculated on completed transactions. You won't get a FEEAMT back for any order or authorization-ID's (e.g. those starting with O-xxxxxxxx).

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).

Onsite Recurring Payments using Paypal Website Payments Pro API

I want to accept recurring payments on my site using paypal without having the user ever leave my site. Based on the paypal documentation it appears you have to send the user offsite to paypal (express checkout) first and then have them come back to your site.
Is their a different way of using the api so the user stays on site the entire time?
To Process payments not on PayPal's website, you need to use Website Payments Pro.
To use PayPal's recurring payment system, without programming your own:
Use Website Payments Pro Recurring Payments (direct payment recurring payments / DPRP)
Program your own recurring payment functionality:
Save cc info to a database and make DoDirectPayment API calls based on your criteria
Process an initial payment when someone signs up for your recurring service, save the transaction ID, and then call DoReferenceTransaction in the future (based on your criteria). Always use the newest transaction ID as they only last a year. Also, you need to call PayPal to apply for this feature ($0).