Getting payment method issue in magento2.0 - magento2

developing sample application using front end react-native and backend using magneto 2.0 getting payment issue when i was placing the order.
Here like i am passing the values and Url
XXXXXXXXXXXXXXXXX/rest/V1/carts/16/order
body passing like this :
{
"paymentMethod":{"method": "Cash On Delivery"}
}
Issue has : "message": "The requested Payment Method is not available.",

Have you enabled the Payment method "Cash On Delivery" ?
If not, please enable it by doing this :
Stores > Configuration > Sales > Payment Methods > Cash On Delivery Payment > Enable = Yes
P.S: Please Clear the appropriate Application Caches after the step above.
Furthermore, the bind param is the payment method's code not its name/description.
P.S: You should be able to find the payment method "code" in the output of the {{url}}/rest/V1/carts/mine/shipping-information end-point.
Good Luck! :)

Related

Paypal-Merchant-SDK : How get only token using the SetExpressCheckout.php and then passe it to CreateRecurringPaymentsProfile.php?

Please can anyone explain to me step by step cause i'm so confused about the example that Paypal give us, the "SetExpressCheckout.php", it contains a lot of stuff, i want only to generate a token so i can create a Recurring Payments Profile using "CreateRecurringPaymentsProfile.php"
Please help, i have read some tutorials but never showed from the beginning how to start to create a subscription or Recurring Payments.
I'm using the Merchant-SDK-PHP : https://github.com/paypal/merchant-sdk-php
Just in case someone want to know why i want to use Paypal's classic API, it's because the REST API does not have an option to hide the shipping address when creating a subscription, and Web Experience cannot be attached to a plan or an agreement.
It was confusing because when you are in the samples pages, there's no where you can find what you should do after getting the token using SetExpressCheckOut.php.
So to pass the token to CreateRecurringPaymentsProfile.php, at the end of SetExpressCheckOut.php you need to redirect the costumer to > https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=$token
Where the $token is the Token you got in SetExpressCheckOut.php using :
$setECResponse = $paypalService->SetExpressCheckout($setECReq);
$token = $setECResponse->Token;
Before redirecting make sure (in your SetExpressCheckOut.php) $setECReqDetails->ReturnURL refers to the link that will trigger CreateRecurringPaymentsProfile.php
In my case i'm using Laravel
$setECReqDetails->ReturnURL = "domain.com/createsub"
And my route is : Route::get('createsub', 'PaypalContoller#CreateRecurringPayments')
So within the CreateRecurringPayments method i put all the stuff from CreateRecurringPaymentsProfile.php example.
Note : when you go live you need to remove sandbox from the link : > https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=$token

Has anybody gotten PAYMENTREQUEST_0_DESC to work in the PayPal API?

I am passing my PayPal API call like this:
&METHOD=SetExpressCheckout
&RETURNURL=''
&CANCELURL=''
&PAYMENTREQUEST_0_PAYMENTACTION='SALE'
&PAYMENTREQUEST_0_NOTIFYURL=''
&BRANDNAME=''
&NOSHIPPING=0
&PAYMENTREQUEST_0_CURRENCYCODE=''
&LOCALECODE=US
&LOGOIMG=''
&CARTBORDERCOLOR=''
&ALLOWNOTE=0';
&PAYMENTREQUEST_0_CUSTOM=''
&PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID=''
&L_PAYMENTREQUEST_0_NAME1=''
&L_PAYMENTREQUEST_0_AMT1=''
'&L_PAYMENTREQUEST_0_QTY1=''
&PAYMENTREQUEST_0_ITEMAMT=''
&PAYMENTREQUEST_0_SHIPPINGAMT=''
&PAYMENTREQUEST_0_AMT=''
and obviously I am including the:
'&PAYMENTREQUEST_0_DESC='.urlencode($desc).
where $desc = "Payment made from My Website";
But it's not showing anywhere in the confirmation emails that PayPal sends. Neither in the sandbox nor in the live version.
Has anyone gotten this to work successfully?
If you don't include items information, this parameter will show on PayPal checkout page.
I found a way to do it.
It's with: '&PAYMENTREQUEST_0_NOTETEXT='.urlencode($desc).

Payouts errors on Sandbox

