Example integration of laravel coinpayments.
git clone https://github.com/kevupton/example-laravel-coinpayments.git
vim .env
Setup your environment variables
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
COINPAYMENTS_DB_PREFIX=cp_
COINPAYMENTS_MERCHANT_ID=your_unique_merchant_id
COINPAYMENTS_PUBLIC_KEY=generated_public_key
COINPAYMENTS_PRIVATE_KEY=generated_private_key
COINPAYMENTS_IPN_SECRET=your_custom_ipn_secret
COINPAYMENTS_IPN_URL=http://YOUR-ADDRESS/api/ipn
COINPAYMENTS_API_FORMAT=json
COINPAYMENTS_IPN_ROUTE_ENABLED=true
COINPAYMENTS_IPN_ROUTE_PATH=/api/ipn
Note: get your keys and ipn secret from the coinpayments website. You will need to setup an IPN secret manually.
Setup the database
php artisan migrate
Running example purchase
curl -X POST \
http://localhost/coinpayments-example/public/api/purchase \
-H 'cache-control: no-cache' \
-F amount=1000 \
-F currency=ETH
Running example donation
curl -X POST \
http://localhost/coinpayments-example/public/api/donation \
-H 'cache-control: no-cache' \
-F amount=1000 \
-F currency=ETH
Getting a callback address
curl -X GET \
http://localhost/coinpayments-example/public/api/address?currency=DGB \
-H 'cache-control: no-cache'
The output of each event is printed inside of storage/logs/laravel.log
.
Check out the log to see what each event receives.