
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
github.com/cryptome-ai/cryptome-pay-go
Advanced tools
Official Go SDK for Cryptome Pay - Non-custodial cryptocurrency payment gateway.
go get github.com/cryptome-ai/cryptome-pay-go
package main
import (
"fmt"
"log"
"time"
cryptomepay "github.com/cryptome-ai/cryptome-pay-go"
)
func main() {
// Create client
client := cryptomepay.NewClient(
"sk_live_your_api_key",
"your_api_secret",
)
// Create payment
payment, err := client.CreatePayment(&cryptomepay.CreatePaymentParams{
OrderID: fmt.Sprintf("ORDER_%d", time.Now().Unix()),
Amount: 100.00,
NotifyURL: "https://your-site.com/webhook",
ChainType: cryptomepay.ChainBSC,
})
if err != nil {
log.Fatal(err)
}
if payment.StatusCode == 200 {
fmt.Println("Payment URL:", payment.Data.PaymentURL)
fmt.Printf("Pay %.4f USDT to %s\n", payment.Data.ActualAmount, payment.Data.Token)
} else {
fmt.Println("Error:", payment.Message)
}
}
// With custom base URL (for sandbox)
client := cryptomepay.NewClientWithOptions(
"sk_sandbox_xxx",
"secret",
cryptomepay.WithBaseURL(cryptomepay.SandboxURL),
cryptomepay.WithTimeout(60 * time.Second),
)
// Or switch environments
client := cryptomepay.NewClient("key", "secret")
client.UseSandbox() // Switch to sandbox
client.UseProduction() // Switch back to production
| Environment | Base URL | Description |
|---|---|---|
| Production | https://api.cryptomepay.com/api/v1 | Live transactions |
| Sandbox | https://sandbox.cryptomepay.com/api/v1 | Testing with mock data |
| Staging | https://staging.cryptomepay.com/api/v1 | Testing with testnet |
payment, err := client.CreatePayment(&cryptomepay.CreatePaymentParams{
OrderID: "ORDER_001",
Amount: 100.00, // CNY amount
NotifyURL: "https://...", // Webhook URL
RedirectURL: "https://...", // Optional: redirect after payment
ChainType: cryptomepay.ChainBSC, // Optional: TRC20, BSC, POLYGON, ETH, ARBITRUM
})
// By trade_id
result, err := client.QueryPaymentByTradeID("CP202312271648380592")
// By order_id
result, err := client.QueryPaymentByOrderID("ORDER_001")
if result.Data.Status == cryptomepay.StatusPaid {
fmt.Println("Payment confirmed!")
}
orders, err := client.ListOrders(&cryptomepay.ListOrdersParams{
Page: 1,
PageSize: 20,
Status: cryptomepay.StatusPaid, // Optional filter
ChainType: cryptomepay.ChainBSC, // Optional filter
StartDate: "2025-12-01", // Optional filter
EndDate: "2025-12-31", // Optional filter
})
for _, order := range orders.Data.List {
fmt.Printf("%s: %.4f USDT\n", order.OrderID, order.ActualAmount)
}
merchant, err := client.GetMerchantInfo()
fmt.Println("Merchant:", merchant.Data.Name)
func webhookHandler(w http.ResponseWriter, r *http.Request) {
var payload cryptomepay.WebhookPayload
json.NewDecoder(r.Body).Decode(&payload)
// Verify signature
if !client.VerifyWebhookSignature(&payload) {
http.Error(w, "Invalid signature", http.StatusUnauthorized)
return
}
// Process payment
if payload.Status == cryptomepay.StatusPaid {
// Order paid!
processOrder(payload.OrderID, payload.BlockTransactionID)
}
w.Write([]byte("ok"))
}
var payload map[string]interface{}
json.NewDecoder(r.Body).Decode(&payload)
if !client.VerifyWebhookSignatureFromMap(payload) {
// Invalid signature
}
| Constant | Chain | Network |
|---|---|---|
ChainTRC20 | TRON | TRC20 USDT |
ChainBSC | BNB Smart Chain | BEP20 USDT |
ChainPolygon | Polygon | USDT |
ChainETH | Ethereum | ERC20 USDT |
ChainArbitrum | Arbitrum One | USDT |
| Constant | Value | Description |
|---|---|---|
StatusPending | 1 | Awaiting payment |
StatusPaid | 2 | Payment confirmed |
StatusExpired | 3 | Payment expired |
payment, err := client.CreatePayment(params)
if err != nil {
// Network or parsing error
log.Fatal(err)
}
if payment.StatusCode != 200 {
// API error
switch payment.StatusCode {
case cryptomepay.ErrCodeOrderExists:
// Order already exists
case cryptomepay.ErrCodeInvalidAmount:
// Invalid amount
default:
fmt.Println("Error:", payment.Message)
}
}
import "github.com/gin-gonic/gin"
func main() {
r := gin.Default()
r.POST("/api/payments", func(c *gin.Context) {
payment, _ := client.CreatePayment(&cryptomepay.CreatePaymentParams{
OrderID: "ORDER_" + uuid.New().String(),
Amount: 100.00,
NotifyURL: "https://example.com/webhook",
})
c.JSON(200, gin.H{"payment_url": payment.Data.PaymentURL})
})
r.POST("/webhook", func(c *gin.Context) {
var payload cryptomepay.WebhookPayload
c.BindJSON(&payload)
if !client.VerifyWebhookSignature(&payload) {
c.String(401, "Invalid signature")
return
}
// Process...
c.String(200, "ok")
})
r.Run(":8080")
}
import "github.com/gofiber/fiber/v2"
func main() {
app := fiber.New()
app.Post("/webhook", func(c *fiber.Ctx) error {
var payload cryptomepay.WebhookPayload
c.BodyParser(&payload)
if !client.VerifyWebhookSignature(&payload) {
return c.Status(401).SendString("Invalid signature")
}
return c.SendString("ok")
})
app.Listen(":3000")
}
Run tests:
go test -v ./...
MIT License - see LICENSE file.
FAQs
Unknown package
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.