Test user's paypal details - php

I am developing an LMS in which I have the following scenario.
A teacher will create an account now different students can see the subject offered by the teacher and lets suppose one of the student buys a subscription for a subject offered by the teacher.
Now when the student will pay, the amount will directly go into admin's account(not the teacher).
Now the admin can release the payment whenever he wants from the backend, in this case using paypal I need to have all the information like
API_USERNAME
API_PASSWORD
API_SIGNATURE
API_ENDPOINT
Now the logic I thought of so far is I will get all the information of teacher while registering i.e given above, and I will also have the admin information of paypal, when the admin will release payment, I will use the details from admin and make a payment in background and transfer it to the teacher's account!
now what if the teacher made a mistake in one of the above information? i will no doubt receive an error on the backend that I can display but what if I can test the user's above given information while registering that will confirm that there will be no issue in transferring money.
so my question is can test user's paypal information somehow? or is there any better logic to my scenario? this is a big project for me and I would appreciate any sort of help!
Thanks in advance for any help.

I would suggest using paypal's new marketplaces api for this type of scenario. I believe it's still in early access so you would have to request access from paypal.
With this solution, you are able to incorporate an "on-boarding" process in which when a teacher registers, you also have them grant you access to accept payments on their behalf.
When a student pays for a course, you would then complete the transaction using the teachers paypal account and set the status to "DELAYED". A delayed order status tells paypal to hold the funds before transferring them to the teachers account. To disburse the funds you would then be able to login to your admin interface and make a call to the api which tells paypal to release the funds to the teacher.
If paypal is not a prerequisite and you are only looking to accept payments via credit card, you can also accomplish this scenario using stripe, which in my experience is a much more straight forward process and is readily available without the need to request permission.
With stripe you have a similar onboarding process when a teacher registers. If they do not have an existing stripe account they are prompted to create one, then allow your application access to accept payments on their behalf.
When a student pays for a course, you would save their payment method(information is stored on stripe and you are issued a reference token) and alert the admin that a purchase is pending approval. The admin would then approve or deny the purchase. It is at this stage when the students payment method would be used to create the charge.
Hope this helps.

Related

Write-off and replenishment of funds for the object Customer in Stripe

