tarlanpayment/payments

支付网关

dev-master 2019-10-01 06:34 UTC

This package is not auto-updated.

Last update: 2024-09-20 13:38:13 UTC


README

收款服务,用于接收支付 https://tarlanpayments.kz

适用于laravel 5.2 - 5.8的tarlanpayments支付包api

安装

composer require tarlanpayments/payments

针对laravel 5.8

配置/app.php的服务提供者

  TarlanPayments\Payments\PaymentServiceProvider::class

外观

'TarlanPay' => \TarlanPayments\Payments\Facades\TarlanPay::class

发布配置文件

  php artisan vendor:publish

TarlanPay请求

发票创建示例

$pay =  TarlanPay::paymentCreate([
              'secret_key' => reference_id+secret_key,
              'merchant_id' => '4'
              'reference_id' => '11111111',
              'request_url' => 'your-site.kz',
              'back_url' => 'your-site.kz',
              'amount' => 9999,
              'user_id' => 'your-email@gmail.com',              
        ]);
          
$pay->generateUrl();

支付状态检查示例

$checkPay = TarlanPay::paymentStatus( [ 'reference_id' => '11111111' ] );

$response = TaralanPay::request( $checkPay->generateUrl() );

Epay响应

支付创建BACK_LINK响应处理示例

 $jsonResponse = request('json');

        if($jsonResponse)
        {
            $payResponse = TarlanPay::handlePaymentCreate($jsonResponse);

            Log::info( 'transaction_id='.$payResponse->getTransactionId() );
            Log::info( 'status='.$payResponse->getStatus() );
            Log::info( 'reference_id='.$payResponse->getReferenceId() );
        }

支付状态响应处理示例

$obj = TarlanPay::paymentStatus( request()->all() );
       $response = TarlanPay::request( $obj->generateUrl() );

       if($response) {
           $checkPaymentResponse = TarlanPay::handlePaymentStatusResponse( $response );
           dd($checkPaymentResponse->getData());

           Log::info('status='.$checkPaymentResponse->getData());
           Log::info('message='.$checkPaymentResponse->getMessage());
           Log::info('data='.$checkPaymentResponse->getData());
           Log::info('error_code='.$checkPaymentResponse->getErrorCode());
       }

Payment status:
    const STATUS_NEW = 0;
    const STATUS_OK = 1;
    const STATUS_PROCESS = 2;
    const STATUS_AUTHORIZED = 3;
    const STATUS_CANCELED = 4;
    const STATUS_REFUND = 5;
    const STATUS_FAILED = 6;