مع WittyPay – Payment Solutions القياسي والسريع، يمكنك بسهولة وبأمان استلام مدفوعات عبر الإنترنت من عميلك.

WittyPay – Payment Solutions توثيق بوابة الدفع السريع.

دافع

إذا أراد الدافع تمويل المدفوعات باستخدام WittyPay – Payment Solutions، قم بتعيين الدافع إلى WittyPay – Payment Solutions. (وسائل دفع أخرى مثل بايبال، سترايب، وعملات معماة وما إلى ذلك غير متاحة حتى الآن)

                        
                            //Payer Object 
                            $payer = new Payer(); 
                            $payer->setPaymentMethod('PayMoney'); //preferably, your system name, example - PayMoney
                        
                    
مقدار

حدد مبلغ الدفع والعملة.

                        
                            //Amount Object 
                            $amountIns = new Amount(); 
                            $amountIns->setTotal(20)->setCurrency('USD'); //must give a valid currency code and must exist in merchant wallet list 
                        
                    
عملية

إنه مورد معاملات حيث يجب تعيين كائن المبلغ.

                        
                            //Transaction Object
                            $trans = new Transaction();
                            $trans->setAmount($amountIns);
                        
                    
RedirectUrls

قم بتعيين عناوين url حيث يجب على المشتري إعادة التوجيه بعد اكتمال المعاملة أو إلغاؤها.

                        
                            //RedirectUrls Object
                            $urls = new RedirectUrls();
                            $urls->setSuccessUrl('http://your-merchant-domain.com/example-success.php') //success url - the merchant domain page, to redirect after successful payment, see sample example-success.php file in  sdk root, example - http://techvill.net/PayMoney_sdk/example-success.php
                            ->setCancelUrl('http://your-merchant-domain.com/');//cancel url - the merchant domain page, to redirect after cancellation of payment, example - http://techvill.net/PayMoney_sdk/
                        
                    
قسط

إنه مورد دفع حيث يجب تعيين جميع Payer و Amount و RedirectUrls وبيانات اعتماد التاجر (معرّف العميل وسر العميل). بعد التهيئة في كائن الدفع ، تحتاج إلى استدعاء طريقة الإنشاء. سيُنشئ عنوان URL لإعادة التوجيه. يتعين على المستخدمين إعادة التوجيه إلى عنوان URL هذا لإكمال المعاملة.

                        
                            //Payment Object
                            $payment = new Payment();
                            $payment->setCredentials([ //client id & client secret, see merchants->setting(gear icon)
                            'client_id' => 'place your client id here',  //must provide correct client id of an express merchant
                            'client_secret' => 'place your client secret here' //must provide correct client secret of an express merchant
                            ])->setRedirectUrls($urls)
                            ->setPayer($payer) 
                            ->setTransaction($trans);
                            
                            try {
                            $payment->create(); //create payment
                            header("Location: ".$payment->getApprovedUrl()); //checkout url
                            } catch (Exception $ex) { 
                            print $ex; 
                            exit; }
                        
                    

بضع خطوات حول كيفية تشغيل هذا الرمز على جهازك:

الأول :

انقر فوق تنزيل الحزمة

الثاني :

الآن ، اذهب إلى php-sdk/src/PayMoney/Rest/Connection.php, ثم تغير BASE_URL value to your domain name(i.e: If the domain is - 'your-domain.com' then, define( 'BASE_URL' , 'http://your-domain.com/' ) )

                        
مثال على الكود
require 'vendor/autoload.php'; //if you want to change the namespace/path from 'PayMoney' - lines[1-5] - //to your desired name, i.e. (use PayMoney\Api\Amount; //to use MyDomain\Api\Amount;), then you must change the folders name that holds the API classes //as well as change the property 'PayMoney' in (autoload->psr-0) of (php-sdk/composer.json) file to your //desired name and run "composer dump-autoload" command from sdk root use PayMoney\Api\Payer; use PayMoney\Api\Amount; use PayMoney\Api\Transaction; use PayMoney\Api\RedirectUrls; use PayMoney\Api\Payment; //Payer Object $payer = new Payer(); $payer->setPaymentMethod('PayMoney'); //preferably, your system name, example - PayMoney //Amount Object $amountIns = new Amount(); $amountIns->setTotal(20)->setCurrency('USD'); //must give a valid currency code and must exist in merchant wallet list //Transaction Object $trans = new Transaction(); $trans->setAmount($amountIns);

تعليمات اختيارية

إذا كنت لا ترى التغييرات بعد تكوين SDK واستخراجها ، فانتقل إلى جذر SDK الخاص بك وقم بتشغيل الأوامر أدناه:-

  • الملحن مسح ذاكرة التخزين المؤقت
  • تثبيت الملحن
  • تحميل التفريغ التلقائي للملحن