{"id":28275249,"url":"https://github.com/fshmidt/b2binpayapi","last_synced_at":"2025-07-12T21:34:08.143Z","repository":{"id":175493647,"uuid":"653975877","full_name":"fshmidt/b2binpayAPI","owner":"fshmidt","description":"This is a Golang library for working with the b2binpay API. It allows you to easily get info of currencies, wallets, rates etc.","archived":false,"fork":false,"pushed_at":"2023-06-25T16:02:33.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-16T12:52:38.487Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fshmidt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-06-15T06:23:42.000Z","updated_at":"2023-06-15T06:35:59.000Z","dependencies_parsed_at":"2023-09-14T02:53:48.514Z","dependency_job_id":null,"html_url":"https://github.com/fshmidt/b2binpayAPI","commit_stats":null,"previous_names":["fshmidt/b2binpayapi"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fshmidt/b2binpayAPI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fshmidt%2Fb2binpayAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fshmidt%2Fb2binpayAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fshmidt%2Fb2binpayAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fshmidt%2Fb2binpayAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fshmidt","download_url":"https://codeload.github.com/fshmidt/b2binpayAPI/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fshmidt%2Fb2binpayAPI/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265059348,"owners_count":23705214,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-21T03:13:47.382Z","updated_at":"2025-07-12T21:34:08.135Z","avatar_url":"https://github.com/fshmidt.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# B2BINPAY API Library\n\n\u003c!-- Table of Contents --\u003e\n# Table of Contents\n\n1. [Description](#description)\n2. [Implementation](#implementation)\n3. [Installation](#installation)\n4. [Usage](#usage)\n\n[//]: # (1. [Examples]\u0026#40;#examples\u0026#41;)\n\u003c!-- End of Table of Contents --\u003e\n\n# Description\n\nThis is a Golang library for working with the B2BINPAY API. It allows you to easily create payments, retrieve account information, perform status check requests, and other payment-related operations.\n\n# Implementation\n\n- Bearer Auth\n\n# Installation\n\nTo install the library, use the following command:\n\n```go get github.com/fshmidt/b2binpay```\n\n# Usage\n\nTo use the library, import it into your Go project:\n\n```go import \"github.com/fshmidt/b2binpay\"```\n\nNext, create a new client using your B2BINPAY account credentials:\n\n```client := b2binpay.NewClient(apiKey, apiSecret, testMode)```\n\nThe testMode parameter specifies whether to use the B2BINPAY test API or the live API.\n\nCredentials are saved in file to dercrease the number of API request. You can check if you already have one:\n\n```\nif c.GotCredentialsFile() {\n    fmt.Println(\"Found \u0026 parsed saved credentials. No need for Auth request.\")\n} else {\n    err := c.GetAuthToken()\n    if err != nil {\n        fmt.Println(\"Error obtaining auth token:\", err)\n        return\n    }\n}\n```\nIn case you have expired access token you can check it and renew one:\n```\t\nif c.IsAccessTokenExpired() {\n    err := c.RefreshAuthToken()\n    if err != nil {\n        fmt.Println(\"Error refreshing auth token:\", err)\n        fmt.Println(\"New Authorization\")\n        err = c.GetAuthToken()\n    }\n}\n```\nYou can now use the client to get wallet info:\n```\nwalet, err := c.GetWallet(walletId)\n\tif err != nil {\n\t\t// Handle error\n    }\n```\nYou can also use the client to retrieve transfer information:\n```\ntransfer, err := c.GetTransfer(transferId)\nif err != nil {\n    // Handle error\n    } \n```\nTo check the rates, you can use the GetRates method:\n```\nrates, err := c.GetRates()\n\tif err != nil {\n\t\tfmt.Println(\"RATES ERR rates: \", err)\n    }\n```\nTo get invoice details use GetInvoice method:\n```\ninvoice, err := c.GetInvoice(invoiceId)\n\tif err != nil {\n\t\t// handle error\n    }  \n```\nYou also can create invoice with CreateInvoice:\n```\ninvoice, err := c.CreateInvoice(walletID, label, confirmationsNeeded, trackingID, timeLimit, inaccuracy, targetAmountRequested, currencyID)\n\tif err != nil {\n\t\t// handle error\n\t}\n```\nFor getting payment info use GetPayout method:\n```\npayout, err := c.GetPayout(payoutId)\n\tif err != nil {\n\t\t// handle error\n\t}\n```\nFor creating payment you'll need to pass  PayoutResponse object to CreatePayout method:\n```\npayout := \u0026b2binpay.PayoutResponse{\n    b2binpay.Payout{\n        Type: \"payout-calculation\",\n        Attributes: b2binpay.PayoutAttributes{\n            Amount:    \"0.05\",\n            ToAddress: \"2N3Ac2cZzRVoqfJGu1bFaAebq3izTgr1WLv\",\n        },\n        Relationships: b2binpay.PayoutRelationships{\n            Wallet: b2binpay.Wallet{\n                Data: b2binpay.WalletData{\n                    Type: \"wallet\",\n                    ID:   \"13\",\n                },\n            },\n            Currency: b2binpay.Currency{\n                Data: b2binpay.CurrencyData{\n                    Type: \"currency\",\n                    ID:   \"1000\",\n                },\n            },\n        },\n    },\n}\npayoutCreated, err := c.CalculatePayout(*payout)\nif err != nil {\n    // handle error\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffshmidt%2Fb2binpayapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffshmidt%2Fb2binpayapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffshmidt%2Fb2binpayapi/lists"}