向modrestcurlclient请求传递http身份验证和标头

向modrestcurlclient请求传递http身份验证和标头,curl,modx,modx-revolution,Curl,Modx,Modx Revolution,我尝试在我的网站上使用支付系统(bepay)进行支付页面。要付款,我需要创建令牌。 要创建令牌,我需要将带有身份验证数据、标题和带有参数的JSON的POST请求发送到支付系统url 在纯bash形式中,它看起来像 curl https://checkout.bepaid.by/ctp/api/checkouts -u shopId:shopKey -H 'Content-type: application/json' -d ' { "checkout": { "order": {

我尝试在我的网站上使用支付系统(bepay)进行支付页面。要付款,我需要创建令牌。 要创建令牌,我需要将带有身份验证数据、标题和带有参数的JSON的POST请求发送到支付系统url

在纯bash形式中,它看起来像

curl https://checkout.bepaid.by/ctp/api/checkouts -u shopId:shopKey -H 'Content-type: application/json' -d '
{
  "checkout": {
    "order": {
      "amount": 1,
      "currency": "USD",
      "description": "Test"
    },
    "settings": {
      "decline_url": "http://www.example.com/decline",
      "fail_url": "http://www.example.com/fail",
      "notification_url": "http://www.example.com/notify",
      "success_url": "http://www.example.com/success"
    },
    "transaction_type": "payment",
    "version": 2
  }
}'
我的网站是在MODX革命。我知道它有自己的CURL客户端。从文档中我了解了如何发送请求

request( string $host, string $path, string $method = GET, array $params = array, array $options = array )

因此,
$host
是,
$path
是“/”,
方法是POST,
$params
是JSON。我不知道什么是
$options
。如果这是身份验证数据和标题-语法是什么?如果没有,我应该在哪里传递该信息?

答案在$options中。如果该数组包含一个值为
modRestClient::OPT_USERPWD
(或
USERPWD
)且您
shopId:shopKey
为值的密钥,则该密钥将设置为基本身份验证头