有没有办法用 PaypalAPI 冻结一笔钱?

Is there a way to freeze an amount of money with PaypalAPI?

一般来说,我有这里描述的流程:

两个词:我网站上的用户之间使用 PaypalAPI 进行支付

现在我想知道如何使用 PaypalAPI 冻结一笔钱

这方面的一个例子是,当雇主在某些自由职业者平台上放置他们的项目并确认自由职业者时。他们的账户上将冻结一笔钱。并且,然后在最后完成工作后,转给freelancer。

这是可能的。贝宝称之为 'Authorize and Capture'。它允许您 'Authorize' 一笔付款,这会暂停相关资金,并且可以在以后捕获,即支付。

Here 是请求的开发者文档。这是来自他们文档的 curl 请求,对它进行了很好的总结。

curl -v https://api-m.sandbox.paypal.com/v1/payments/payment \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <Access-Token>" \
  -d '{
  "intent": "authorize",
  "payer":
  {
    "payment_method": "paypal"
  },
  "transactions": [
  {
    "amount":
    {
      "total": "30.11",
      "currency": "USD",
      "details":
      {
        "subtotal": "30.00",
        "tax": "0.07",
        "shipping": "0.03",
        "handling_fee": "1.00",
        "shipping_discount": "-1.00",
        "insurance": "0.01"
      }
    },
    "description": "This is the payment transaction description.",
    "custom": "EBAY_EMS_90048630024435",
    "invoice_number": "48787589673",
    "payment_options":
    {
      "allowed_payment_method": "INSTANT_FUNDING_SOURCE"
    },
    "soft_descriptor": "ECHI5786786",
    "item_list":
    {
      "items": [
      {
        "name": "hat",
        "description": "Brown color hat",
        "quantity": "5",
        "price": "3",
        "tax": "0.01",
        "sku": "1",
        "currency": "USD"
      },
      {
        "name": "handbag",
        "description": "Black color hand bag",
        "quantity": "1",
        "price": "15",
        "tax": "0.02",
        "sku": "product34",
        "currency": "USD"
      }],
      "shipping_address":
      {
        "recipient_name": "Hello World",
        "line1": "4thFloor",
        "line2": "unit#34",
        "city": "SAn Jose",
        "country_code": "US",
        "postal_code": "95131",
        "phone": "011862212345678",
        "state": "CA"
      }
    }
  }],
  "note_to_payer": "Contact us for any questions on your order.",
  "redirect_urls":
  {
    "return_url": "https://example.com/return",
    "cancel_url": "https://example.com/cancel"
  }
}'