如何设置多方付款(Onboard Sellers)

发布于 2025-01-16 07:55:31 字数 4281 浏览 1 评论 0原文

我正在尝试实施 Paypal 多方付款,以便我可以连接卖家和买家,然后我向他们收取 x% 使用该平台的费用 例如。 Fiverr,Upwork,自由职业者, 所以首先卖家连接他的帐户,然后他们可以销售服务并通过 paypal 接受付款,但我不知道如何将 Paypal 帐户连接到我的应用程序

我正在使用 laravel 9 和 srmklive/laravel-paypal 包

这是我的代码

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);
    })

这是输出

^ 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":[]} ◀"
]

提前致谢

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);
    })

这是输出

^ 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":[]} ◀"
]

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":[]} ◀"
]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

谢绝鈎搭 2025-01-23 07:55:31

"details":[{"issue":"INVALID_STRING_LENGTH","description":"字段值的长度不得短于 44 个字符。","field":" /操作/0/api_integration_preference/rest_api_integration/first_party_details/seller_nonce

错误消息详细信息很有用,是吗? href="https://developer.paypal.com/api/partner-referrals/v2/#partner-referrals_create" rel="nofollow noreferrer">API 参考。

"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

Error message details are useful, yes? The field is documented in the API reference. You can also try omitting it.

开始看清了 2025-01-23 07:55:31

经过一番搜索,我发现问题是我的 seller_nonce 字段低于 44 个字符,因此请确保您的 seller_nounce 超过 44 个字符。另外,请确保您已选中付款后登机复选框

seller_nonce => uniqid(Str::random(40), true)

After some search, I found out the problem was that my seller_nonce field was lowered than 44 characters, so make sure your seller_nounce is more than 44 characters. Also, make sure you have checked the box On Board After Payment

seller_nonce => uniqid(Str::random(40), true)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文