Lanka Developers Community

    Lanka Developers

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Shop

    DirectPay Payment geteway to Laravel integrate krpu kenk inwad ? Need help

    Laravel Framework
    payment gateway
    2
    6
    940
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      Kasun Anuradha last edited by

      integration krnwa vidiya example ekk tiynwanm dendko

      1 Reply Last reply Reply Quote 1
      • M
        malinga91 last edited by

        Documentation ekak denawa neda eyala service eka offer karanakota?

        1 Reply Last reply Reply Quote 0
        • K
          Kasun Anuradha last edited by

          3.2. Create payment session

          Gateway URL
          Sandbox = https://test-gateway.directpay.lk/api/v3/create-session
          Live = https://gateway.directpay.lk/api/v3/create-session

          3.2.2.
          Sample Request
          Note: Example code for each step is provided using PHP.
          $checkout_url =
          "https://test-gateway.directpay.lk/api/v3/create-session";
          $requestPayload = [
          "merchant_id" => "xxxxxx",
          "amount" => "140.00",
          "source" => "custom-plugin",
          "type" => "ONE_TIME",
          "order_id" => "CP123456789",
          "currency" => "LKR",
          "response_url" => "https://test.com/response-endpoint",
          "return_url" => "https://test.com/return",
          "first_name" => "Sam",
          "last_name" => "Perera",
          "email" => "[email protected]",
          "phone" => "071xxxxxxx",
          "description" => "test-payment",
          "logo" => "",
          ];
          $jsonEncodedPayload = json_encode($requestPayload);
          $base64EncodedPayload = base64_encode($jsonEncodedPayload);
          $secret = "vs6568s7v2aklsdv687a3dn8a6q92z";
          $generatedHash = hash_hmac('sha256', $base64EncodedPayload, $secret);
          $signature = "hmac " . $generatedHash;
          $ch = curl_init();
          curl_setopt_array($ch, array(
          CURLOPT_URL => $checkout_url,
          10CURLOPT_RETURNTRANSFER => true,
          CURLOPT_ENCODING => "",
          CURLOPT_MAXREDIRS => 10,
          CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
          CURLOPT_CUSTOMREQUEST => "POST",
          CURLOPT_POSTFIELDS => $base64EncodedPayload,
          CURLOPT_HTTPHEADER => [
          "Content-Type: text/plain",
          "Authorization: $signature",
          ],
          ));
          $response = curl_exec($ch);
          curl_close($ch);

          Sample Response

          Success Response
          {
          "status": 200,
          "data": {
          "link": "https://test-gateway.directpay.lk/52e28db633eb3838",
          "token": "52e28db633eb3838",
          "sms_status": null,
          "email_status": null
          }
          }

          Fail Response
          {
          "status": 400,
          "data": {
          "title": "Invalid Signature: ",
          "message": "Provided signature is invalid",
          "code": "invalidSignature"
          }
          }

          1 Reply Last reply Reply Quote 0
          • K
            Kasun Anuradha last edited by

            $secret = "vs6568s7v2aklsdv687a3dn8a6q92z"; secret key ek ila gannda one eyalgen

            M 1 Reply Last reply Reply Quote 0
            • M
              malinga91 @Kasun Anuradha last edited by

              @Kasun-Anuradha hari giyada? danui dakke. :)

              1 Reply Last reply Reply Quote 1
              • K
                Kasun Anuradha last edited by

                ou brother hri giya Thank you..!

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post

                1
                Online

                3.7k
                Users

                1.3k
                Topics

                5.3k
                Posts

                • Privacy
                • Terms & Conditions
                • Donate

                © Copyrights and All right reserved Lanka Developers Community

                Powered by Axis Technologies (PVT) Ltd

                Made with in Sri Lanka

                | |