miladxandi / intellectmoney-sdk
Intellectmoney PHP SDK
0.0.3.2
2023-12-07 12:26 UTC
Requires
- php: >=8.0
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.0|^7.8
README
生成secretKey
- 前往这里: https://lk.intellectmoney.ru/profile/security/api 生成凭证,并通过
\Intellectmoney\Configurations::
静态属性在您的代码中设置所有这些。 - 然后,请前往此处选择您的商店进行更改: https://lk.intellectmoney.ru/eshops
- 现在,将secretKey放入“连接商店”选项卡的相关输入字段中。
进行支付
try{
\Intellectmoney\Configurations::$eshopId = 111111;
\Intellectmoney\Configurations::$secretKey = "111111";
$gateway = new \Intellectmoney\Merchant\Payment();
$url = "https://www.example.com/";
$email = "info@example.com";
$orderId = 145; //Random number or string generated by your internal system
$amount = 2000;
$invoiceId = $gateway->createInvoice(
$orderId,
$amount,
$email,
resultUrl: $url,
)->Result->InvoiceId;
if ($invoiceId!=null){
$paymentLink = $gateway->pay($invoiceId)->Result->PaymentLink;
header("Location: ".$paymentLink);
}
} catch (\GuzzleHttp\Exception\GuzzleException $e) {
var_dump($e->getMessage());
}