I am trying to create Payout functionality using REST API, and I have few errors.
While I am sending this request :
{"sender_batch_header":{"sender_batch_id":"test_0","email_subject":"RaceBets Withdrawal","recipient_type":"PAYPAL_ID"},"items":[{"recipient_type":"PAYPAL_ID","amount":{"currency":"EUR","value":"20.0"},"receiver":"XXXX","note":"Hello there!","sender_item_id":"71292226"}]}
I received:
JAXBException occurred : 4 counts of IllegalAnnotationExceptions.
or :
{"name":"REQUIRED_SCOPE_MISSING","message":"Access token does not have required scope.","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#REQUIRED_SCOPE_MISSING"}
the second error is also strange, because payments are working fine, and scope is also fine
{"scope":"https://uri.paypal.com/services/subscriptions https://api.paypal.com/v1/payments/.* https://api.paypal.com/v1/vault/credit-card https://uri.paypal.com/services/applications/webhooks openid https://uri.paypal.com/services/invoicing https://api.paypal.com/v1/vault/credit-card/.*","access_token":"xxx","token_type":"Bearer","app_id":"APP-xxx","expires_in":28800}
Any idea?
For the second error make sure you have checked the option for "payouts" under your application at developer.paypal.com .
Go to developer.paypal.com --> DashBoard --> My APP -- > Click your APP Name --> App Feature . Select Payout here .
Regarding the REQUIRED_SCOPE_MISSING error, I experienced this as well. Adding the scope as the other poster describes fixed the issue.
Please note that after changing scope (i.e. adding Payouts) it can take a few hours for the change to be reflected, so you'll continue getting the error for awhile. This confused me when I was testing because I didn't expect sandbox to have this latency.

SuccessWithWarning in Paypal Mass Pay

I am building a payout system using PayPal's Mass Pay API. According to their documentation, a message will come back with one of the following status responses:
"Success"
"SuccessWithWarning"
"Failure"
"FailureWithWarning"
Does anyone know what an example of a "SuccessWithWarning" situation is for the Mass Pay API? I have only been able to simulate "Success" and "Failure" in Sandbox. Even after turning on Negative Testing for my Sandbox account, I was not able to reproduce a "SuccessWithWarning" status with the Mass Pay API. Any help is appreciated! Thank you.
For reference:
https://developer.paypal.com/docs/classic/api/NVPAPIOverview/
The above four values are the possible values for the variable ACK . Not all the API return the "SuccessWithWarning" as the ACK value . This value is applicable only to some API's like SetExpressCheckout API , DoExpressCheckout API etc . You can refer the below link to check what are the possible errors related to a particular API:
https://developer.paypal.com/webapps/developer/docs/classic/api/errorcodes/#id09C3F0O0NTU
I was sent a notification on one of my legacy systems today with the "SuccessWithWarning" response.
ACK = SuccessWithWarning
VERSION = 65.1
BUILD = 12896494
L_ERRORCODE0 = 11812
L_SHORTMESSAGE0 = Invalid Data
L_LONGMESSAGE0 = The value of Description parameter has been truncated.
L_SEVERITYCODE0 = Warning
So there is one example for you.

Payment validation got VERIFIED for web_accept transaction type but not for subscr_signup

We have been using "Post to return page" (rm = 2) as the way of receiving payment data for regular one time purchase (web_accept) and we have been getting "VERIFIED" fine when doing the validation. Recently we want to add a subscription-based product so I have been testing in the paypal sandbox and I am really baffled about what I did wrong for always getting INVALID when validating subscriptions (subscr_signup). The regular purchases returned VERIFIED in the sandbox just fine but not the subscriptions. It is the exact same piece of code for posting the validation, the same merchant/buyer combination...etc. Did I miss anything? Below is the common classic ASP code snippets which I have used. Please advise. Thanks
' read post from PayPal system and add 'cmd'
str = Request.Form & "&cmd=_notify-validate"
' post back to PayPal system to validate
'set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
' set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
set objHttp = Server.CreateObject("Microsoft.XMLHTTP")
objHttp.open "POST", "https://www.sandbox.paypal.com/cgi-bin/webscr", false
objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
objHttp.Send str
There are some IPN issues that are currently effecting the live site. This issue that you are reporting sounds like it may be related to the issues. I would suggest opening up a ticket with PayPal's Merchant Technical Support team. This way we can look into the issue further and also notify you once the issue is resolved.