PayPal Onboard sellers before payment - paypal

I am trying to create an application that enables sellers to create a PayPal account which then my platform will use their PayPal details to payout them whenever a pucharse is made via the application. I checked the documentation for creating a seller onboarding sign-up link but I couldn't able to figure out how to use this in the NodeJS environment.
curl -v -X POST https://api-m.sandbox.paypal.com/v2/customer/partner-referrals \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <Access-Token>" \
-d '{
"tracking_id": "<Tracking-ID>",
"operations": [
{
"operation": "API_INTEGRATION",
"api_integration_preference": {
"rest_api_integration": {
"integration_method": "PAYPAL",
"integration_type": "THIRD_PARTY",
"third_party_details": {
"features": [
"PAYMENT",
"REFUND"
]
}
}
}
}
],
"products": [
"EXPRESS_CHECKOUT"
],
"legal_consents": [
{
"type": "SHARE_DATA_CONSENT",
"granted": true
}
]
}'

There is no SDK for such APIs, but you could use the code (for other APIs) in Checkout-NodeJS-SDK as a starting point and use it to create your own HTTPS calls for this API you want to integrate, based on that curl sample.
Alternatively, use one of the many HTTPS request libraries available for NodeJS, such as axios or got, to implement the request of that curl sample. You will need to implement an Oauth2 request first to get an Access Token with the clientid/secret.

Related

PAYEE_NOT_ENABLED_FOR_CARD_PROCESSING - Error when creating an order with payment information to be processed with Paypal

I'm getting the following error when attempting to create an Order in a Live Application:
{
"issue": "PAYEE_NOT_ENABLED_FOR_CARD_PROCESSING",
"description": "Payee account is not setup to be able to process card payments. Please contact PayPal customer support."
}
I did not get this error when building out the API in the Sandbox environment, I've tried to contact support multiple times, at this time I've spoken to over 5 different support representatives and bounced around between various departments but no one seems to be able to point me in the right direction as to how I can address this account restriction.
I'm sending in the following request:
curl -v -X POST https://api-m.paypal.com/v2/checkout/orders \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <Access-Token>" \
-H "PayPal-Request-Id: ######" \
-d '{
"intent": "AUTHORIZE",
"purchase_units": [
{
"reference_id": "d9f80740-38f0-11e8-b467-0ed5f89f718b",
"amount": {
"currency_code": "USD",
"value": "100.00"
}
}
],
"payment_source": {
"card": {
"number": "4111111111111111",
"expiry": "2023-02",
"billing_address": {
"postal_code": "95131",
"country_code": "US"
}
},
"stored_credential": {
"payment_initiator": "MERCHANT",
"payment_type": "ONE-TIME",
"usage": "DERIVED"
}
}
}'
The expectation is that users can enter in their card details through a Phone IVR that data gets passed off to Paypal in the form of an order for a transaction to processed. I tested the workflow in the Sandbox and it worked just fine, but for some reason it just does not work in the Live App.
The integrate card payments documentation has a note that says:
Before you go live, you need to complete production onboarding to be eligible to process cards with your live PayPal account.

How do I create a JWT Token for Prime Trust's API?

