How get monthly alerts of payments process of monthly subscriptions on Authorize.net? - subscription

I am using ARB method of authorize.net for monthly subscription. I am getting successful response on sandbox account.
How can I get alert on monthly bases when authorize.net perform next month payment deduction for subscription, so I can maintain record in database for the payments of any user monthly subscription?

If you want of be notified of subscription payments you can do one of two things:
Use Silent Post. Authorize.Net can send a POST request with payment data for all successful subscription payments to a URL that you specify. The data contained here will be identical to the response from a request made via their AIM API. Keep in mind that this only supports successful transactions. If a transaction fails you will not be notified.
Use Webhooks. A webhook is a notification that something happened. You can subscribe to webhook notifications that you care about, in your case anything related to subscriptions, and ignore ones that you don't. You do need to take an extra step as the webhook notification won't include much detail about the transaction so you will then need to query their API to get the transaction results, but it will notify you of all subscription payments including when one is declined, a subscription is suspended, or a subscription is expiring.

Related

Get to know when paypal made payment in subscriptions plan

I'm using paypal subscription plan which is define here Subscription Integration I'm using reactjs here is package which I'm using for paypal react-paypal-button-v2 I'm successfully able to make payment but problem is I'm setting subscription plan which make payment every month. So how can I get to know when paypal made payment for next month. Is there some webhook or callback url which is called everytime when paypal made payment for this specific subscription plan. If there is how can I set any guide or something ?
Store a record of the subscriptionID when it is first created. Typically you'll want to associate this with a user.
For keeping track of future payments, set up a webhook listener for PAYMENT.SALE.COMPLETED events.
Webhook PAYMENT.SALE.COMPLETED has subscription id named billing_agreement_id.
(if this webhook was triggered as a result of a subscription payment)
Ex: webhook body like
{
...
...
resource: {
"billing_agreement_id":"I-XXXXXXXXX"
}
}

PayPals Instant Payments Notifications for WinForms

I am working on a WinForms application that has the ability to create and send invoices. In addition to creating invoices locally, the app uses PayPals Permissions API(and the invoicing API) to allow the application to (optionally)send invoices on the clients behalf.
My question is as follows, what is the best method of keeping track of the current status of invoices sent using PayPal? The application needs to know the status of each invoice so it can update its records locally.
I am aware of PayPals Instant Payments Notifications although I am unsure how this would fit together with a WinForms application(?).
My initial thought was to use the PayPal Invoicing API to query the required information on a as and when need-to-know basis. Additionally, a function that ran on a different thread could be run periodically to retrieve information in the background from the API, updating records locally.
Am I failing to acknowledge a better solution?
IPN will not fit invoice payment in case of creating invoice using permission API as there's no parameter to set the IPN URL in the invoice API. Your idea of calling GetInvoiceDetails API to retrieve invoice status based on need-to-know sounds a good solution for me.

Create custom paypal button with link direct after payment

I am trying to create a custom paypal button for selling digital goods, that will direct the buyer to a link that will allow him to download the file.
I've read a bit this paypal article about advanced html variables but I am not sure which I have to use to make it work: https://developer.paypal.com/webapps/developer/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/
Obviously the download should only initiate based on the payment ID to prevent free downloads, or is that done automatically by paypal?
What I would recommend us utilizing Instant Payment Notification (IPN) to handle all your post-payment processing tasks like updating your database, sending out email notifications (including one with a download link), etc.
Instant Payment Notification (IPN) is a message service that notifies
you of events related to PayPal transactions. You can use IPN messages
to automate back-office and administrative functions, such as
fulfilling orders, tracking customers, and providing status and other
transaction-related information.
This will allow you to not only automate the procedures, but also correctly handle things like e-checks or any other type of payment that may originally be in a "pending" status. You wouldn't want to deliver the digital goods until that payment actually clears. With IPN you will get 1 notification that your script can handle when the payment comes through as pending, and you would get another one when the payment updates to Completed, or Failed, or whatever.
The IPN's happen in real-time so buyers won't have to wait on anything. Whatever you're doing within the script would happen instantly upon the transaction completing.

Handling Transaction Between Paypal and Local Datasase

