Paypal Direct Payments Api Arguments - paypal

I am trying to access the Paypal Direct Payements Api using cURL and I get this response:
TIMESTAMP=2020%2d11%2d25T10%3a53%3a01Z&CORRELATIONID=7877664ffef0b&ACK=Failure&L_ERRORCODE0=10004&L_SHORTMESSAGE0=Invalid%20Request%20Error%2e&L_LONGMESSAGE0=Transaction%20refused%20because%20of%20an%20invalid%20argument%2e
An this is the cURL statement minus the credentials:
curl https://api-3t.sandbox.paypal.com/nvp --insecure -d VERSION=56.0 -d SIGNATURE=hidden -d USER=hidden -d PWD=hidden -d METHOD=DoDirectPayment -d PAYMENTACTION=Sale -d IPADDRESS= -d AMT=8.88 -d CREDITCARDTYPE=Visa -d ACCT=4032032245382681 -d EXPDATE=10/2021 -d CVV2=283 -d FIRSTNAME=John -d LASTNAME=Doe -d STREET=MohlalaRd -d CITY=Nelspruit -d STATE=Mpumalanga -d ZIP=1201 -d COUNTRYCODE=ZA

EXPDATE=10/2021
This is the invalid argument, format is MMYYYY
DoDirectPayment requires a live PayPal Payments Pro account for use in live and is an old API, you should not be using it in new integrations. Also version 56 is an extremely old version of the classic NVP API. If you were to be integrating something like this with a classic API (which you should not be doing), you would at the very least want to use a reasonably recent version such as 202.
See Advanced Credit and Debit Card Payments instead, or use Braintree if you need a gateway.

Related

How to assemble preemptive auth in curl command , while using POST method

I need to use POST method for a REST API.It's working perfectly in SOAP UI while i select "Preemptive Authentication" , I need to assemble this authentication option in Curl.
At Web service , preemptive properties has not set. It has only Basic authentication system with username & password.
I have tried --anyauth , it's not working. I have below command.
curl -X POST -H "content-type:application/json" --verbose -u username:password http://example.net:1234/api/Flows/UpdateStatus -d '{"EventId": "123","Status": "success"}'
I am always getting below error.
{"Message":"Authorization has been denied for this request."}
I had tried with providing base64 encoded value of user & password at header section instead of providing user & password under user section ,and it got worked for me.
curl -X POST -H "content-type:application/json" --verbose -H "Authorization: Basic Base64_encoded_value_of_user_&_password" http://example.net:1234/api/Flows/UpdateStatus -d '{"EventId": "123","Status": "success"}'

Sending payment using PayPal from my app's users

I would like to create an app where users would authorize my app with their PayPal account and then my app would be able to send payments to other PayPal users in their name without them having to do anything anymore (imagine background cron payments). I was looking at PayPal APIs but it seems that most APIs are meant to be used in a way that app is a receiver or sender of money, and not that app just coordinates sending or receiving money for its users, or that user has to be in a loop because protocol with redirect to PayPal for user's confirmation.
Is there a PayPal API for this?
It sounds like you're describing a third party Mass Pay. Mass pay would take money from their PayPal account and send it to another account. For your part, you would need third party authorization for each account they wanted to send from. This would require them to authorize your API username. MassPay doesn't require them to subscribe to anything (you pay when you use it).
You can use this api:
"Use the Pay API operation to transfer funds from a sender's PayPal account to one or more receivers' PayPal accounts"
https://developer.paypal.com/docs/classic/api/adaptive-payments/Pay_API_Operation/
Example, Preapproved payment example:
"In this example, the sender has a valid preapproval agreement with you and makes a payment of $100 to a PayPal-registered receiver and $50 to another PayPal-registered receiver. The payment is completed without the sender logging in to paypal.com."
curl https://svcs.sandbox.paypal.com/AdaptivePayments/Pay \
-s \
--insecure \
-H "X-PAYPAL-SECURITY-USERID: api_username" \
-H "X-PAYPAL-SECURITY-PASSWORD: api_password" \
-H "X-PAYPAL-SECURITY-SIGNATURE: api_signature" \
-H "X-PAYPAL-REQUEST-DATA-FORMAT: NV" \
-H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV" \
-H "X-PAYPAL-APPLICATION-ID: app_id" \
-d actionType=PAY \
-d cancelUrl=http://your_cancel_url \
-d currencyCode=USD \
-d feesPayer=EACHRECEIVER \
-d memo=Preapproval-payment-example \
-d preapprovalKey=PA-9JR04288NR0519129 \
-d receiverList.receiver(0).amount=100.00 \
-d receiverList.receiver(0).email=receiver1#domain \
-d receiverList.receiver(0).primary=false \
-d receiverList.receiver(1).amount=50.00 \
-d receiverList.receiver(1).email=receiver2#domain/em> \
-d receiverList.receiver(1).primary=false \
-d requestEnvelope.errorLanguage=en_US \
-d returnUrl=http://your_return_url \
-d reverseAllParallelPaymentsOnError=true \
-d senderEmail=sender#domain
Edited:
How to Set Up a Payment Preapproval Using Adaptive Payments,
https://developer.paypal.com/docs/classic/adaptive-payments/ht_ap-basicPreapproval-curl-etc/
You can do this with PayPay's Adaptive Payments API.
https://developer.paypal.com/webapps/developer/docs/classic/products/adaptive-payments/
You can enable "Funds Transfer within a Group" and allow "person-to-person" payments. Pretty cool stuff.
https://developer.paypal.com/docs/classic/use-cases/uc_social-transfers-within-group/