I am working with Prime Trust's API and I'm unable to create a JWT token. I am following the documentation which states the following:
Getting Started with the Custody APIs - (Sandbox Specific)
You need totake the current steps to get started via the APIs
Create a new User
Authenticate with the APIs by getting a JWT.
Create an Account.
Test Mode APIs - Approve the owner of the account for CIP and AML.
Test Mode APIs - Open an Account for Funds
I was able to create a user following the documentation, but I'm stuck on the creation of the JWT Token. According to the documentation I should create the token using the below:
JSON Web Tokens (JWTs)
JSON Web Tokens or JWTs are the preferred method of authentication for all requests besides actually generating a JWT. Since JWTs are not persisted server resources, they are not created using a JSONAPI style request or response.
Creating a new JWT
A new JWT can be created by passing a user's credentials using HTTP
Basic Authorization to the following endpoint. Any special settings on
the JWT such as IP whitelisting, expiration time or TOTP MFA must be
passed in as form values during creation.
POST /auth/jwts
Here's the example call they give:
curl --location --request POST "https://sandbox.primetrust.com/auth/jwts" \
--header "Content-Type: application/x-www-form-urlencoded" \
--form "expires_at=2019-06-06T07:30:40Z" \
--form "otp=382948" \
--form "cidr[]=192.168.1.213/32" \
--form "cidr[]=127.0.0.1/32"
I've tried a combination of different calls with the details outlined below, but have the below error on all of my attempts:
401 Unauthorized
{
"errors": [
{
"status": 401,
"title": "Not authenticated."
}
]
}
Bodies
POST https://sandbox.primetrust.com/auth/jwts
POST https://sandbox.primetrust.com/auth/jwts
{
"email": "email#email.com",
"password": "123abc"
}
POST https://sandbox.primetrust.com/auth/jwts
{
"data": {
"email": "email#email.com",
"password": "123abc"
}
}
POST https://sandbox.primetrust.com/auth/jwts
{
"name": "name",
"email": "email#email.com",
"password": "123abc"
}
POST https://sandbox.primetrust.com/auth/jwts
{
"id": {guid},
"name": "name",
"email": "email#email.com",
"password": "123abc"
}
POST https://sandbox.primetrust.com/auth/jwts
{
"id": {guid},
"password": "123abc"
}
Headers
Content-Type: application/json
expires_at: 2019-12-31T11:59:59Z
alg: HS256
typ: JWT
I recognize that my calls don't line up with the example call exactly, but my understanding from the documentation is that all that should be required is a name & password to generate the JWT token. What am I missing?
Update 1
Based on reaching out to Prime Trust support the username/email need to be included as parameters rather than in the body of the url. I tried the below URLs without success
https://sandbox.primetrust.com/auth/jwts?email=email#email.com&password=123abc&id={guid}
https://sandbox.primetrust.com/auth/jwts?email=email#email.com&password=123abc
https://sandbox.primetrust.com/auth/jwts?password=123abc&id={guid}
https://sandbox.primetrust.com/auth/jwts?name=name&password=123abc
According to docs:
Creating a new JWT
A new JWT can be created by passing a user's credentials using HTTP Basic Authorization to the following endpoint. Any special settings on the JWT such as IP whitelisting, expiration time or TOTP MFA must be passed in as form values during creation.
So basically all you need is create an Authorization header set to Basic Auth with your credentials:
curl -X POST \
https://sandbox.primetrust.com/auth/jwts \
-H 'Authorization: Basic YOUR_BASE64_ENCODED_EMAIL_AND_PASSWORD' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'cache-control: no-cache'

How to list all assets in a catalog in watson data science experience?

I have created a Watson data science experience (DSX) account, created a catalog into it and added data assets to it.
I am trying to use the REST APIs as documented at: https://developer.ibm.com/api/view/id-1084:title-Watson_Data_Platform_Core_Services#id36962
... to retrieve the assets using curl.
curl -H "Authorization: Bearer <---stripped the auth token --->" -X GET 'https://api.dataplatform.ibm.com/v2/assets?catalog_id=bd2b56c3-091f-4ff5-beab-b3a1da85488d'
I get the following response:
{
"errors": [
{
"code": "invalid_parameter",
"message": "COMSV3006E: Missing or Invalid 'asset' id",
"target": {
"name": "asset",
"type": "parameter"
}
}
],
"trace": "e7b07khusvkj7s0ymgrggm6si"
}
How do I specify the asset id to retrieve the same?
Also, I am looking to upload assets, assign metadata/tags to existing assets using REST APIs. Is there any documentation/tutorial available, which can help explain me that?
One option is the search api, although it is listed as deprecated:
curl -X POST -d '{"query":"asset.asset_state:available"}' -H "Content-Type: application/json" https://api.dataplatform.ibm.com/v2/catalogs/<catalog_guid>/types/<type>/search -H "Authorization: Bearer ...."
https://developer.ibm.com/api/view/id-1084:title-Watson_Data_Platform_Core_Services#id37001
For <type>, you probably want data_asset, but you can also look up all existing types:
curl -X GET https://api.dataplatform.ibm.com/v2/catalogs/<catalog_guid>/types -H "Authorization: Bearer ...."
https://developer.ibm.com/api/view/id-1084:title-Watson_Data_Platform_Core_Services#id36916

