Unauthorized payment error in paypal while using LIVE credentials - paypal

I am using Paypal REST API for payments.All was working fine with sandbox credentials but when I switched to LIVE credentials.It is giving errors like this :
Request to paypal API :
{
"body": {
"intent": "sale",
"payer": {
"payment_method": "credit_card",
"funding_instruments": [
{
"credit_card_token": {
"credit_card_id": "CARD-7314506536077511MK7WL121",
"payer_id": "57ecbbed656c78519a28382c"
}
}
]
},
"transactions": [
{
"amount": {
"currency": "USD",
"total": 10
},
"description": "Payment taken from customer Neha for booking #SR1032 and to be send to SP Neha and SP paypal Id hello#y.bom"
}
]
},
"header": {
"x-pp-ads-performed": "false",
"content-length": "374",
"pp_remote_addr": "54.244.2.156",
"paypal-request-id": "2afb7a93-0cc2-4ab2-b216-45b8de908f9f",
"pp_geo_loc": "US",
"x-pp-silover": "name=LIVE3.API.1&silo_version=880&app=platformapiserv&TIME=2734681175&HTTP_X_PP_AZ_LOCATOR=",
"host": "api.paypal.com",
"accept": "application/json",
"client-auth": "No cert",
"connection": "close",
"x-pp-idempotencyid": "eabb84d3ef438_1475149730",
"x-slr-orig-script_uri": "https://api.paypal.com/v1/payments/payment/",
"x-pp-slingshot-targetapp": "platformapiserv",
"x-pp-corrid": "eabb84d3ef438",
"user-agent": "PayPalSDK/PayPal-node-SDK 1.6.9 (node v4.5.0-x64-linux; OpenSSL 1.0.2h)",
"content-type": "application/json",
"authorization": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx9T1G"
},
"additional_properties":
Response from paypal server
{
"status": 401,
"duration_time": 49,
"body": {
"message": "Unauthorized payment.",
"debug_id": "eabb84d3ef438",
"information_link": "https://developer.paypal.com/webapps/developer/docs/api/#UNAUTHORIZED_PAYMENT",
"name": "UNAUTHORIZED_PAYMENT"
},
"additional_properties": {},
"header": {
"Content-Length": "191",
"Content-Language": "*",
"CORRELATION-ID": "eabb84d3ef438",
"Date": "Thu, 29 Sep 2016 11:48:50 GMT",
"Connection": "close",
"Paypal-Debug-Id": "eabb84d3ef438",
"PROXY_SERVER_INFO": "host=dcg12javapapi7866.dcg12.slc.paypalinc.com;threadId=704",
"Content-Type": "application/json"
}
}

Related

How I can create payment document in FlowPay

According to document I am testing API using Insomnia. Generating a payment document is a single operation that I have used a single POST call to the intended document endpoint
create, for example:
POST https://app.sandbox-new.flowpay.it/api/:tenantID/invoices
Content-Type: application/json
Authorization: Bearer <accessToken>
Body:
{
"attachments": null,
"currency": "EUR",
"date": "2022-08-23T17:32:28Z",
"items": [
{
"amount": 123.12,
"description": "hello",
"quantity": 1
}
],
"number": "123465",
"recipientIban": null,
"recipientVat": "132412341",
"senderIban": null,
"senderVat": "23412341245",
"terms": [
{
"amount": 123.12,
"description": "hello",
"expire": "2022-08-25T17:32:28Z",
"information": "hello",
"method": null,
"recurringInfo": null
}
]
}
To get :tenantID I have followed flowpay documentation
But I am getting not authorized to upload this invoice error message.
{
"errorDescription": "not authorized to upload this invoice",
"code": 2003,
"statusCode": 401,
"requestID": "1FAF3537-FA0B-4642-AF75-94FE9FDC8E2A",
"service": 2
}
Any body help me please. Thanks

no webhook calls with subscription in paypal sandbox mode

With php and curl i create billing plans, subscriptions, get the paypal link and proceed to the payment. Everything works and i get the following webhook calls :
Billing plan created
Billing subscription created
Billing subscription activated
Paiement sale completed
So far so good. The problem is that i specified the subscription to a renewal of 1 DAY so i could check what happens when a new regular payment arrives... and nothing.
I don't know if the sandbox does not implement a real subscription with all the correct webhook callback of if i'm doing something wrong. I would be pretty pissed to be forece to develop that in production mode !
Any ideas ?
Any ideas how to test the recurring payment ?
Here is the data i get from paypal API when i call billing_subscription:
You can view it properly on https://jsoneditoronline.org/
{
"billing_cycles": [
{
"frequency": {
"Interval_count": 1,
"interval_unit": "DAY"
},
"pricing_scheme": {
"create_time": "2021-08-11T13:47:42Z",
"fixed_price": {
"currency_code": "EUR",
"value": "2.0"
},
"update_time": "2021-08-11T13:47:42Z",
"version": 1
},
"sequence": 1,
"tenure_type": "REGULAR",
"total_cycles": 120
}
],
"create_time": "2021-08-11T13:47:42Z",
"description": "offre Basic TEST avec un debit tous les jours",
"id": "P-8AF2870811319631YMEJ5J7Q",
"links": [
{
"encType": "application/json",
"href": "https://api.sandbox.paypal.com/v1/billing/plans/P-8AF2870811319631YMEJ5J7Q",
"method": "GET",
"rel": "self"
},
{
"encType": "application/json",
"href": "https://api.sandbox.paypal.com/v1/billing/plans/P-8AF2870811319631YMEJ5J7Q",
"method": "PATCH",
"rel": "edit"
},
{
"encType": "application/json",
"href": "https://api.sandbox.paypal.com/v1/billing/plans/P-8AF2870811319631YMEJ5J7Q/deactivate",
"method": "POST",
"rel": "self"
}
],
"name": "Offre Basic TEST JOUR PAR JOUR",
"payment_preferences": {
"auto_bill_outstanding": true,
"payment_failure_threshold": 3,
"service_type": "PREPAID",
"setup_fee": {
"currency_code": "EUR",
"value": "0.0"
},
"setup_fee_failure_action": "CONTINUE"
},
"product_id": "abonnement-test-basic",
"quantity_supported": false,
"status": "ACTIVE",
"taxes": {
"inclusive": false,
"percentage": "20.0"
},
"update_time": "2021-08-11T13:47:42Z",
"usage_type": "LICENSED"
}
Problem solved (sort-of...)
In production mode, when a recurring paiement is done on a subscription a webhook is called with the event : PAYMENT.SALE.COMPLETED
In sandbox mode, the event is either not sent, either randomly sent days later after when it's supposed to be.

Paypal Rest API/Update Plan cannot update setup fee

I am trying to use the rest API to update a billing plan's setup fee. The plan is active, but not used at the moment. I create a plan for each client for each service because the values are different for each, and if they do not complete the payment process and come back at some future date the values could change.
So if they come back at some time I may need to update the setup_fee, which according to the API docs setup_fee can be changed via PATCH.
So here is the plan prior to the change request.
{
"id": "P-7H193472JB2565539MCC4REI",
"product_id": "PROD-3GK52832VM631252R",
"name": "Access to Gig",
"status": "ACTIVE",
"description": "Access to Gig",
"usage_type": "LICENSED",
"billing_cycles": [
{
"pricing_scheme": {
"version": 6,
"fixed_price": {
"currency_code": "USD",
"value": "9.44"
},
"create_time": "2021-04-25T20:25:47Z",
"update_time": "2021-04-25T20:25:47Z"
},
"frequency": {
"interval_unit": "MONTH",
"interval_count": 1
},
"tenure_type": "REGULAR",
"sequence": 1,
"total_cycles": 0
}
],
"payment_preferences": {
"service_type": "PREPAID",
"auto_bill_outstanding": true,
"setup_fee": {
"currency_code": "USD",
"value": "19.57"
},
"setup_fee_failure_action": "CANCEL",
"payment_failure_threshold": 1
},
"quantity_supported": false,
"create_time": "2021-04-25T19:52:49Z",
"update_time": "2021-04-25T20:25:47Z",
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/billing/plans/P-7H193472JB2565539MCC4REI",
"rel": "self",
"method": "GET",
"encType": "application/json"
},
{
"href": "https://api.sandbox.paypal.com/v1/billing/plans/P-7H193472JB2565539MCC4REI",
"rel": "edit",
"method": "PATCH",
"encType": "application/json"
},
{
"href": "https://api.sandbox.paypal.com/v1/billing/plans/P-7H193472JB2565539MCC4REI/deactivate",
"rel": "self",
"method": "POST",
"encType": "application/json"
}
]
So now I want to update the setup_fee.
PATCH https://api.sandbox.paypal.com/v1/billing/plans/P-7H193472JB2565539MCC4REI
Authorization: Bearer <ACCESS TOKEN>
Content-Type: application/json
{
"path" : "payment_preferences/setup_fee",
"value" : {
"setup_fee" : {
"value" : "220.80",
"currency_code" : "USD"
}
},
"op" : "replace"
}
In response I get:
{
'details' => [
{
'location' => 'body',
'issue' => 'MALFORMED_REQUEST_JSON',
'field' => '/',
'description' => 'The request JSON is not well formed.'
}
],
'links' => [],
'message' => 'Request is not well-formed, syntactically incorrect, or violates schema.',
'name' => 'INVALID_REQUEST',
'debug_id' => '9444da3d14a00'
};
Any idea why this fails? I have tried to change the way the "value" entry is, as just the actual setup_fee, or as a hash with the entire setup_fee structure there.
Thanx
Turns out I had multiple problems, yes the first was I needed the path to be "/payment_preferences/setup_fee", I had forgotten the leading slash.
But also, I needed the json data to be an array of structures rather than a structure.
[
{
"op":"replace",
"path":"/payment_preferences/setup_fee",
"value":
{
"currency_code":"USD",
"value":"500.00"
}
}
]
Thank you all.

