# SDK Instruction

We support different languages of SDK, including [Golang](https://github.com/ReelPayment/sdk-go)、[PHP](https://github.com/ReelPayment/sdk-php)、Java

### Get the SDK

```undefined
GOLANG-SDK: go get github.com/ReelPayment/sdk-go
PHP-SDK: php composer.phar require reelpay/sdk-php
JAVA-SDK: https://github.com/ReelPayment/sdk-java
```

### Golang Example:

{% code overflow="wrap" %}

```go
``Example 1  Native checkout

import (
    "github.com/ReelPayment/sdk-go"
)
func main()  {
    transactions := reelpay.Transactions{AppID: "b66g4ypvrbzr7767", AppKey: "HcqmXmq7F4Y4UveaL7wcaYXSe3I8qS2X"}
    res := transactions.Pay(&reelpay.PayRequest{
        OutTradeNo: "QYXwrw25PzFZPYw83XWC5ManQWH3SZaW",
        CurrencyID: "bVmDPPs3Cyt1ZGeZVq6orZNWnfYhiE5H",
        FiatName:   "USD",
        FiatAmount: "0.0001",
    })
    fmt.Println(res)
}
```

{% endcode %}

```go
``Example 2  Hosted Checkout

import (
    reelpay "github.com/ReelPayment/sdk-go"
)
func main()  {
    transaction := reelpay.Transactions{
        AppID: "eqrbntqbi5uqvkpr",
        AppKey: "XhAlbICW10VJnWGruPL0NSnvb6946JDQ",
    }
    res := transaction.EntrustPay(&reelpay.EntrustPay{
        OutTradeNo: "jSWfrolOTdsadcYuUwkJbdw9IJUBeV",
        Symbol:     "USD",
        Amount:     "1.2",
        Name:       "Product name",
        Image:      "https://reelpay.com/product.jpg",
    })
    fmt.Println(res)
}
```

* PHP Example:

{% code overflow="wrap" %}

```php
``Example 1  Native checkout

<?php
require_once('vendor/autoload.php');
use Reelpay\Reelpay;

$transaction = Reelpay::Transaction('b66g4ypvrbzr7767','HcqmXmq7F4Y4UveaL7wcaYXSe3I8qS2X');
$res = $transaction->Pay([
    'out_trade_no' => 'QYXwrw25PzFZPYw83XWC5ManQWH3SZaW',
    'currency_id'  => 'bVmDPPs3Cyt1ZGeZVq6orZNWnfYhiE5H',
    'fiat_name'    => 'USD',
    'fiat_amount'  => '0.0001'
]);
var_dump($res);
```

{% endcode %}

```php
``Example 2  Hosted Checkout

<?php
require_once('vendor/autoload.php');
use Reelpay\Reelpay;
$transaction = Reelpay::Transaction(
    'eqrbntqbi5uqvkpr',
    'XhAlbICW10VJnWGruPL0NSnvb6946JDQ'
);
$res = $transaction->EntrustPay(
    "out_trade_no", 
    "USD", 
    "1.2", 
    "Product name", 
    "https://reelpay.com/product.jpg"
);
var_dump($res);
// Todo: $payUrl = $res['data']['url'];
```

* JAVA Example:

{% code overflow="wrap" %}

```java
``Example 1  Native checkout


import com.google.gson.JsonObject;
import com.reelpay.api.Transactions;

public class Test {
    public static void main(String[] args) {
        String appId = "Your appid";
        String appKey = "Your appKey";

        // Hosted Checkout
        String out_trade_no = "20240101xxxxxxxxxxxxx";
        String symbol = "USD";
        String amount = "3.00";
        String name = "Buy coins";
        String image = "https://reelpay.com/product.jpg";

        Transactions transaction = new Transactions(appId, appKey);
        JsonObject rt = transaction.EntrustPay(out_trade_no, symbol, amount, name, image);
        System.out.println(rt.toString());
        //{"code":200,"message":"success","data":{"url":"https://pay.reelpay.com/df9fbe011ca2a1c70f20240112113339","time_expire":1705032219,"trade_no":""}}
    }
}
```

{% endcode %}

### Call Method

| Method                                                                   | Description                                             |
| ------------------------------------------------------------------------ | ------------------------------------------------------- |
| [Currency](/payment-api/api-interface.md#token-list)                     | The list of tokens currently supported                  |
| [Amount](/payment-api/api-interface.md#get-amount)                       | Get the exchange rate and amount to pay                 |
| [Pay](/payment-api/api-interface.md#create-payment-order)                | Create a transaction and return transaction information |
| [Transaction](/payment-api/api-interface.md#order-information-interface) | Check transaction status                                |
| [Close](/payment-api/api-interface.md#close-order)                       | Close Order                                             |
| [Refund](/payment-api/api-interface.md#request-refund)                   | Request Refund                                          |
| [EntrustPay](/payment-api/hosted-checkout-page-integration.md)           | Hosted Checkout                                         |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.reelpay.com/sdk-instruction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
