Wednesday, October 4, 2023
Alternative Way
  • Home
  • Latest
    • Latest
  • News
  • World Tech
  • World Gaming
  • Minecraft
  • Guides
  • Contact Us
  • About The Team
    • Privacy Policy
    • Terms of Use
No Result
View All Result
  • Home
  • Latest
    • Latest
  • News
  • World Tech
  • World Gaming
  • Minecraft
  • Guides
  • Contact Us
  • About The Team
    • Privacy Policy
    • Terms of Use
No Result
View All Result
Alternative Way
No Result
View All Result

Paypal integration in PHP Application

Gordon James by Gordon James
October 3, 2021
in Latest
0 0
0
Home Latest

Last updated on the 28th. August 2020 at 5:14 p.m.

In this lesson I will explain how we can integrate the Paypal payment gateway into our PHP application. If you want to know more about integration with other payment gateways, please read these messages. The integration of the Paypal payment gateway into the web application takes a few minutes. Before we start, I hope you have a PayPal account or can create a free PayPal developer account.

Real-time demonstration : – PayPal Payment Gateway

Requirements

Here are the steps that can help you integrate PayPal into PHP applications.

PayPalPayment gateway

Step one. Before you start the integration, you can create a PayPal account and retrieve your sandbox login details. Go to developer.paypal.com and register. After logging in, click on the Account menu on the left side of the screen, below the Sandbox, as shown in the figure below.

Paypal gateway integration

You can create a new account by clicking on the Create Account button. You cannot use real mail for the sandbox mode.

Step two. You will also need a customer identification and a customer secret, which you can obtain from the My Applications menu and the toolbar login details. Click on View to reveal the secret.

Tutorial for Paypal PHP integration

Step three. We now need to install the PHP SDK from Paypal, then you can install the plugin together with the composer.

the composer needs Paypal/rest-api-sdp-php:*

Step four. Now, once our plugin is installed, you will need to create a new PHP file where we can download this plugin and make the payment via Paypal. I create an index.php file in which I create a form in which I simply provide the name and price of the product.

Product = $_POST [Product];
$Entry_amount = $_POST [Amount] ;

Fee in $ = https://demo.trinitytuts.com/paypal/callback.php ; currency exchange
$ = https://demo.trinitytuts.com/paypal/canceled.php ; currency
$ = ‘USD’ ;

$apiContext = new PayPalRestApiContext(
new PayPalAuthOAuthTokenCredential(
‘ATQPCjSAopkGqgqea7ShUok5nlSYaqY5OAl9Td3l9bCBi5F6pC9QgKWkLzZXvkhyVde4Cp2eCxYtSZSo’, // Customer ID
‘EBWXI5X8os7IprmNy94oMeCZhruzJije55Yh5Pv7hUZ5hnCbTsHfr4hiDBz7f0XFvRakf0iuoE1XIH’ // Customer Secrecy
)
) ;

$apiContext->setConfig(
array(
‘mode’ => ‘sandbox’,
)
) ;
$payer = new payer() ;
$payer->setPaymentMethod(paypal) ;

$item1 = new item();
$item1->setName($Product)
->setCurrency(‘USD’)
->setQuantity(1)
->setSku(1) // Same as item number in the classic API
->setPrice($Input_Amount);
$itemArr[] = $item1

$itemList = new ItemList() ;
$itemList–>setItems($itemArr) ;

$details = new details();
$details->setShipping(0)
->setTax(0)
->setSubtotal($enter_amount) ;

Amount $ = new amount();
Amount $->setCurrency(USD)
->setTotal($Input Amount)
->setDetails($Details) ;

transaction = new transaction();
$ transaction->setAmount($amount)
->setItemList($itemList)
->setDescription(payment description)
->setInvoice number(uniqid()) ;

$redirectUrls = new RedirectUrls() ;
$redirectUrls->setReturnUrl($return?success=true)
->setCancelUrl($cancel?success=false) ;

$payment = new payment();
$payment->setIntent(sales)
->setPayer($payer)
->setRedirectUrls($redirectUrls)
->setTransactions(array($transaction)) ;

$Proceeds = Payment of cloning $ ;

try {
$payment->create($apiContext);
}catch (exception $ex) {
$error = $ex;
echo

“;

print_r($error) ;

}

$approvalUrl = $payment->getApprovalLink();
parse_str($approvalUrl, $url) ;

title (location: $ resolutionUrl);
dies;
}
?>

<Html Doctype

Paypal-PHP integration example

Top of Form

Product

Amount

Steer.

Bottom of Form

https://code.jquery.com/jquery-3.4.1.slim.min.js
https://cdn.jsdelivr.net/npm/ [protected e-mail]/dist/dist/um/popper.min.js
https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js.

Step five. You will also need to create a callback.php file, a trade response from the Paypal gateway.

