PayPal payment integration code with auto return URL in sandbox mode

Here we are elaborate steps needed in PayPal payment integration with auto return URL in sandbox mode

>>> step one

we need a PayPal form with field values like amount , invoice, currency_code and action “https://www.sandbox.paypal.com/cgi-bin/webscr”

See below code
paypal payment form with auto return URL
( copy below code and save )

<div class="row spo space_top_10" style=" margin: auto;width: 24%;margin-top: 6%;">
 <h1>subscribe now </h1>
 <form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr">
 <input type="hidden" value="_xclick" name="cmd">
 <input type="hidden" value="[email protected]" name="business">
 
 <input type="hidden" value="Order for subscribtion" name="item_name">
 <input type="hidden" value="NA" name="item_number">
 <input type="hidden" value="4" name="amount">
 <input type="hidden" value="1234567890" name="invoice">
 <input type="hidden" value="0" name="discount_amount"> 
 <input type="hidden" value="0" name="no_shipping">
 <input type="hidden" value="No comments" name="cn">
 <input type="hidden" value="USD" name="currency_code">
 <input type="hidden" value="https://www.tutorialshore.com/paypal/paypal.php" name="return">
 <input type="hidden" value="2" name="rm"> 
 
 <input type="hidden" value="US" name="lc">
 <input type="hidden" value="PP-BuyNowBF" name="bn">
 <input type="text" value="4 USD" name="amount2">
 <input type="submit" value="Pay by paypal" name="finalizeOrder" id="finalizeOrder" class="submitButton paypal_button">
</form>
</div>



>>>>> Step two

open below link and login with PayPal credential
https://developer.paypal.com/

Go to sandbox menu account and create bushiness account and personal account

store both personal and businesses sandbox credential and logout

>>>> Step three

Visit below link and login with sandbox businesses credential

https://www.sandbox.paypal.com/cgi-bin/webscr

Go to Account Settings as seen in the below picture

PayPal payment integration code with auto return URL in sandbox mode

Go to website payment as seen in the below picture

PayPal payment integration code with auto return URL in sandbox mode step 2

click Website preferences update options

PayPal payment integration code with auto return URL in sandbox mode step 3

start your payment test

https://www.tutorialshore.com/paypal/paypal.php

Drupal 8 Query to get category info

Here is the Drupal 8 Query to get category info
here category name “color_cat”

$vid = ‘color_cat’;
$parent_tid = 0;//parent id
$depth = 2; //depth upto which level you want
$load_entities = FALSE;
$cat_data= \Drupal::entityTypeManager()->getStorage(‘taxonomy_term’)->loadTree($vid,
$parent_tid, $depth, $load_entities);

$variables[‘color_cat’] = $cat_data;

add below code inside your .theme file

in .twig file you have use below twig code to display category name


  {% for key1, value in color_cat %}
                

{{ color_cat[key1]['name'] }} {% endfor %}

How to clear Drupal 8 cache without using drush command or admin login

To clear Drupal 8 cache without using drush command or admin login

Method 1

Open setting.php ( sites/default/setting.php) add below line

$settings['rebuild_access'] = TRUE; 

run  https://wwwyourdomaincom/core/rebuild.php  from your browser   
it is the eeasiest methods to clear Drupal 8 cache without using drush command or admin login

Method 2

Open phpmyadmin and clear all cache table from your Drupal 8 database

TRUNCATE cache_config;
TRUNCATE cache_container;
TRUNCATE cache_data;
TRUNCATE cache_default;
TRUNCATE cache_discovery;
TRUNCATE cache_dynamic_page_cache;
TRUNCATE cache_entity;
TRUNCATE cache_menu;
TRUNCATE cache_render;
TRUNCATE cache_toolbar;