Good afternoon. Interested in a question related to the integration of Stripe.
The business task is as follows: We have products in which you can invest your money (P1), we also have a system of rewards for users (P2, P3). The creator of the project (P0) also receives some kind of reward.
Question:
How to create a list of users so that they can deposit money and we can reward them with rewards in the future. I know about such objects in the Strip as Session Hescote (for debiting funds from the card) and Payout (for crediting to a bank account). But the Checkout object is created for the Customer, and Payut for the Account Connect. How to be?
Is it possible to create an Account with the Cyst type, without filling in the bank details in detail. Let's say only the card number and that's it?
Can someone share their solution? The main task is to realize investment in the project, as well as encouraging users (crediting money to the client's card).
Stripe is, in general, a ONE-WAY payment processor - FROM "Customers who make payments via various methods" TO "Business Accounts that take payments" - either the Platform, or connected Accounts.  Stripe does NOT make payments or transfers to "Customers", and does NOT transfer funds between Connected Accounts.
There is a (far more complex) "Banking as a Service" as well...
Their ToS (Terms of Service) also explicitly says they generally do not support crowd-funding and equity-funding services...
Guys I found the solution, thanks for the help everyone.
I'm attaching a flow below that works for me.
Creation of a sub account in the Stripe system.
Each system user (project creator, investor, ambassador) will be created in the Stripe system as a separate user through the functionality (https://stripe.com/docs/connect).
Verification and data filling.
Each user will need to fill out their profile in Stripe for the system to work correctly. The data entry form is provided by Stripe. (https://stripe.com/docs/connect/connect-onboarding)
Investment. The money goes to the main account.
To invest in a product, you need to create a Checkout widget, this functionality is provided by Stripe. It is required to specify information about the product and set a price, and then ask the user of our system (the Investor) to enter the bank card details. (https://stripe.com/docs/payments/checkout)
The distribution of funds received between the main account and under the account.
Once funds are deposited into Stripe's account, the funds need to be distributed among customers.
To distribute funds, you need to use (https://stripe.com/docs/api/transfers)
Withdrawal of funds to the user's account.
After there is money on the client's account, you can withdraw it through the functionality (https://stripe.com/docs/api/payouts)

Which paypal api to use

I want to make sure I am using the correct api before investing a bunch of time understanding/learning it. I want to use paypal to allow users of my web application to charge other users.
A user (user A) will create a fee;
A different user (user B) will pay user A via my web application. There would be many users Bs;
The web application is independent of users A and B;
The web application would not store the credit card info (hense paypal).
Eventually, I would like to add the ability for user C to create a form and add a fee to the end of the form for user A to pay. user A would then charge user B their portion of the fee charged by user C to user A.
I have not done a lot of homework with the api but I am hoping to use curl and/or php.
Additionally, I have been looking at stripe. It seems like a far more simple api but has limited capabilities.
The best solution is to use Adaptive Payment. However Adaptive Payment in PayPal is open to a selected merchant. If you wish to use that, I suggest you to file a ticket to their MTS and they will assist you further on this.
Contact them here.

PHP: PayPal Integration

im building a site where 2 user groups exist: sellers and buyers. The buyers buy stuff and should pay to the sellers via PayPal.
So, its not a kind of a web shop where users are paying directly to me ( as a website owner/online shop), BUT TO THE OTHER USERS (sellers). So i need to forward a PayPal transaction from one user on my site (buyer) to the other one (seller).
I read some PayPal API Descriptions, but its assumed there that i want to process the PayPal Payments to my PayPal account, what's not my case.
An idea would be that sellers pay to me, and i then pay to buyers, but that's not what i want to do.
So , what I want is: the buyer should process the PayPal payment directly to the seller's PayPal account, and i should then receive the payment confirmation and inform the seller about it.
Does anyone have an idea, expirience or suggestion with this stuff? Thanks in advance!
You have a lot of options for how you can handle that.
One, you could use the Express Checkout API to build the checkout system, and you'd use the Permissions API (optional) so that users can easily grant your application permissions to make API calls on their behalf. Note that users could also do this manually through their PayPal profile until you get the Permissions part integrated.
To get your payments, you could have your users create a preapproval profile using the Preapproval API. This will allow you to submit payments on their behalf automatically at any time. As such, you could use the preapproval key within Pay calls directly in the checkout flow or within IPN (which is what I would recommend) to submit payments to yourself from the user's account.
Another option is to use a parallel payment within Express Checkout. This would handle splitting the payment for you automatically between the seller and yourself, but the buyer would see that split during checkout.
Another option would be to use the Pay API for the checkout which would allow you to create a chained payment. This is the same as a parallel payment except that it hides the split from the buyer, and you could actually delay the payment to secondary receivers if you need to for any reason.
Hope that helps.
if you have a buy now button or similar, use the sellers' email address as below
<input type="hidden" name="business" value="sellers#email.com">
and it will pay the user with that email address. If that's not their paypal address, it will prompt them to either sign up for paypal to receive or add it to a current account.
Then use PHP mail() or your CMS/Admin system to notify you when the successful payment page has been loaded after a referral back from Paypal.

How do I get data back from Paypal so I can alter my MySQL database accordingly?

I'm just starting out with Paypal, so this is a newbie question.
I've been going through the instructions for setting up Paypal subscription service, but I think I'm looking at the wrong thing.
What I want to acheive is to get back some kind of response from Paypal so that I can update the database on my web site to mark a registered user as having paid. Basically I have a flag in the database that says if the user is subscribed or not. I want to ensure that the user is marked as paid so long as their Paypal subscription is maintained.
While the instructions linked above do say how to set up a button to receive a payment, there's nothing there about getting any data back from Paypal.
I know there are terms like IPN and sandbox that are related to what I'm trying to do, but I can't find clear instructions for how to get started on this process. I'm just circling around and not getting anywhere.
Where do I start on setting this up? Where is there a clear beginner's tutorial?
Also, I'm using PHP/Javascript/MySQL on my website.
PayPal's IPN service is what you want to use. I've used it myself to do just what you're looking to do.
Instant Payment Notification (IPN) is PayPal's message service that
sends a notification when a transaction is affected. Once IPN is
integrated, sellers can automate their back office so they don’t have
to wait for payments to come in to trigger order fulfillment. IPN can
send notifications for these transactions:
Instant payments, including Express Checkout and direct credit card payments
eCheck payments and pending, completed, or denied status payments
Pending payments
Recurring payments and subscriptions
Authorizations
Disputes, chargebacks, reversals, and refunds
You can also view notifications on PayPal’s IPN History page and
resend them if you need to. As PayPal’s interface for handling
purchase confirmation and server-to-server communications, IPN can
also be used to manage and customize a variety of APIs and
communications, including:
Customize your website's response to customer purchases in seconds
Track customers via IPN "pass-through" variables
Notify sellers who deal mostly in software downloads and other digital, online goods
Track affiliate sales and commissions
Store transaction information in your own database
For more about IPN:
Technical Overview (link to new html version of docs on developer central)
Instant Payment Notification Guide (PDF)
Code Samples
I'm not sure if its the same thing, but I just setup my friends website with Express Checkout, and I wanted to add all paid orders to an orders table in my database.
After I call SetExpressCheckout, and the user is returned to my site after going through the purchase flow on Paypal's side,
I used the information from GetExpressCheckoutDetails.
Then, if DoExpressCheckoutPayment
is successful (also called from the "callback" page) I then do the appropriate work in my database as far as logging the order details. For you in this case, it could be updating a record for the user in the database.
Hope that helps a little.

Split Paypal payment into two accounts

I'm currently creating a system that lets admins create events and allow individuals to register for those events. Each registration has a fee associated with it, which registrants pay using PayPal. When an event is created, the admin inputs the PayPal account for which the money will be deposited. I then charge a set price per registration as the fee for the service. Is there a way to automatically take my cut of the fee when the payment is submitted to Paypal?
I've looked at the Mass Pay option with PayPal, but that means all the money has to go into a central account and then get divided out from there (if I understand it right). I would rather stay away from all money going into a central account, as there gets to be a lot of liability involved there.
Now, I'm not 100% tied to PayPal, so if anyone else knows of another service that would work, I would be glad to hear about it. I'm sure someone else has run into this before...
Look into Paypal Adaptive Payments. It allows for payments to be sent to two parties.

Categories