In app credit/currency using PayPal API - cakephp

I am building a web app in cakePHP that involves a credit system.
So credits are bought with real money, then at a some point in the future they are spent and the portion the credits value goes to me and the rest goes to a third party.
So far no problem but...
If I use something like PayPal's Express Checkout, PayPal take a cut when the credits are initially bought and another cut when the third party is paid.
Or I can use PayPal's Adaptive Payments and do a Delayed Chained Payment but that has a maximum delay of 90 days.
So my question is do I have any other options?

There are only two options:
Use another payment service provider, but they'll all take their share for their service. But Paypal has become expensive.
Add the fees on top of what the user has to pay for the credits, you'll have to calculate them in advance.

Related

Number of online users and app visits in single page application

I making a SPA (single page application) and want to show the number of online users and app visits in the admin panel like this:
online users: 5 people
Today visits: 12 people.
This Year visits: 5263 people.
I don't know what the proper procedure is for implementing this.
What I'm doing as a solution is to make an endpoint at the server for computing number of online users and visits. In the client I've created a random string as UserKey and saved it into localStorage.Then I've used setInterval to send a request with UserKey payload to the endpoint every 5 minutes. This endpoint calculates the number of online users and visits based on UserKey and current date and time. Calculating Is not 100% Accurate but it's satisfactory for me.
I'm not sure if I'm in the right way. Please share me your advice.
You can simply do it with Navigator.onLine :
Source
Websockets (pusher) should be a right solution for your case. This way you don't have to poll every 5 minutes.
See https://pusher.com/docs/channels/getting_started/javascript/?ref=docs-index
It is free but just for 50 users if you want more users you can also choose to start an own Websocket server. Which is a little more complicated (without external libraries of course).

How to withdraw money (earnings) using PayPal/Transferwise/Bill.com/Payoneer in React (RCA) + Koa (Sequelize + PostrgeSQL)

I'm building a platform, where users would be able to withdraw their earnings using one of supported services: PayPal, Transferwise, Bill.com and Payoneer.
I haven't worked with money withdrawal before, so I'm a bit confused on how it should work (npm packages, what would be the process in the context of the client-server comunication, best practices, patterns/antipatterns etc.).
My current tech stack is React + Koa.js
I would be appreciated for any useful information.
Thanks in advance.
I've built something similar recently, and here are the steps I've followed:
Collect beneficiary details from the user
This could be their Paypal email, bank account details or something else depending on the payment provider. If you go with Paypal or Payoneer, you'll need to ask the user to sign up for an account if they don't already have one.
Validate that the information is in the correct format
Especially if you are collecting bank account details, doing a bit of validation up front could save you a lot of hassle later on.
Saving the information securely
If you are collecting bank details, you need to decide whether you want to store the bank details in your own system, or if you prefer to only store them with the payment provider.
Storing the data in your own system allows you to review the information before passing it on to your payment provider. However you will need to make sure the information is managed securely.
Setting up the payment
You now need to decide how you will initiate the payment. You could let the user request to be paid. You could also do the payments automatically based on some rules. E.g. weekly payments if amount is over a threshold. Whichever way you go, most providers give you the option to use their API or some file based system.
Funding the payments
This will depend on your provider. Some allow you to fund the payments over API using a prefunded balance. Others require you to do final approval inside their system.
React component for collecting bank details
I needed to collect bank details that work with TransferWise for my own project, so I built <BankDeets/>, a React component that's available on NPM. It supports 40+ currencies and collects all the data you need to make payments.
Example:
<BankDeets submitURL="bankdeets.co/save"/>
It's available via npm install bankdeets (or https://github.com/321k/bankdeets) and comes with validation and translations. I'm the creator, so please ping me any questions about it.

Integrating application shopping cart with PayPal through PayPal API

I need to integrate PayPal with my client AngularJS app, where the app visitors can donate specific amounts of money based on various causes, but not sure where to start? My client requested that visitors can select cause, amount to be donated, then get routed to Paypal to enter their details, process payment then finally routed back to the app for (thank you page) which should receive payment confirmation as parameter.
I've skimmed through the PayPal developers API and can see that there are a lot of options / features offered but not sure really where to start and which is the best approach to accomplish my client needs? Shall I use REST API? or will simple button integration do the job? What if I need to add causes selected to Paypal checkout page? Can I do this using the API? Thanks
If you don't have some specific reason to use REST I would recommend just going with the Classic API, specifically Express Checkout. It's much more mature and provides a lot more freedom to integrate with different options and customization.
With Express Checkout you'll be using the following calls.
SetExpressCheckout
GetExpressCheckoutDetails
DoExpressCheckoutPayment
You'll call SEC and that will return a token. Then you'll redirect the user to PayPal with that token appended to the URL. The user signs in and approves the payment, and they're returned to a URL that you supply in the SEC request.
At that URL you can call GECD to obtain all the details about the buyer. This allows you to tae their address and apply any shipping or tax rules you need to so that you can present a final review before the user would approve the payment, which is when you trigger DECP to finalize the transaction.
There are various options with that flow. For example, GECD is optional, and depending on your flow you may or may not need a final review, so you could skip straight to DECP and display nothing but a final receipt page when the user gets back to your site if you want to.
If you happen to be using PHP my class library for PayPal will make all of this very simple for you.

alternative of CIM authorized.net

I have a website(PHP) which has payment functionality with recuring/autopayment feature where user will enter their credit card detail once for shopping and from next time onward they don't need to enter their credit card detail again. Credit Card detail will not be saved to my database but will be saved in payment gateway with unique id/reference. I just need to use reference id for payment whenever user do shpping.
Earlier, i was using authorize.net payment gateway with its CIM(Customer Information Management) feature for auto payment which was working fine but now my client does want this payment gateway. I want some alternate payment gateway which support CIM feature.
If someone has already done same kind of stuff then please help me.
Authorized.net is the best option, because of reputation, costs and developer friendly environment. However there are alternatives as stripe, 2checkout, braintree...

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