You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Accept Bitcoin and BitcoinCash for your business with your Laravel application and BitPay client.
8
+
LaravelBitpay enables you and your business to transact in Bitcoin, Bitcoin Cash and 10+ other BitPay-supported cryptocurrencies within your Laravel application.
Add following keys to `.env` file and updated the details ([view more about configuration](https://support.bitpay.com/hc/en-us/articles/115003001063-How-do-I-configure-the-PHP-BitPay-Client-Library-)):
76
+
### Add configuration values
77
+
78
+
Add following keys to `.env` file and updated the
79
+
details ([view more about configuration](https://support.bitpay.com/hc/en-us/articles/115003001063-How-do-I-configure-the-PHP-BitPay-Client-Library-)):
By default, package is capable of handling of webhook requests. Bitpay payment status updates are completely based on webhooks. Whenever webhook is received from server, `BitpayWebhookReceived` event is dispatched. You just need to provide a listener for this event.
89
+
### Add webhook event listener
90
+
91
+
By default, package is capable of handling of webhook requests. Bitpay payment status updates are completely based on
92
+
webhooks. Whenever webhook is received from server, `BitpayWebhookReceived` event is dispatched. You just need to
93
+
provide a listener for this event.
56
94
57
95
You can add your listener as below,
96
+
58
97
```php
59
98
<?php
60
99
@@ -111,34 +150,44 @@ class EventServiceProvider extends ServiceProvider{
111
150
}
112
151
```
113
152
114
-
## Connect to server and authenticate the client
153
+
###Connect to server and authenticate the client
115
154
116
155
- Create keypairs and pair your client(application) with BitPay server.
+ Above command will create **Private and Public key**, encrypt your private key using bitpay secure storage class using your provided password.
126
-
+ SIN (Service Identification Number) for your client will be created to uniquely identify requests from your server.
127
-
+ By using SIN **new Token and Pairing Code** will be created for your client on bitpay server and will be shown on your console output.
164
+
+ Above command will create **Private and Public key**, encrypt your private key using bitpay secure storage class
165
+
using your provided password.
166
+
+ SIN (Service Identification Number) for your client will be created to uniquely identify requests from your
167
+
server.
168
+
+ By using SIN **new Token and Pairing Code** will be created for your client on bitpay server and will be shown on
169
+
your console output.
128
170
+ Token will be used for all future request to bitpay and will automatically be copied to your `.env` file.
129
-
+ Based on environment you set**TEST/LIVE**, command will provide URL to approve your client, and then you need to copy and search Pairing Code on bitpay server & approve it.
171
+
+ Based on environment you set**TEST/LIVE**, command will provide URL to approve your client, and then you need to
172
+
copy and search Pairing Code on bitpay server & approve it.
130
173
131
174
- You are all set. :golf:
132
175
133
-
### Examples
176
+
## Examples
177
+
178
+
### Invoices
134
179
135
-
##### Create Invoice and checkout
180
+
Invoices are time-sensitive payment requests addressed to specific buyers. An invoice has a fixed price, typically
181
+
denominated in fiat currency. It also has an equivalent price in the supported cryptocurrencies, calculated by BitPay,
182
+
at a locked exchange rate with an expiration time of 15 minutes.
183
+
184
+
#### Create Invoice and checkout
136
185
137
186
Let's go step by step.
138
187
139
188
- Create your internal system order and then initiate the workflow by creating bitpay invoice as below,
140
189
141
-
```php
190
+
```php
142
191
use Illuminate\Support\Facades\Redirect;
143
192
use Vrajroham\LaravelBitpay\LaravelBitpay;
144
193
@@ -166,7 +215,7 @@ public function createInvoice()
166
215
$invoice->setBuyer($buyer);
167
216
168
217
// Set currency
169
-
$invoice->setCurrency('USD');
218
+
$invoice->setCurrency(Currency::USD); // Always use the BitPay Currency model to prevent typos
170
219
171
220
// Set redirect url to get back after completing the payment. GET Request
0 commit comments