Getting invalid_payment response from uber with 400 status code;using rest API

I am using REST API to book and uber ride using: https://api.uber.com/v1.2/requests .
It's not working with payment methods other than Cash.
I am getting 400 with code:invalid_payment
Can someone please help me out;
I am able to make payment using cash & Paytm for Indian locations.
I am not able to make payment using cash for US locations.
I am not able to make payment using the card for Indian & US locations.
When I add a new card via the Uber app and try to book a cab in the uber using the card it works; When I try to use the same card using my app it shows error. After this when I try to book a cab using the uber app; it doesn't work.
This the the response I am getting from Uber:
{
"data": {
"meta": {},
"errors": [
{
"status": 400,
"code": "invalid_payment",
"title": "The rider's payment method is invalid and they must update their billing info."
}
]
},
"status": 400,
"headers": {
"server": "nginx",
"strict-transport-security": "max-age=604800",
"x-frame-options": "SAMEORIGIN",
"content-type": "application/json",
"content-geo-system": "wgs-84",
"date": "Fri, 05 Apr 2019 06:28:50 GMT",
"x-content-type-options": "nosniff",
"content-length": "151",
"cache-control": "max-age=0",
"connection": "keep-alive",
"x-xss-protection": "1; mode=block"
},
"config": {
"transformRequest": {},
"transformResponse": {},
"timeout": 180000,
"xsrfCookieName": "XSRF-TOKEN",
"xsrfHeaderName": "X-XSRF-TOKEN",
"maxContentLength": -1,
"headers": {
"Accept": "application/json, text/plain, /*",
"Content-Type": "application/json",
"authorization": "Bearer JA.ZWU",
"Accept-Language": "en_US"
},
"method": "post",
"url": "https://api.uber.com/v1.2/requests",
"data": "{\"start_latitude\":40.8037381,\"start_longitude\":-73.9577813,\"end_latitude\":40.68780810000001,\"end_longitude\":-73.8057292,\"fare_id\":\"7636a3afa24d7648656aabbcc695bf094d4eed6d9323f3b10a5a5868a47c\",\"product_id\":\"b64-5de2-4539-a35a-986d6e58f186\",\"payment_method_id\":\"0xxxx-90ce-4c1d-a8c4-af7b1a00c3cf\"}"
},
"request": {
"UNSENT": 0,
"OPENED": 1,
"HEADERS_RECEIVED": 2,
"LOADING": 3,
"DONE": 4,
"readyState": 4,
"status": 400,
"timeout": 180000,
"withCredentials": true,
"upload": {},
"_aborted": false,
"_hasError": false,
"_method": "POST",
"_response": "{\"meta\":{},\"errors\":[{\"status\":400,\"code\":\"invalid_payment\",\"title\":\"The rider's payment method is invalid and they must update their billing info.\"}]}",
"_url": "https://api.uber.com/v1.2/requests",
"_timedOut": false,
"_trackingName": "unknown",
"_incrementalEvents": false,
"responseHeaders": {
"Server": "nginx",
"Strict-Transport-Security": "max-age=604800",
"X-Frame-Options": "SAMEORIGIN",
"Content-Type": "application/json",
"Content-Geo-System": "wgs-84",
"Date": "Fri, 05 Apr 2019 06:28:50 GMT",
"X-Content-Type-Options": "nosniff",
"Content-Length": "151",
"Cache-Control": "max-age=0",
"Connection": "keep-alive",
"X-XSS-Protection": "1; mode=block"
},
"_requestId": null,
"_headers": {
"accept": "application/json, text/plain, /*",
"content-type": "application/json",
"authorization": "Bearer JA.VUNU",
"accept-language": "en_US"
},
"_responseType": "",
"_sent": true,
"_lowerCaseResponseHeaders": {
"server": "nginx",
"strict-transport-security": "max-age=604800",
"x-frame-options": "SAMEORIGIN",
"content-type": "application/json",
"content-geo-system": "wgs-84",
"date": "Fri, 05 Apr 2019 06:28:50 GMT",
"x-content-type-options": "nosniff",
"content-length": "151",
"cache-control": "max-age=0",
"connection": "keep-alive",
"x-xss-protection": "1; mode=block"
},
"_subscriptions": [],
"responseURL": "https://api.uber.com/v1.2/requests"
}
}
Actual result should be ride request accepted.

