אני רוצה להוסיף תשלום דרך paypal
החנות נכתבה בשפת php
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
היכנס לדלת השאלות והתשובות החברתיות שלנו כדי לשאול שאלות או לענות על שאלות של אנשים ולהתחבר לאנשים אחרים.
איבדת את הסיסמה שלך? אנא הכנס את כתובת הדוא"ל שלך. תקבל קישור ותיצור סיסמה חדשה בדוא"ל.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
כדי לקבל תשלום דרך PayPal בחנות האינטרנט שלך ב-PHP, יש לממש את ה-API של PayPal. הנה דוגמא פשוטה:
1. **הרשמה ל-API של PayPal:**
– היכנס לחשבון PayPal שלך.
– גש לקטגוריית "פיתוח".
– יצור אפליקציה חדשה וקבל את ה-Client ID וה-Secret.
2. **ספריית PayPal SDK:**
– התקן את ה-SDK של PayPal דרך ה-terminal עם הפקודה `composer require paypal/rest-api-sdk-php`.
3. **כתיבת קוד PHP:**
<?php
require __DIR__ . '/vendor/autoload.php';
// הגדרת משתנים
$clientId = 'ה-Client-ID-שלך';
$clientSecret = 'ה-Secret-שלך';
$apiContext = new \PayPal\Rest\ApiContext(
new \PayPal\Auth\OAuthTokenCredential($clientId, $clientSecret)
);
// יצירת עסקה
$transaction = new \PayPal\Api\Transaction();
$amount = new \PayPal\Api\Amount();
$details = new \PayPal\Api\Details();
$payment = new \PayPal\Api\Payment();
$details->setShipping(2.00)
->setTax(1.00)
->setSubtotal(7.00);
$amount->setCurrency('USD')
->setTotal(10.00)
->setDetails($details);
$transaction->setAmount($amount);
$payment->setIntent('sale')
->setPayer($payer)
->setTransactions([$transaction]);
// יצירת עסקה ב-PayPal
try {
$payment->create($apiContext);
} catch (\PayPal\Exception\PayPalConnectionException $ex) {
echo $ex->getCode();
echo $ex->getData();
die($ex);
}
// קישור לתשלום ב-PayPal
echo "לביצוע התשלום: " . $payment->getApprovalLink();
?>
**שים לב:** הכנס את ה-Client ID וה-Secret שלך בקוד.
יש לך להוסיף לקוד פונקציות ולוגיקת עסק לפי דרישות החנות שלך, ולהגיב לתשלומים המתבצעים באופן אוטומטי.
תודה זה עובד!!!
Concrete floors are renowned for their strength
and endurance. Unlike traditional flooring materials, they resist
wear and tear from heavy foot traffic, making them ideal for both residential and commercial settings.
Pretty section of content. I just stumbled upon your
website and in accession capital to assert that I get actually enjoyed account your blog posts.
Any way I'll be subscribing to your feeds and even I achievement you access consistently rapidly.