What is the best practice to handle transaction between application and paypal.
Consider:
I'm Alice and I want send money to Bob
In my DB I see that Bob has $200 and I want to send him $150.
Once transaction is sent I want to update the Bob's account such that it would contain $50.
Now according to PayPal API I can send Pay and receive success. However what happens
if I for example send Pay it succeeds but I fail to receive a response due to network problem. So I assume that error happened and try again and technically I'll send $300 to Bob instead of $150?
How can I handle such a transaction - between a local database that keeps an account and the remote PayPal API?
I had this exact concern recently with an ASP.NET MVC project I was completing for a client.
I learned two things:
Communication between Paypal and your database cannot be trusted (well, didn't really learn this, but it was entirely reinforced)
I now understand why so many websites that have Paypal as a transaction type mention there could be a processing period between the time that the transaction was completed and shipping/delivery of the product is completed.
The way you handle the situation is similar to the way a business could handle personal checks:
A personal check looks like currency (and typically is), but many businesses would like some sort of verification from the bank that funds are available before they accept payment - so they use a machine that asks the bank if funds are actually available.
If the machine says the funds are available, the business trusts it and you complete the transaction. However, the machine can give an error message that typically means "the funds are not available or something went wrong" and the business has a decision to make:
We can trust the customer and accept the check, deliver the product, and hope for the best when later depositing the check to the bank.
Or we can tell the customer that it will take time for the check to clear, deposit the check, wait for the funds to actually arrive in our account, and (if successful) deliver the product after the business receives funding.
This sounds inefficient with the way many businesses operate today, but it is something that does come up. In fact, this is why a lot of businesses stray away from accepting personal checks, they are unreliable when compared to other methods of payment.
Now how does this correlate to handling a Paypal payment?
A Paypal payment looks like currency (and it typically is), but many businesses would like some sort of verification from the Paypal that funds are available before they accept payment - so they use Paypal PDT, IPN, or other method for checking that the transaction was handled appropriately.
If Paypal properly responds to one of the verification requests, the business can trust it and complete the transaction. However, your website may throw an error of some sort (i.e. Paypal could reply with an IPN response of NOTVALID, or you could never get a reply from Paypal). The business has a decision to make:
The business can trust the customer and accept that they have made a Paypal payment and everything should be alright (very bad decision in the case of a Paypal transaction)
Or the business can tell the customer at check-out time that there may be a 72 hour processing period for Paypal payments.
This may not sound like the best way to operate your business, but it is the way we have to deal with an imperfect internet.
I would set up the Paypal payment flow similar to this:
UserA wants to send $100 to another UserB using Paypal
UserA enters the value in the 'checkout field' and is sent over to Paypal to verify the transaction.
UserA is sent back to your website from Paypal and your website performs the IPN check with the details that Paypal has POSTed to your site(I chose IPN in this case - as if we were using Express Checkout as opposed to some other payment gateway that Paypal offers).
If the IPN is VALID, process the transaction as expected.
If the IPN is not VALID, mention to the customer that there may be a delay in processing, have your application send you a notification that a possible Paypal transaction issue has occurred (you may want to include a reference id so that you can quickly find which transaction this notification is referencing), and mark the transaction as pending as opposed to complete or something similar.
An admin of the site who handles these notifications will manually investigate the transaction (or force the website to check with Paypal again - see the Paypal API documentation for details on this) and manually mark the transaction as complete or failed.
Notify those involved of the status of the transaction.
It is annoying that we have to have extra steps involved to make sure the money was transferred, but, as mentioned earlier, we are using an imperfect system and we want to be very certain of the success / failure of financial transactions.
An added bonus to this process is that there is likely to be notifications when someone is tampering with the Paypal payment system - leaving you better equipped to deal with evil-doers in the future.
Please refer this link ,Hope PayPal Authorization & Capture method will be suitable for you ,since you don't want lose the response as well as miscalculated amount transfers, PayPal provides correlation id that can be referred for PayPal to confirm your order status,it will be better to pass the order id to PayPal API.
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_admin_authcapture
http://www.scribd.com/doc/6303345/40/CorrelationID-for-Reporting-Problems-to-PayPal
Good Luck!
This is known as 2-phase commit. As long as paypal does not participate in the same transaction, you will run into problems.
I would debit Alice the $150 and reflect the transaction is "Pending Confirmation", then periodically poll PayPal to synchronize your DB, since you have no control of when the network or PayPal may be available, post, reverse or adjust the transaction. Once PayPal processes the transaction, you can change the status in your DB from "Pending" to "Completed". BTW, this how bank accounts and credit cards are processed. You could apply a double-entry accounting method to your DB. (see this Q&A)
From what i see you need to make sure the transaction is complete otherwise nothing should be done .
If you deposit the money into PayPal API and you do not receive an response from PAYPAL API then you need to rollback the transaction in you DB.

Implement a paid subscription service on a website

I have a website and I would like to implement a paid subscription service. Its a simple service with only 2 types of plans. For now, ill just use Paypal. But im a little lost before start, mainly with the data model.
My main question for now is, what information do I need to keep for each subscription? Do I need to implement a shopping cart for this (dont think so)? Im not asking for a detailed explanation, just a few lights or resources to find a way to start. Thanks.
Depends on what technology you're using. Basic payments work a bit like this
-> You send them to paypal with a plan (you define the plan on paypal)
they know which amount to charge
you can pass custom parameters which they will pass back
Customer fills in application
<- paypal tells you that your predefined plan got purchased
in this same request, they send a lot of info about the payment including a GUID and your params
-> you ask paypal "hey, some one just told me this plan GUID got purchased, can you confirm"
<- paypal service returns 'yes'
-> you take the customer's ID from the params that you attached when you sent them to the paypal service and update them to "paid" in the database, or whatever
That's it in a nutshell...
Look at any subscription card mailer from any magazine and you can get an idea of what kind of data you will have to record. Start and end date for the subscription would be a good thing to keep, and what kind of plan the user is subscribed to. Once you have the end date, you just need to run a query to get the records of the users that have access. Something like
Select * from users where subscription_end_date is >= today
I'm sure there will be a lot of other columns that will go into your final product, but that will be up to you to decide what data you want to keep. What are the different states that a subscription can be in? Can someone be subscribed to both services at the same time?
PayPal does a decent job if you want to charge the same amount every month. However, if you anticipate your users making changes to their subscription plans (upgrades/downgrades) or needing to provide credits to their account for customer support purposes, PayPal would require that you cancel the subscription...and then have the customer re-subscribe.
[Full disclosure - I am a co-founder of Recurly.com]
Recurly handles the upgrades and downgrades, and provides automated customer emails to be sent out to your customers (on your behalf) for every event confirmation, and invoice that occurs. You also have a full account management dashboard and reporting so that you don't need to build this yourself.
Best of all, if you ever decide to leave PayPal, and move your business to a standalone payment gateway, Recurly stores all of your credit cards in a PCI compliant vault so you don't need to ask you customers to come back and re-subscribe. (PayPal will not return your customer credit card information). You simply configure your new gateway in Recurly, and payments will be processed without any interruption to your business.
Here is a blog post we wrote on the topic:
http://blog.recurly.com/2010/08/top-ten-reasons-to-use-recurly-vs-paypal-for-recurring-billing/
-Best of luck.
-Dan

Resources