All requests must be sent via POST method in JSON format.
ENDPOINT https://app.paycrypto24.com/api/gateway/request/gate
the following parameters are required to properly generate and configure the invoice details
NAME | TYPE | SUPPORTED PARAMS |
---|---|---|
currency | `String` | "IRR" | "USD" |
amount | `Integer` | - |
orderId | `Integer` | - |
Here are some examples of how to communicate with the API:
Example of making request in Javascript:
fetch('https://app.paycrypto24.com/api/gateway/request/gate', {
method: "POST",
headers: {
"Authorization": "Bearer 3|fy5JH4a8 ********** 1C9958f1f1",
"Accept": "application/json",
"Content-Type": "application/json"
},
body: JSON.stringify({currency: 'USD',amount: 150, orderId: 90666})
})
Example of making request in Laravel client:http package:
use Illuminate\Support\Facades\Http;
$url = "https://app.paycrypto24.com/api/gateway/request/gate";
$token = "your_bearer_token_here"; // Replace with your actual token
$response = Http::withToken($token)
->acceptJson()
->post($url, [
'currency' => 'USD',
'amount' => 150,
'orderId' => 90666,
]);
if ($response->successful()) {
return $response->json(); // Return or process the response data
} else {
return response()->json([
'error' => 'Request failed',
'status' => $response->status(),
'message' => $response->body(),
], $response->status());
}
Example of making request with CURL:
curl -X POST https://app.paycrypto24.com/api/gateway/request/gate -H "Authorization: Bearer your_bearer_token_here" -H "Accept: application/json" -H "Content-Type: application/json" -d '{"currency": "USD", "amount": 150, "orderId": 90666}'
Here are some examples of endpoint response types:
DATA | STATUS | CODE |
---|---|---|
`Invoice unique ID` | true | 200 |
`Order already paid !` | false | 500 |
`sth_wrong` | false | 500 |
`invalid_parameters` | false | 500 |
`Unauthenticated.` | - | 401 |
Example of responses with json format:
{
"status": true,
"data": {
"hash": "invoice_unique_id" // example: https://pay.paycrypto24.com/door/invoice_unique_id
}
}
{
"status": false,
"data": "Order already paid !" // the invoice with the orderId is already paid
}
{
"status": false,
"data": "sth_wrong" // something prevent creating invoice
}
{
"status": false,
"data": "invalid_parameters" // the parameters does not pass the validation
}
{
"message": "Unauthenticated." // invalid API key
}
In this section, you can learn about to set callback URL in your merchant settings.