@extends('layouts.frontend') @section('title') @lang('API Documentation') @endsection @section('content')

@lang('API Endpoints & Authentication')

@lang(' All requests to the') {{$gs->title}} @lang('API are sent via the HTTP POST method to one of our API endpoint URLs').

  • @lang('HTTP Request Method') : POST
  • @lang('API Endpoint') : {{url('payment/process')}}
  • @lang('JSON Content-Type') : application/json
@lang('All calls to the') {{$gs->title}} @lang('API require merchant authentication and merchant access key.') @lang('Sign up') @lang('for a account to quickly get started').
@lang('Sandbox payment can be also initiated while merchant set the service mode as test in merchant dashboard. It will be live while the mode will be set as active mode.')

@lang('API Access Key')

@lang('Register as a merchant in our system. In your merchant dashboard you will find the option for API access key.')

@lang('Example access key : 51a4bd18-5bc1-4eaa-97b0-c09323398883')

@lang('Payment Transaction Initiate')

@lang('The following example code enables you to initiate a payment,depending on how you structure it. The perameter details are also below.')

@lang('Param Name') @lang('Param Type') @lang('Description')
@lang('custom') @lang('string') @lang('Identification of your end') @lang('Required')
@lang('amount') @lang('decimal') @lang('The amount you want to transaction') @lang('Required')
@lang('details') @lang('string') @lang('Purchase details') @lang('String Max 255')
@lang('web_hook') @lang('string') @lang('Instant payment notification url') @lang('Required')
@lang('cancel_url') @lang('string') @lang('Payment cancel return url') @lang('Required')
@lang('success_url') @lang('string') @lang('Payment success return url') @lang('Required')
@lang('customer_email') @lang('string') @lang('Customer email address') @lang('Required')
@lang('access_key') @lang('string') @lang('Send access_key as bearer token with header') @lang('Required')
                                
    
            <?php
                $parameters = [
                    'custom' => 'DFU80XZIKS',
                    'currency_code' => 'USD',
                    'amount' => 280.00,
                    'details' => 'Digital Product',
                    'web_hook' => 'http://yoursite.com/web_hook.php',
                    'cancel_url' => 'http://yoursite.com/cancel_url.php',
                    'success_url' => 'http://yoursite.com/success_url.php',
                    'customer_email' => 'customer@mail.com',
                ];
                
                $url = 'http://yourwallet.com/payment/process';
                
                $headers = [
                    "Accept: application/json",
                    "Authorization: Bearer access_key",
                ];
                
                $ch = curl_init();
                curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
                curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
                curl_setopt($ch, CURLOPT_URL, $url);
                curl_setopt($ch, CURLOPT_POSTFIELDS,  http_build_query($parameters));
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                $response = curl_exec($ch);
                curl_close($ch);
            ?>
    
                            

@lang('Example Response after initiating payment')

                                
        
        
            //Success Response.
            {
                "code": 200,
                "status": "ok",
                "payment_id": "AIYmQIOAz0GlmsjfhgiOeu304",
                "message": "Your payment has been processed. Please follow the URL to complete the payment.",
                "url":"{{url('/')}}/process-checkout?payment_id=AIYmQIOAz0GlmsjfhgiOeu304"
            }

            //Error Response.
            {
                "code": 401,
                "status": "error",
                "message": "Invalid API credentials."
            }
            
            
        
                            

@lang('Response after successful payment')

                                
        
        
            //Success Response.
            {
                "code": 200,
                "status": "ok",
                "payment_id": "AIYmQIOAz0GlmsjfhgiOeu304",
                "transaction": "AIYmQIOAz0G",
                "amount": 100.00,
                "charge": 5.00,
                "currency": "USD",
                "custom": "BVSUZ545XCS",
                "date"  : "22-05-2022"
            }

            
        
                            

@lang('Verify Payment')

@lang('You can verify the payment whether it is valid or not. After successful payment transaction you will have the response where you find the Payment ID. With this payment id and your access key you need make a request to our server for verify the payment. Example code is below. ')

@lang('Payment verify end point : ') {{url('payment/check-validity')}}

                                
    
            <?php
                $parameters = [
                    'payment_id' => 'AIYmQIOAz0GlmsjfhgiOeu304',
                ]
                
                $url = '{{url('payment/check-validity')}}';
                
                $headers = [
                    "Accept: application/json",
                    "Authorization: Bearer access_key",
                ];
                
                $ch = curl_init();
                curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
                curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
                curl_setopt($ch, CURLOPT_URL, $url);
                curl_setopt($ch, CURLOPT_POSTFIELDS,  $parameters);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                $response = curl_exec($ch);
                curl_close($ch);
            ?>
    
                            

@lang('Validity Response')

                                
        
        
            //Success Response.
            {
                "code": 200,
                "status": "ok",
                "message": "Transaction is valid",
                
            }

            //Error Response.
            {
                "code": 401,
                "status": "error",
                "message": "Invalid API credentials."
            }

            //or
            {
                "code": 404,
                "status": "error",
                "message": "Transaction not found"
            }

            
        
                            

@lang('Supported Currencies')

@lang('Following currencies are currently supported in our system. It may update furthur.')

@foreach ($currencies as $item) @endforeach
@lang('Currency Name') @lang('Currency Symbol') @lang('Currency Code')
{{$item->curr_name}} {{$item->symbol}} {{$item->code}}
@endsection @push('script') @endpush