ngenius-payment не в состоянии интегрироваться, я следовал DOCS, но выдает ошибку. go на страницу оплаты - PullRequest
0 голосов
/ 07 апреля 2020
public function payment(Request $request){
    //===============Getting Access Token from N-Genius Platform Network===============================================
    $apikey = "api-key";        // enter your API key here
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://api-gateway.sandbox.ngenius-payments.com/identity/auth/access-token");
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        "accept: application/vnd.ni-identity.v1+json",
        "authorization: Basic ".$apikey,
        "content-type: application/vnd.ni-identity.v1+json"
    ));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS,  "{\"realmName\":\"ni\"}");
    $output = json_decode(curl_exec($ch));
    $access_token = $output->access_token;
    //===============END Getting Access Token from N-Genius Platform Network=============================================
    //===============N-Genius Payment Gateway will redirect to the pay page =============================================
    $postData = new StdClass();
    $postData->action = 'Sale';
    $postData->amount = new StdClass();
    $postData->amount->currencyCode = 'AED';
    $postData->amount->value = 1 * 100;
    $postData->language = 'en';
    $postData->emailAddress = 'form user email';
    $postData->billingAddress['firstName'] = 'form first name';
    $postData->billingAddress['lastName'] = 'form last name;
    $postData->merchantAttributes['redirectUrl'] = 'redirection page route';
    $token = $access_token;
    $json = json_encode($postData);
    $outlet = "outlet-id";
    $token = $access_token;
    $json = json_encode($postData);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'https://api-gateway.sandbox.ngenius-payments.com/transactions/outlets/'.$outlet.'/orders');
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Authorization: Bearer '.$token,
        'Content-Type: application/vnd.ni-payment.v2+json',
        'Accept: application/vnd.ni-payment.v2+json'));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
    $output = json_decode(curl_exec($ch));
    $order_reference = $output->reference;
    $order_paypage_url = $output->_links->payment->href;
    header("Location: ".$order_paypage_url);                              // execute redirect
    //die();
    curl_close ($ch);
    //===============END N-Genius Payment Gateway will redirect to the pay page =============================================
}

Любой может помочь мне, пожалуйста. Пожалуйста, объясните мне, как интегрировать ngenius-платежный шлюз в приложение laravel. Их документации недостаточно для интеграции с laravel. я планирую выбрать оплату с их сайтов и вернуться к нам с обратным URL.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...