Skip to content

iscod/wallet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wallet

Package for using Wallet Pay API https://docs.wallet.tg/pay/

Build status

Supported endpoints

Create order /wpay/store-api/v1/order

Get order preview /wpay/store-api/v1/order/preview

Get order list /wpay/store-api/v1/reconciliation/order-list

Get order amount /wpay/store-api/v1/reconciliation/order-amount

Installation

go get github.com/iscod/wallet

Usage examples

init wallet

w, err := wallet.NewWallet("secret_api_key")

if err != nil {
	fmt.printf("Error creating wallet: %s\n", err)
}

create new order

v1/order/create

w, err := wallet.NewWallet("secret_api_key")

if err != nil {
    fmt.printf("Error creating wallet: %s\n", err)
}

createResponse, err := w.Create(&wallet.CreateParams{
    Description:            "VPN for 1 month",
    Amount:                 wallet.Amount{Amount: "1.00", CurrencyCode: "TON"},
    ReturnUrl:              "https://t.me/wallet/start?startapp",
    TimeoutSeconds:         10800,
    CustomerTelegramUserId: 0,
})

var order *wallet.Order = createResponse.Data

fmt.Println(order.PayLink)

get order preview

/wpay/store-api/v1/order/preview

w, err := wallet.NewWallet("secret_api_key")

if err != nil {
    fmt.printf("Error creating wallet: %s\n", err)
}

previewResponse, err := w.GetPreview("2703383946854401")

var order *wallet.Order = previewResponse.Data

fmt.Println(order.Id)

Releases

No releases published

Packages

No packages published

Languages