Simple REST API Call from logic app - Azure

First of all I want you to know that I am new to Azure.
Recently, I am trying to work on Azure Logic App.
My motive is to make a simple REST API Call from the HTTP API (from Microsoft) and mail the response JSON via Office 365 connector.
Here is my code:
{
..
.
.
"triggers": {
"http": {
"recurrence": {
"frequency": "Day",
"interval": 1
},
"type": "Http",
"inputs": {
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"uri": "http://xxx/wcf/myrestservice.svc/is_online"
}
}
},
"actions": {
"office365connector": {
"type": "ApiApp",
"inputs": {
"apiVersion": "2015-01-14",
"host": {
"id": "/subscriptions/xxx/resourcegroups/resourcegroup1/providers/Microsoft.AppService/apiapps/office365connector",
"gateway": "https://xxx.azurewebsites.net"
},
"operation": "SendMail",
"parameters": {
"message": {
"To": "xxx#example.com",
"Subject": "My Service Status",
"Importance": "High",
"Body": "Hi #{triggers().outputs.body.Is_OnlineResult}"
}
},
"authentication": {
"type": "Raw",
"scheme": "Zumo",
"parameter": "#parameters('/subscriptions/xxx/resourcegroups/resourcegroup1/providers/Microsoft.AppService/apiapps/office365connector/token')"
}
},
"conditions": []
}
},
"outputs": {}
}
I am wondering, how could I get the response of the HTTP call?
Then I want to send the same in the mail body.
Please correct me if I am going in wrong direction. Any response from you will be very helpful to me.
Manish!
Have you tried using "Content"?
#triggers().outputs.body.Content