Bluemix - Natural Language Classifier credentials in the Questions on classifier demo

I'm trying to use IBM Watson Natural language Classifier but I can't proceed and load my answers. For some reason, username and password aren't working all the time.
This one executed fine:
curl -u username:password -F training_data=#questions.csv -F
training_metadata="{\"language\":\"en\",\"name\":\"my_classifier\"}"
"https://url/v1/classifiers"
But when I try to execute the following command, it doesn't work:
curl -u username:password -X POST -H "Content-Type: application/json"
-d #questions-with-classifier-ega-war/target/classes/answers.json http://yourAppName.mybluemix.net/api/v1/manage/answer
It just asks for the user and password again and again. It is the same password that just worked in the first curl command.
Thanks in advance!
I think you are confusing the service credentials (the one you use in the first command) with the credentials used to manage the database in one of the sample applications "Questions on Classifier" (see pom.xml).
In order to run your second command make sure you use the credentials from the pom.xml in your root directory

ApiAxle: cannot access stat URL in order to view analytics

I am following the instructions at: http://apiaxle.com/docs/statistics-and-analytics-in-apiaxle/ . Unfortunately currently (May 17, 2014) apiAxle is redirecting me to the endPointserver and I am not getting statist
menelaos:~$ curl 'http://localhost:3000/v/api/test/stats?
granularity=hour&format_timestamp=ISO'
Response:
{"meta":{"version":1,"status_code":404},"results":{"error":
{"type":"ApiUnknown","message":"No api specified (via subdomain)"}}}
I also tried using the subdomain but that didn't work either:
menelaos:~$ curl 'http://test.api.localhost:3000/v/api/test/stats?granularity=hour&format_timestamp=ISO'
Typically you run multiple instances of apiaxle-proxy (which provides access to your endpoints), and a single instances of apiaxle-api (which provides access to statistics, key creation, and other API management functionality).
For example, you might be running the proxy like this:
apiaxle-proxy -f 1 -p 3000 -q
To run the API, you would run something like this:
apiaxle-api -f 1 -p 5000 -q
Note that the API needs to run on a separate port. Also note that it shouldn't be accessible to the outside world as it doesn't have any authentication.
Using the above example, your curl command would look like this:
curl -H 'content-type: application/json' \
-X GET \
'http://localhost:5000/v1/api/test/stats' \
-d '{"granularity":"hour","format_timestamp":"ISO"}'
Note that the parameters need to be sent as JSON.

Correcting SOAP Fault Method not Implemented Errors

OK, not sure what this problem is. I am trying to post an API request to PayPal via cURL and I get the following result. Is there something that I am missing in my call that would cause this?
According to PayPal, the call is correct and it works fine when I use the PHP cURL wrapper functions...Weird.
Thanks for helping!
curl https://api.sandbox.paypal.com/2.0/ -H "X-PAYPAL-SECURITY-USERID: api1.sitetest.com" -H "X-PAYPAL-SECURITY-PASSWORD: 111222222UH24" -H "X-PAYPAL-DEVICE-IPADDRESS: 170.10.125.52" -H "X-PAYPAL-MESSAGE-PROTOCOL: SOAP11" -H "X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T" -E "/Users/Me/Library/PayPal_Keys/cert_key_pem.txt" -d "<SOAP-ENV:Envelope xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><SOAP-ENV:Header /><SOAP-ENV:Body><CreateAndSendInvoiceRequest><requestEnvelope><errorLanguage>en_US</errorLanguage></requestEnvelope><invoice><merchantEmail>sweet#sweetsounds.com</merchantEmail><payerEmail>me#testsite.com</payerEmail><businessName>Test Business, Inc.</businessName><logoURL></logoURL><itemList><item><name>Test Item</name><quantity>2</quantity><unitPrice>5.79</unitPrice><taxName>sales</taxName><taxRate>6.0</taxRate></item></itemList></invoice></CreateAndSendInvoiceRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"
Returns
<SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode><faultstring>Method not implemented</faultstring></SOAP-ENV:Fault>
Solved this. PayPal changed the sandbox api url for this particular call and did not update that in their docs.
new url for sandbox is "https://api-3t.sandbox.paypal.com/2.0/". You can test your commands here