嗨,朋友们,我正在研究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”:“找不到对象”,“ errors”:null}
如果有人可以提供帮助,我将非常感激。
答案 0 :(得分:3)
如果您返回Moyasar的API文档,则会发现以下报价:
除非满足PCI DSS合规性要求并且适用于您,否则您无法通过包装程序库创建付款。签出通过Moyasar付款表格创建付款。
创建付款最近已从图书馆中删除
要创建付款,您只能使用Moyasar表单,该表单在此处进行描述:https://moyasar.com/docs/payments/create-payment/mpf/