Uber /requests api response status "409 surge" with empty response body

As mentioned in the doc https://developer.uber.com/docs/v1-requests
The response should be
{
"meta": {
"surge_confirmation": {
"href": "https://api.uber.com/v1/surge-confirmations/e100a670",
"surge_confirmation_id": "e100a670",
"multiplier": 1.4,
"expires_at": 1459191276
}
},
"errors":[
{
"status": 409,
"code": "surge",
"title": "Surge pricing is currently in effect for this product."
}
]
}
I am implementing Uber API in one of my app, Testing the surge pricing feature. In sandbox mode their is empty response of /requests api with http status 409 surge.
Is their any other way to test the surge pricing feature?
Can you show some example code that gives you a 409 with an empty response? In sandbox you need to PUT a surge multiplier for the product you want before making a request for that product that you want to see surging. You can read more here https://developer.uber.com/docs/sandbox and see a template curl below
curl -X PUT -H "Authorization: Bearer {{YOUR_TOKEN}}" -H "Content-Type: application/json" -d '{"surge_multiplier": 2.2, "drivers_available": true}' "https://sandbox-api.uber.com/v1/sandbox/products/{{YOUR_PRODUCT_ID}}

INTERNAL_SERVICE_ERROR PayPal REST API https://api.paypal.com/v1/payments/payment

Using "LIVE" credentials, I'm getting an INTERNAL_SERVICE_ERROR accepting a credit card payment, using this resource: https://api.paypal.com/v1/payments/payment. Same error happens on the web and via cURL. NOTE: This does not happen in SANDBOX only LIVE. See steps to recreate below. For this post, I had to add a space in "http s" as I cannot submit more than 2 links.
Get an OAuth token (substitute username/password in LIVE_USER_ID:LIVE_PASSWORD
curl http s://api.paypal.com/v1/oauth2/token -H "Accept: application/json" -H "Accept-Language: en_US" -u "LIVE_USER_ID:LIVE_PASSWORD" -d "grant_type=client_credentials"
No problem getting a token using LIVE credentials. Add the token to the following request to the resource:
curl -v http s://api.paypal.com/v1/payments/payment \
-H "Content-Type:application/json" \
-H "Authorization:Bearer YK.GUHkGhBAQgGgGkilvHoL7DdE9SVq.IDl-mRwAZeM" \
-d '{
"intent": "sale",
"payer": {
"payment_method": "credit_card",
"funding_instruments": [
{
"credit_card": {
"number": "5500005555555559",
"type": "mastercard",
"expire_month": 12,
"expire_year": 2018,
"cvv2": 111,
"first_name": "Joe",
"last_name": "Shopper"
}
}
]
},
"transactions": [
{
"amount": {
"total": "0.01",
"currency": "USD"
},
"description": "This is the payment transaction description."
}
]
}'
"name":"INTERNAL_SERVICE_ERROR","message":"An internal service error has occurred","information_link":"http_s://developer.paypal.com/webapps/developer/docs/api/#INTERNAL_SERVICE_ERROR","debug_id":"525bfb7a6382a"}johnruffin:~ johnruffin$
Thoughts???
Thanks for bringing this issue to our attention. I've opened an internal bug with the payments rest api development team. From the debug id provided I see that the credit card is being refused. In the future the error message from this scenario will fall under this error condition: https://developer.paypal.com/webapps/developer/docs/api/#CREDIT_CARD_REFUSED
Please try a another/valid credit card to verify.
Looks like the URL is not well formed. It's https and not http s as provided above.
Tried the calls now, it works fine. Please check and confirm.