Currency = USD ;

$apiContext = new PayPalRestApiContext(
new PayPalAuthOAuthTokenCredential(
‘ATQPCjSAopkGqgqea7ShUok5nlSYaqY5OAl9Td3l9bCBi5F6pC9QgKWkLzZXvkhyVde4Cp2eCxYtSZSo’, // Customer ID
‘EBWXI5X8os7IprmNy94oMeCZhruzJije55Yh5Pv7hUZ5hnCbTsHfr4hiDBz7f0XFvRakf0iuoE1XIH’ // Customer Secrecy
)
) ;

$apiContext->setConfig (
array (
‘mode’ => ‘sandbox’,
)
) ;

$token = $_GET[‘token’] ;
$paymentId = $_GET[‘paymentId’] ;
$payerId = $_GET[‘PayerID’] ;
$payment = Payment::get($paymentId, $apiContext) ;

$uitvoering = new payment execution() ;
$uitvoering->setPayerId($payerId) ;

$result = $payment ->execution ($execution, $apiContext) ;

$Payment = Payment: :get($paymentId, $apiContext) ;
$-Transactions = $payment->getTransactions() ;
$-Transaction = $-Transactions[0] ;
$-RelatedResources = $-Transaction->getRelatedResources() ;
$-RelatedResource = $-RelatedResources[0] ;
$-Sales = $-RelatedResources[0]->getSale() ;
$-SalesId = $-Sales->getId() ;

$sale = Dirty::get($saleId, $apiContext) ;

$data[‘reference_id’] = $token;
$data[‘payment_request_id’] = $paymentId;
$data[‘payment_id’] = $sale->getID();
$data[‘response’] = ‘{invoice_no : ‘.$sale->invoice number…, method: paypal}’;
$data[‘payment_status’] = $sale->getState() ;

ultrasound

“;

print_r($data) ;

}

You can now test it in your browser, and if all works well, you can update your API key with live details. I’m also making a demo for this example You can try out this link: – Paypal Payment is a real example.

If my mail helps you, don’t forget to enjoy our Facebook page and subscribe to our YouTube channel.

 

Related Tags:

mail.ru virus reddit,mail ru virus amazon,how to remove mail ru from opera,search mail ru ie_addon_dll dll,mail ru hijacker,delete искать в интернете,faxir.ru virus,block mail ru,mail ru updater,zemana antimalware,malwarebytes free,how to completely remove mail ru virus,clck ru virus,is mail.ru safe,how to delete mail.ru account,horux.cz virus

Total
0
Shares
Share 0
Tweet 0
Pin it 0
Share 0
ShareTweetShare
Gordon James

Gordon James

Next Post
Tamilrockers ws 2020 | Tamilrockers Proxy

Tamilrockers ws 2020 | Tamilrockers Proxy

  • Trending
  • Comments
  • Latest
How To Get Free Internet On Android Without Service

How To Get Free Internet On Android Without Service

March 10, 2022
🥇 +4 Neo Geo Emulators for Android  List ▷ 2021

🥇 +4 Neo Geo Emulators for Android  List ▷ 2021

October 3, 2021

Fix: Notifications not working on Nova Launcher

October 3, 2021
How to Fix OpenVPN Connected but Not Changing IP Address

How to Fix OpenVPN Connected but Not Changing IP Address

October 3, 2021

Setting Up Directory Sync Between On-Premises Active Directory with Microsoft 365 Azure AD

0
🥇 DELETE ACCOUNT from PS4  ▷ Step by Step Guide ▷ 2020

🥇 DELETE ACCOUNT from PS4  ▷ Step by Step Guide ▷ 2020

0
🥇 PPTX File Extension  What is .Pptx and how to open them? ▷ 2020

🥇 PPTX File Extension  What is .Pptx and how to open them? ▷ 2020

0
🥇 Make a Crossword in Microsoft Word  Step by Step Guide ▷ 2020

🥇 Make a Crossword in Microsoft Word  Step by Step Guide ▷ 2020

0
Image2

The 3 Qualities of a Good Sports Betting Site

September 12, 2023
Image1

From Casino Chips to Cryptocurrency: The Evolution of Payment Methods

September 8, 2023
Image1

The Most Effective Online Casino Guide for Online Gambling in the World

August 30, 2023
Image3

Around the Globe

August 23, 2023

There's always an alternative Way!
No Result
View All Result
  • Home
  • Latest
    • Latest
  • News
  • World Tech
  • World Gaming
  • Minecraft
  • Guides
  • Contact Us
  • About The Team
    • Privacy Policy
    • Terms of Use

© 2022 - Alternative Way

No Result
View All Result
  • Home
    • Home – Layout 1
    • Home – Layout 2
    • Home – Layout 3
    • Home – Layout 4
    • Home – Layout 5
  • Travel News

© 2023 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT