Paypal DoDirectPayment without user present (e.g. with cron job) - php

Is it possible to make Paypal payments using stored user's data (credit card info, name, address etc.) within cron job or other script execution without actual user present?
I want to implement autopayments on my service but I can not to use standard Paypal autocharge functionality because of its complexity.

What you're looking for is called Reference Transactions. You can use the DoReferenceTransaction API to accomplish your goal.
Using this API you simply pass in the transaction ID of a previous Authorization or Sale transaction along with a new amount you'd like to process. It will lookup the billing info saved on PayPal's system using that previous transaction ID, and then process the same source for the new transaction.
This works with both Payments Pro and Express Checkout.
I noticed you posted this with the adaptive payments tag, too. That would be the Preapproval API and the Pay API, but would not involve DoDirectPayment.

Related

Unable to get the transaction id using Authorize.Net ARB

I am working on implementing Authorize.Net's Automated Recurring Billing API in Laravel Framework.
The scenario is I have a site, users sign up for our services and we charge them on monthly basis, and for that we have implemented automated recurring billing.
But I am unable to get the transaction id of successfully placed transactions.
ARB does not return a transaction ID when a payment is processed. It only establishes the recurring subscription. If you want transaction IDs of every successful subscription payment you will need to use one of two options available to you.
Webhooks
You can set up a webhook using the Webhooks API to be notified whenever a successful payment is made for a subscription. Although very little information is sent over with a webhook as it is best paired with the Transaction Details API, the transaction ID is one of the pieces of information sent with a webhook notification.
Silent Post
Silent Post is very similar to Paypal's IPN. Whenever a transaction is made Authorize.Net will send transaction details to a URL you specify which includes the transaction ID. Handling a Silent Post notification is easy as it looks exactly like a form submission.
Silent Post has been deprecated and will be going away so it is not recommended that you use this any more.
Disclosure: I wrote the articles about Webhooks and Silent Post.

What PayPal PHP-API functions to use as replacement for subscription-buttons?

I have a website coded in PHP that uses paypal buttons/IPN for subscriptions.
The method is limited and I need to replace it with the REST-API.
What the system needs to do:
Accept new user recurring-payment subscriptions
Be able to change plan pricing for new users
Be able to change plan pricing for existing users
Change subscription plans mid-subscription(If a user upgrades from pro to master the price goes up, and the opposite way it goes down).
The price difference between packages is 5$
Give periodic discounts for a limited amount of months.
The questions:
1.) What is the equivalent of recurring-payments in the PHP-API or REST-API? (I'd rather it auto-charges and notifies my IPN if possible)
2.) How can I automatically refund/charge an additional amount when the user upgrades/downgrades in the middle of a month?
3.) Is there a standalone PHP control-panel that can connect to the paypal API to manage the subscription packages + sales?
Thanks in advance!
If you are looking to use REST APIs, the best place to start is going to be at the REST API docs. For your situation, you can use the vault to set up a recurring payment system. You could also use the future payments API, but you will need to make sure you buy DPRP for your account. Contact PayPal Customer Support to enable DPRP.
With the Vault API, you can just create one time payments over and over with the token you get when storing a credit card.
There is an in-depth walkthrough using the SDK on the PayPal PHP SDK Wiki.
To do refunds, you can use the Refund REST API. All this assuming that you would be writing scripts to detect your user downgrading/upgrading. You would just need to store the amount they are paying each month in your DB.
There are some shopping carts out there that are implementing REST APIs. You might need to google search for something like that.
Hope that helps and gets you started in the right direction!

paypal Preapproval API

we are trying to add a pre-approval paypal process to our website before a user can bid on any of our items for sale. We currently accomplished this using Authorize.net but want to now integrate paypal as well.
I have been doing some research and am trying to find out if paypal even offers such a solution. The main reason for adding this verification is of course to make sure an individual actually has the money to purchase the item, some items can range from $100-$100,000. Does paypal offer a pre approval process for those types of transactions?
https://developer.paypal.com/docs/classic/api/adaptive-payments/Preapproval_API_Operation/
The Preapproval API gives your application permissions to trigger payments on a user's behalf without further approval (no login required to submit payments with a preapproval ID). There is no guarantee funds will be available when you submit this payment. A transaction with a preapproval ID could simply fail like any other transaction.
It sounds like what you're looking is the Authorization and Capture process, which is probably what you're doing with Auth.net, too.
With PayPal you can run Authorizations from credit cards directly (exactly like you do with Auth.net) and you can also do it with Express Checkout, which would be PayPal login payments.

PayPal classical API with reoccuring payment in Laravel 4.2

I am working on Laravel 4.2 project. The project is about to provide the Video services to the dedicated customers.
The client wants to use PayPal payment gateway and I have never done this before. He has provided me a Personal and a Business account with Classical API credentials and signature.
The project requirement is once user sign-up, he will be charged certain amount (let us say $10 every month). For payment he must NOT be redirected to PayPal site that means everything should be done using my website only. Also we will NOT store any credit card details of the user and still the Payment should be done OR renewed automatically every month.
If user wants to turn of the the auto renewal of payment, he can.
I am not sure how to do this using PayPal classical API. Although I have downloaded the Omnipay/Omnipay package from git-hub, they asks there is no method to store the user's credit card details in PayPal Vault using this also to have a cron job for auto renewal. Since I don't want to store the credit card details, I am not sure how to do all this.
Please help me or guide me to do so. Is there any sample or example?
In order to take credit cards directly like you're asking you'll need to sign up with PayPal Payments Pro, which is $30/mo. Then you'll need to add the recurring billing feature to that, which is another $30/mo.
If that's not a problem, then after getting those things approved and active on your account, you would use the CreateRecurringPaymentsProfile API to create the subscription profiles.
This PayPal PHP SDK is available on Packagist and works with Composer, so it works wonderfully in Laravel.
The CreateRecurringPaymentsProfile sample is functional as-is (although, as I look at it now you'll need to update the expiration date of the credit card) so you would just need to replace all of the static data with your own dynamic data.
The template file is the same thing but it's completely empty and ready for you to populate with your own data.
Using that SDK you can have the profile creation working within minutes, so it's just a matter of having Pro w/ Recurring Payments enabled on your account.

How can I make an automatic PayPal buy button?

I want my PHP web application to have the ability to save the user's PayPal details in their user account.
When they go to purchase items, rather than going through the standard PayPal form, it will automatically grab the user's PayPal details from their user account, and make the payment directly from my website. There is definitely a way to do this, as I have seen this feature on sites such as Freelancer.com
Thanks for the help! :)
No, you don't need Payments Pro for that. That would only be if you want to do it with direct credit cards. What you're after in general is called Reference Transactions, and when done with PayPal Express Checkout it uses Billing Agreements.
You'll use Express Checkout and/or Payments Pro (optional) to process an original authorization or sale transaction. Then, you can send that ID you get back in that original transaction along with a new amount in the DoReferenceTransaction API and that new amount will be instantly processed without any redirection or further authorization required.

Categories