remitano/remitano-php

Remitano API 客户端

v1.0.3 2021-12-28 15:00 UTC

This package is not auto-updated.

Last update: 2024-10-02 04:48:20 UTC


README

欢迎fork、修改和重新分发,许可协议为MIT。

安装

通过Composer

$ composer require remitano/remitano-php

或克隆此仓库并将其包含到您的项目中

使用方法

创建API密钥

访问 https://remitano.com/settings/api_key 创建API密钥。

获取认证器密钥

访问 https://remitano.com/settings/authenticator 获取您的认证器密钥。

注意:此密钥用于执行需要两步验证的Action,例如提款,否则您不需要它。

设置Remitano客户端

$client = new Remitano\Api\RemitanoClient([
    'apiKey'  => 'your-api-key',
    'apiSecret' => 'your-api-secret',
    'authenticatorSecret' => 'your-authenticator-secret'
]);

支付网关

访问 https://developers.remitano.com/api-explorer - 商户部分获取更多信息。

费用

获取
$merchant_charges = new Remitano\Api\Merchant\Charge($client);
$merchant_charges->get($id);
创建
  1. 使用币种
$merchant_charges->create([
    "coin_currency" => "usdt",
    "coin_amount" => 10.99,
    "cancelled_or_completed_callback_url" =>"https://example.com/payments/callback?id=example",
    "description" => "Example charge"
]);

注意:目前,我们只支持 usdt 作为计价币种。

  1. 使用法定货币:我们支持Remitano支持的56个国家的法定货币,例如 USDAUD。(您可以在我们的开发者文档中找到完整列表)。
$merchant_charges->create([
    "fiat_currency" => "AUD",
    "fiat_amount" => 100.99,
    "cancelled_or_completed_callback_url" =>"https://example.com/payments/callback?id=example",
    "description" => "Example charge"
]);

提款

获取
$merchant_withdrawals = new Remitano\Api\Merchant\Withdrawal($client);
$merchant_withdrawals->get($id);
创建
  1. 提款到外部币种地址
$merchant_withdrawals->create([
    "merchant_withdrawal_ref" => "123",
    "coin_currency" => "btc",
    "coin_amount" => 1,
    "receiver_pay_fee" => true,
    "cancelled_or_completed_callback_url" => "http://sample.com/123/callback",
    "coin_address" => "3CpwViK5RAMzT8AmaMFHVHyfoyQSwNPB6y"
]);
  1. 提款到其他Remitano账户
$merchant_withdrawals->create([
    "merchant_withdrawal_ref" => "123",
    "coin_currency" => "btc",
    "coin_amount" => 1,
    "receiver_pay_fee" => true,
    "cancelled_or_completed_callback_url" => "http://sample.com/123/callback",
    "remitano_username" => "receiver123",
    "remitano_phone_number" => "+234 1 123 4567"
]);

回调

费用

每当在我们的系统中某个费用被更改成已完成或已取消时

  • 我们将向 charge.cancelled_or_completed_callback_url 发送POST请求,包含 remitano_id 参数。
  • 如果用户仍然在我们的网站上,我们也将用户重定向到 object.cancelled_or_completed_callback_url,包含 remitano_id 参数(GET请求)。

在接收到这些回调后,您可以调用 $merchant_charges->get($params['remitano_id']) 来获取更新的信息并进行相应处理。

提款

每当在我们的系统中某个提款被更改成已完成或已取消时

  • 我们将向 withdrawal.cancelled_or_completed_callback_url 发送POST请求,包含 remitano_id 参数。

在接收到这些回调后,您可以调用 $merchant_withdrawals->get($params['remitano_id']) 来获取更新的信息并进行相应处理。

其他API调用

访问 https://developers.remitano.com/api-explorer 获取更多API规范,可以使用 $clientgetpostput 方法直接调用API。

$client->get('users/coin_accounts');

$client->post('offers/best', [
    "country_code" => "my",
    "offer_type" => "buy",
    "coin_currency" => "btc",
    "coin_amount" => 1
]);

错误

当接收到非200-299的http状态码时,将抛出错误。

沙盒测试

我们在 https://remidemo.com 有一个Testnet。

您可以在那里注册一个账户,然后通过 此Google表单 提交请求,包括您的Remidemo用户名,这样我们就可以帮助您设置商户测试账户。

之后,您可以通过设置ENV变量开始沙盒测试: putenv("REMITANO_SANDBOX=1")

贡献

  1. fork它
  2. 创建您的功能分支(git checkout -b my-new-feature
  3. 提交您的更改(git commit -am 'Add some feature'
  4. 将更改推送到分支(git push origin my-new-feature
  5. 创建新的Pull Request