Send money automatically using Paypal Adaptive payments

Here is the user script:

“John has 5 virtual loans with his account on the website, he can convert his virtual loans into real money by clicking the button on the website. Then the website will give him real money through paypal, and John has a PayPal account records or not. "

I would like to know if this scenario can be placed in place?

Of course, for security reasons, I will check on the server side all the data necessary for safe operation.

Can I automate it without any action from the administrator of the website?

Thank you for your responses!

EDIT:

I found this post: https://www.x.com/devzone/articles/using-adaptive-payments-disburse-cash-prizes-real-time-easter-eggs

I will try to adapt it for my scenario. I am updating my post today when I finish the integration.

EDIT 2:

Everything seems to be in order, but I try to get the application identifier from www.x.com they ask me about how I use the API:

Hi and thanks for your introduction,

Before we continue our review, can you clarify the required API?

  • Can you explain your use of Implicit Payments, which will be used to pay your users from your PayPal account? If this is not required, deselect from the "Services Used in App-Adaptive Payments - Basic Payments" section of your message.

  • You have also chosen preapproval, which is an advanced API that requires in-depth review. This will be used to create a Billing Agreement with your customers (as in the "Subscription Business Model"). If necessary, fill out the Pre-Approval Terms field and let us know how we can test the prepaid payment flow on your site. If this is not required, deselect it in the "Services Used in the App - Adaptive Payments" section of your submission.

Note. You will need to click the application name in the "My Applications" section of x.com to expand and change the fields on the submit form.

What should I do?

EDIT 3:

Ok, I had the blessing of Paypal, now I can use the API with live credentials! I turned off pre-approvals and everything went well.

Last question, but no less:

How can I set up my Adaptive payment to change the payment in the pending process and give the seller the opportunity to verify the payment?

Here is a usage example to better understand the situation:

"John wants to convert 5 virtual loans to $ 5, he presses the withdraw button, and the web application automatically sends him real money to his PayPal account. Dr house wants to convert 100 virtual loans to $ 100, this amount needs administrator approval, this the administrator logs into his PayPal account and checks to see if everything is in order, he confirms the payment, then Dr. House will receive his money! "

I found this option:

$PayRequestFields = array( 'ActionType' => 'PAY', // Required. Whether the request pays the receiver or whether the request is set up to create a payment request, but not fulfill the payment until the ExecutePayment is called. Values are: PAY, CREATE, PAY_PRIMARY 

If you change the PAY value to CREATE, it does nothing.

Right!

+4
source share
2 answers

You can configure this for automation. If you specifically want to use Adaptive Payments, you would like to use the Adaptive Payments Pay API to send money to John. However, John will need PayPal to gain access to money and raise funds.

+2
source

I got it in sandbox mode with this code, have not tried living yet:

  ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; var request = (HttpWebRequest)WebRequest.Create("https://svcs.sandbox.paypal.com/AdaptivePayments/Pay"); request.ContentType = "application/json"; request.Method = "POST"; request.Headers.Add("X-PAYPAL-SECURITY-USERID", apiUsername); request.Headers.Add("X-PAYPAL-SECURITY-PASSWORD", apiPassword); request.Headers.Add("X-PAYPAL-SECURITY-SIGNATURE", apiSig); request.Headers.Add("X-PAYPAL-APPLICATION-ID", "APP-80W284485P519543T"); // sandbox app id request.Headers.Add("X-PAYPAL-REQUEST-DATA-FORMAT", "JSON"); request.Headers.Add("X-PAYPAL-RESPONSE-DATA-FORMAT", "JSON"); JObject j = new JObject(); using (var streamWriter = new StreamWriter(request.GetRequestStream())) { string json = "{ \"actionType\": \"PAY\", \"currencyCode\": \"GBP\", \"useCredentials\": \"FALSE\", \"senderEmail\": \" admin@example.com \",\"ipnNotificationUrl\": \"http://example.com/IPN.aspx\", \"receiverList\": {\"receiver\": [{\"amount\": \"1.00\", \"email\": \" receiver@gmail.com \" }] }, \"returnUrl\": \"http://example.com/thanks.aspx\", \"cancelUrl\": \"http://example.com/cancel.aspx\", \"requestEnvelope\": { \"errorLanguage\": \"en_US\", \"detailLevel\": \"ReturnAll\" }}"; streamWriter.Write(json); streamWriter.Flush(); streamWriter.Close(); } var httpResponse = (HttpWebResponse)request.GetResponse(); string sResult = ""; using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) { sResult = streamReader.ReadToEnd(); } 

A few things to watch out for:

  • make sure the request is valid JSON and you don't accidentally mess up the syntax
  • make sure that you are using the correct enclosure for query parameters
  • make sure you use credentials for the sandbox if you submit the sandbox url
  • Add your code to verify the transaction (amount, payee, etc.) in the IPN URL you specify.

This makes an automatic payment from your account to a recipient who does not need authorization to enter the system.

0
source

All Articles