【发布时间】:2019-08-05 08:09:08
【问题描述】:
嗨朋友们,我正在研究 moyasar 支付 API。我在发布付款时遇到困难。我正在关注他们的 API 文档。 https://moyasar.com/docs/api/?shell#the-payment-object 我已按照文档进行操作,但仍未成功。
require_once 'vendor/autoload.php';
Moyasar\Client::setApiKey("my secrete key");
$data = [
"id"=> "d1d3-5f72-9056-191683f55872",
"status"=> "paid",
"amount"=> 88571,
"fee"=> 1580,
"currency"=> "SAR",
"refunded"=> 0,
"refunded_at"=> null,
"description"=> null,
"amount_format"=> "885.71 SAR",
"fee_format"=> "15.80 SAR",
"refunded_format"=> "0.00 SAR",
"invoice_id"=> "a1be-5b13-a281-b27a4a6dad39",
"ip"=> null,
"callback_url"=> null,
"created_at"=> "2016-05-11T17=>04=>17.000Z",
"updated_at"=> "2016-05-12T17=>04=>19.633Z",
"source"=> [
"type"=> "creditcard",
"company"=> "visa",
"name"=> "Customer Name",
"number"=> "xxxx-xxxx-xxxx-xxxx",
"message"=> null,
"transaction_url"=> null
]
];
try{
$response = Moyasar\Client::post("https://api.moyasar.com/v1/payments", $data);
}
catch(Exception $ex){
echo $ex->getMessage();
}
$data = json_decode($response);
echo '<pre>'.print_r($data, true).'</pre>';
我收到错误
客户端错误:
POST https://api.moyasar.com/v1/payments导致404 Not Found响应:{"type":"api_error","message":"Object not found","errors":null}
如果有人能提供帮助,我将非常感激。
【问题讨论】: