Create Payment
curl --request POST \
--url https://api.example.com/payment/createimport requests
url = "https://api.example.com/payment/create"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/payment/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/payment/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/payment/create"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/payment/create")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/payment/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"success": false,
"error": {
"status": 401,
"code": "UNAUTHORISED",
"message": "Invalid API key"
},
"data": null
}
Payments
Create Payment
Create a new payment request
POST
/
payment
/
create
Create Payment
curl --request POST \
--url https://api.example.com/payment/createimport requests
url = "https://api.example.com/payment/create"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/payment/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/payment/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/payment/create"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/payment/create")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/payment/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"success": false,
"error": {
"status": 401,
"code": "UNAUTHORISED",
"message": "Invalid API key"
},
"data": null
}
Create a new payment request for cryptocurrency payment.
string
required
Payment amount in fiat currency
string
required
Fiat currency code (USD, EUR, etc.)
string
required
Customer ID for the payment
string
required
Unique order identifier
object
Additional payment metadata
string
Webhook URL for payment notifications
string
URL to redirect on successful payment
string
URL to redirect on payment cancellation
array
Array of allowed cryptocurrencies (BTC, ETH, LTC, SOL)
object
Custom fields for the payment
boolean
Indicates if the request was successful
string
Payment ID for tracking
string
Payment expiration timestamp
Example Request
curl -X POST https://api.transaction.gg/payment/create \
-H "Authorization: Bearer pk_your_public_key" \
-H "Content-Type: application/json" \
-d '{
"amount": "29.99",
"currency": "USD",
"customerId": "cus_V6n6SN2KnsIFCuQU",
"orderId": "order_123",
"metadata": {
"description": "Premium subscription"
},
"webhookUrl": "https://mystore.com/webhook",
"successUrl": "https://mystore.com/success",
"returnUrl": "https://mystore.com/cancel",
"allowedCryptos": ["BTC", "ETH"],
"customFields": {
"customer_name": "John Doe"
}
}'
Alternative with Product/Price
curl -X POST https://api.transaction.gg/payment/create \
-H "Authorization: Bearer pk_your_public_key" \
-H "Content-Type: application/json" \
-d '{
"productId": "prod_X4dUuzsMaruQ4UsX",
"priceId": "price_i62wKFQ8sGnLxQ5G",
"customerId": "cus_V6n6SN2KnsIFCuQU",
"orderId": "order_123"
}'
Example Response
{
"success": true,
"data": {
"id": "pay_abc123def456",
"expiresAt": "2024-01-01T01:00:00Z"
}
}
Error Responses
{
"success": false,
"error": {
"status": 401,
"code": "UNAUTHORISED",
"message": "Invalid API key"
},
"data": null
}
{
"success": false,
"error": {
"status": 404,
"code": "CUSTOMER_NOT_FOUND",
"message": "Customer not found"
},
"data": null
}