I am Trying To Implement Paypal Multiparty payment so i can connect seller and Buyers and then i take x% of fee from them for using the platform
eg. Fiverr,Upwork,Freelancer,
so first the seller connect his account and then they can sell services and accept payment through paypal but i dont know how to connect There Paypal account to My app
I am using laravel 9 with srmklive/laravel-paypal package
This is my Code
Route::get('https://api-m.sandbox.paypal.com/v2/customer/partner-referrals', function () {
$provider = new PayPalClient;
$provider->setApiCredentials(config('paypal'));
$paypalToken = $provider->getAccessToken();
$partner = $provider->createPartnerReferral([
"operations" => [
[
"operation" => "API_INTEGRATION",
"api_integration_preference" => [
"rest_api_integration" => [
"integration_method" => "PAYPAL",
"integration_type" => "FIRST_PARTY",
"first_party_details" => [
"features" => [
"PAYMENT",
"REFUND"
],
"seller_nonce" => uniqid()
]
]
]
]
],
"products" => [
"EXPRESS_CHECKOUT"
],
"legal_consents" => [
[
"type" => "SHARE_DATA_CONSENT",
"granted" => true
]
]
]);
dd($partner);
})
this is the out put
^ array:2 [▼
"type" => "error"
"message" => "{"operations":[{"operation":"API_INTEGRATION","api_integration_preference":{"rest_api_integration":{"integration_method":"PAYPAL","integration_type":"FIRST_PARTY","first_party_details":{"features":["PAYMENT","REFUND"],"seller_nonce":"623a1fcec9be3"}}}}],"products":["EXPRESS_CHECKOUT"],"legal_consents":[{"type":"SHARE_DATA_CONSENT","granted":true}]} {"name":"INVALID_REQUEST","message":"Request is not well-formed, syntactically incorrect, or violates schema.","debug_id":"f64fe0ec63213","information_link":"","details":[{"issue":"INVALID_STRING_LENGTH","description":"The length of a field value should not be shorter than 44 characters.","field":"/operations/0/api_integration_preference/rest_api_integration/first_party_details/seller_nonce","location":"body"}],"links":[]} ◀"
]
Thank in Advance
Route::get('https://api-m.sandbox.paypal.com/v2/customer/partner-referrals', function () {
$provider = new PayPalClient;
$provider->setApiCredentials(config('paypal'));
$paypalToken = $provider->getAccessToken();
$partner = $provider->createPartnerReferral([
"operations" => [
[
"operation" => "API_INTEGRATION",
"api_integration_preference" => [
"rest_api_integration" => [
"integration_method" => "PAYPAL",
"integration_type" => "FIRST_PARTY",
"first_party_details" => [
"features" => [
"PAYMENT",
"REFUND"
],
"seller_nonce" => uniqid()
]
]
]
]
],
"products" => [
"EXPRESS_CHECKOUT"
],
"legal_consents" => [
[
"type" => "SHARE_DATA_CONSENT",
"granted" => true
]
]
]);
dd($partner);
})
this is the out put
^ array:2 [▼
"type" => "error"
"message" => "{"operations":[{"operation":"API_INTEGRATION","api_integration_preference":{"rest_api_integration":{"integration_method":"PAYPAL","integration_type":"FIRST_PARTY","first_party_details":{"features":["PAYMENT","REFUND"],"seller_nonce":"623a1fcec9be3"}}}}],"products":["EXPRESS_CHECKOUT"],"legal_consents":[{"type":"SHARE_DATA_CONSENT","granted":true}]} {"name":"INVALID_REQUEST","message":"Request is not well-formed, syntactically incorrect, or violates schema.","debug_id":"f64fe0ec63213","information_link":"","details":[{"issue":"INVALID_STRING_LENGTH","description":"The length of a field value should not be shorter than 44 characters.","field":"/operations/0/api_integration_preference/rest_api_integration/first_party_details/seller_nonce","location":"body"}],"links":[]} ◀"
]
2
Answers
After some search, I found out the problem was that my
seller_nonce
field was lowered than 44 characters, so make sure yourseller_nounce
is more than 44 characters. Also, make sure you have checked the box On Board After Paymentseller_nonce => uniqid(Str::random(40), true)
Error message details are useful, yes? The field is documented in the API reference. You can also try omitting it.