public async void createInvoice() { //1.New Invoice Preparation //1.インボイス オブジェクトに必要項目をセットする string curr = cmbCurrency.options[cmbCurrency.value].text; Invoice invoice = new Invoice(double.Parse(amount.text), curr);//金額と通貨 invoice.BuyerEmail = email; invoice.FullNotifications = true; invoice.NotificationEmail = email; invoice.PosData = "TEST POS DATA"; invoice.ItemDesc = product.text;//購入アイテムの名称 //2.Create Invoice with initial data and get the full invoice //2.BTCPayServerにインボイスデータをサブミットして、インボイスの詳細データを取得する。 invoice = btcPayClient.createInvoice(invoice); Debug.Log("Invoice Created:" + invoice.Id); Debug.Log("Invoice Url:" + invoice.Url); //3.Lightning BOLT invoice string //3.Lightning BOLT invoice データは以下のプロパティから取得する。 List <InvoiceCryptoInfo> cryptoInfoList = invoice.CryptoInfo; Texture2D texs = btcPayClient.generateQR(cryptoInfoList[0].paymentUrls.BOLT11);//Generate QR code image //4.Set the QR code iamge to image Gameobject //4.取得したBOLTからQRコードを作成し、ウオレットでスキャンするために表示する。 QRcode.GetComponent <Image>().sprite = Sprite.Create(texs, new Rect(0.0f, 0.0f, texs.width, texs.height), new Vector2(0.5f, 0.5f), 100.0f); //5.Subscribe the an callback method with invoice ID to be monitored //5.支払がされたら実行されるasync コールバックを引き渡して、await で実行する await btcPayClient.subscribeInvoiceAsync(invoice.Id, printInvoice); }
static void Main(string[] args) { String pairingCode = "uGhQ6vx"; String host = "btcpaytest.indiesquare.net"; BTCPayClient bitpay = new BTCPayClient(new MonoBehaviour(), pairingCode, host); //New Invoice Prep Invoice invoice = new Invoice(1.0, "USD"); invoice.BuyerName = "Masashi"; invoice.BuyerEmail = "*****@*****.**"; invoice.FullNotifications = true; invoice.NotificationEmail = "*****@*****.**"; invoice.PosData = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; invoice.ItemDesc = "Test Description"; //Create Invoice bitpay.createInvoice(invoice, printInvoice); //Get Invoice bitpay.getInvoice(invoice.Id, printInvoice); //Subscribe Invoice to change //bitpay.subscribeInvoice(invoice.Id, printInvoice); }
public void createInvoice() { //1.New Invoice Preparation //1.インボイス オブジェクトに必要項目をセットする string curr = cmbCurrency.options[cmbCurrency.value].text; Invoice invoice = new Invoice(double.Parse(amount.text), curr);//金額と通貨 invoice.BuyerEmail = email; invoice.FullNotifications = true; invoice.NotificationEmail = email; invoice.ItemDesc = product.text;//購入アイテムの名称 string json = JsonConvert.SerializeObject(invoice); JObject jo = JObject.Parse(json); //2.Create Invoice with initial data and get the full invoice //2.BTCPayServerにインボイスデータをサブミットして、インボイスの詳細データを取得する。 StartCoroutine(btcPayClient.createInvoice(invoice, handleInvoice)); }