2017-07-10 53 views
0

我嘗試使用支付系統(bePaid)在我的網站上創建付款頁面。爲了進行付款,我需要創建令牌。 要創建令牌,我需要發送POST請求與驗證數據,標題和JSON參數付款系統url。將http驗證和標頭傳遞給modrestcurlclient請求

在純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 
    } 
}' 

我的網站是在鏌鋣革命。我知道它有它自己的CURL客戶端。從文檔我看到如何發送請求

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

因此到$hosthttps://checkout.bepaid.by/ctp/api/checkouts$path是 '/',method是POST,$params是JSON。我不知道什麼是$options。如果這是認證數據和頭文件 - 語法是什麼?如果沒有,我應該在哪裏通過這些信息?

回答

0

答案在$ options中。如果該數組包含值爲modRestClient::OPT_USERPWD(或userpwd)且您的shopId:shopKey爲值的密鑰,則該值將設置爲BASIC AUTH標頭。