# PerfectMoney Go Library Documentation The PerfectMoney Go Library enables straightforward integration with the PerfectMoney API for Go applications, providing functionalities such as querying account balances, reviewing transaction histories, executing money transfers, managing e-Vouchers, and validating SCI payment confirmations. ## Installation To integrate the PerfectMoney library into your Go project, follow these steps: 1. Save the `perfectmoney.go` file to an appropriate directory within your project, ideally within a subdirectory named `perfectmoney`. 2. Import the library into your Go source files: ```go import ( "path/to/your/project/perfectmoney" ) ``` *Note:* Replace `path/to/your/project` with the actual path to the directory containing `perfectmoney.go`. ## Getting Started Create an instance of the `PerfectMoney` struct using your PerfectMoney account credentials: ``` pm := perfectmoney.NewPerfectMoney("yourAccountID", "yourPassword") // Balance View balance, err := pm.Balance() if err != nil { fmt.Println("Error retrieving balance:", err) } else { fmt.Println("Account Balance:", balance) } // Transction History start := time.Date(2023, 1, 1, 0, 0, 0, 0, time.UTC) end := time.Date(2023, 3, 31, 23, 59, 59, 0, time.UTC) history, err := pm.History(start, end) if err != nil { fmt.Println("Error fetching history:", err) } else { for _, transaction := range history { fmt.Println(transaction) } } // Executing transfer payer := "U1234567" payee := "U7654321" amount := 100.00 // Amount to transfer memo := "Payment for services" paymentID := "unique_payment_ID" transferResult, err := pm.Transfer(payer, payee, amount, memo, paymentID) if err != nil { fmt.Println("Transfer error:", err) } else { fmt.Println("Transfer success:", transferResult) } // Creating E-voucher payer := "U1234567" amount := 50.00 // Voucher amount voucher, err := pm.EVCreate(payer, amount) if err != nil { fmt.Println("Error creating e-Voucher:", err) } else { fmt.Println("e-Voucher details:", voucher) } // Listing vouchers vouchers, err := pm.EVCsv() if err != nil { fmt.Println("Error listing e-Vouchers:", err) } else { for _, voucher := range vouchers { fmt.Println(voucher) } } // Validating payment valid := pm.Check(payee, payer, amount, units, batchNumber, secret, timestamp, paymentID, v2Hash) if valid { fmt.Println("SCI payment is valid") } else { fmt.Println("SCI payment validation failed") }