Payment cannot be processed because don’t have Secure Connection.SSL Certificate

Asked

Viewed 649 times

4

I am using Ionic 3 with the plugin of the marketPago and when I will complete the purchase it returns me this error, everything takes into account to be an error caused by the Ionic run on a webView.

ionic info(In case anyone needs)

Ionic:

   ionic (Ionic CLI)  : 4.8.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.2

Cordova:

   cordova (Cordova CLI) : 8.1.2 ([email protected])
   Cordova Platforms     : android 7.1.4, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.2, (and 9 other plugins)

System:

   Android SDK Tools : 26.1.1 (/Users/Pettrin/Library/Android/sdk)
   ios-deploy        : 1.9.2
   NodeJS            : v8.11.3 (/usr/local/bin/node)
   npm               : 2.15.12
   OS                : macOS High Sierra
   Xcode             : Xcode 9.4.1 Build version 9F2000

inserir a descrição da imagem aqui

*ng:///IonicModule/AlertCmp.ngfactory.js:201 ERROR Error: Your payment cannot be processed because the website contains credit card data and is not using a secure connection.SSL certificate is required to operate.
    at i (mercadopago.js:616)
    at n (mercadopago.js:626)
    at mercadopago.js:585
    at mercadopago.js:480
    at mercadopago.js:444
    at n (mercadopago.js:248)
    at n (mercadopago.js:254)
    at Object.l.getPaymentMethod (mercadopago.js:275)
    at d (mercadopago.js:427)
    at mercadopago.js:479*

I gave one unminify and edited the file js, but the error persists. That one JS is the modified, already that is the original.

Observing

Even in the production mode the error still persists.

  • Hello, put the error log in the question, but not image.

  • Hello, I edited the question :)!

  • Hello, what is the Mercadopago API you are using? It appears that you are using their Web API but it should be their Android API: https://www.mercadopago.com.br/developers/pt/guides/payments/mobile-checkout/receive-payments/ https://www.mercadopago.com.br/developers/guides/payments/mobile-checkout/introduction/

1 answer

1

If the problem is really Voce SSL can use the Openssl to generate a root SSL

Generate an RSA-2048 key and store in the file rootCA.key, this file will be used to create the certificate

openssl genrsa -des3 -out rootCA.key 2048

You can use the key you generated to create a new certificate, save the file with the name rootCA.pem. this certificate will have a validity of 1024 days but can change to any number you want

openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.pem

terminal screen openSSL

Before using your new certification have to tell your Mac to trust your certificate

Open Keychain Access on your Mac and open the certificate category on the Keychain system, once there, import the file rootCA.pem. using File > Import Items, double click on the imported certificate and change the When using this Certificate dropdown to Always trust in trust category (trust)

Your certificate should look like this keyaccess root certificate

Your root certificate can now be used on localhost, create a new Openssl configuration file server.csr.cnf so you can import these settings when creating a sertified instead of in the terminal

    [req]
default_bits = 2048
prompt = no
default_md = sha256
distinguished_name = dn

[dn]
C=US
ST=RandomState
L=RandomCity
O=RandomOrganization
OU=RandomOrganizationUnit
[email protected]
CN = localhost

Create a file v3.ext to create a certificate X509 v3

    authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names

[alt_names]
DNS.1 = localhost

Create a certification key for localhost using settings stored in server.csr.cnf, this key will be stored in server key.

openssl req -new -sha256 -nodes -out server.csr -newkey rsa:2048 -keyout server.key -config <( cat server.csr.cnf )

A request to sign the certificate will be sent by Root SSL that we created later for localhost, the certificate output is located in the following file server.crt

openssl x509 -req -in server.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out server.crt -days 500 -sha256 -extfile v3.ext

root ssl

You are now ready to change the localhost protocol for http for https, move the server key. and server.crt at a location on your "server" for when to start it

In an express app written in Node.js, this is here as it should be, use this only on localhost not in production, filename: dev-server.js

var path = require('path')
var fs = require('fs')
var express = require('express')
var https = require('https')

var certOptions = {
  key: fs.readFileSync(path.resolve('build/cert/server.key')),
  cert: fs.readFileSync(path.resolve('build/cert/server.crt'))
}

var app = express()

var server = https.createServer(certOptions, app).listen(443)

Case my tutorial has not been very clear, this here source

Browser other questions tagged

You are not signed in. Login or sign up in order to post.