This demo shows how to program the Payment Button/Link API to dynamically change the order price and also learn how to pass extra data to the API calls. Here is the youtube video describing the tutorial.
Cloning Repository
git clone https://github.com/AJ-54/Blockonomics_Programming_Links.git
cd Blockonomics_Programming_Links
Installing dependencies
composer install
npm install
cp .env.example .env
php artisan key:generate
- By now, you have installed all the dependencies and also created copy of the .env file.
Setting up Environment Configurations
- In the .env file, add database information to allow Laravel to connect to the database, fill in the
DB_HOST
,DB_PORT
,DB_DATABASE
,DB_USERNAME
, andDB_PASSWORD
options to match the credentials of the local database you created. - Place your Blockonomics API Key in the
Blockonomics_API
field. This will allow us to run migrations in the next step.
Migration Code
php artisan migrate
php artisan storage:link
Blockonomics Website Setup
- Create your payment link from here by going to PAYMENT BUTTONS/URL tab.
- Head to this line and replace the
parent_uid
with your value. Note thatparent_uid
is the one which is appended in your payment link afterhttps://www.blockonomics.co/pay-url/
. - Go to
OPTIONS
in the PAYMENT BUTTONS/URL tab on this page. You need to setup theORDER HOOK URL
andRedirection URL
. - To test the code locally, follow instructions from this video and make sure to place the
<domain>/receive
as your order hook url and<domain>/home
as redirection url. Here<domain>
is the domain you get from reverse proxy (Ngrok/localtunnel). - Please make sure you are using
http
and nothttps
. Your domain would be inhttps
but placehttp
URL in the order hook url and redirection url. - Make sure to save your changes!
The Last Line!
php artisan serve
Now you are all set to locally run the demo!
SSL Certification Error when trying to click on apply button
- Note that this error can be traced either inside php logs or by looking at network in inspection mode.
- Please refer to this link to help you solve the issue.