nyartech / hyperpay

A Flutter plugin to wrap HyperPay SDK for iOS and Android.
MIT License
15 stars 34 forks source link

Host Name #4

Closed ibrahim-atif closed 2 years ago

ibrahim-atif commented 2 years ago

Dear eng. I hope you are fine. I just have small question which is String_host Value what do mean with it as i assigned "https://test.oppwa.com/" To it but it is false as in the run in terminal it says sting-host value is 4 hex digits. So i need your help. Besy regards.

pr-Mais commented 2 years ago

Hello, please provide a code snippet explaining which value are you referring to.

I'm assuming you mean the server host, which indicates your own host, all requests will fail until you implement the required endpoints on your server and provide it on initialization as in the example.

Follow this guide from HyperPay to setup your server.

AbdrahumanFikry commented 2 years ago

I have the same issue , I am using "https://test.oppwa.com/" for test and get this Unhandled Exception: FormatException: Illegal IPv6 address, an IPv6 part can only contain a maximum of 4 hex digits (at character 1) @pr-Mais @ibraheem-nt @

pr-Mais commented 2 years ago

Have you implemented your own endpoints on your own server as shown clearly in this guide? The call to test.oppwa.com shouldn't be the host in your client app, it must happen server-to-server.

AbdrahumanFikry commented 2 years ago

String _host = 'test.oppwa.com';

Uri _checkoutEndpoint = Uri( scheme: 'https', host: _host, path: '', );

Uri _statusEndpoint = Uri( scheme: 'https', host: _host, path: '', );

/// Initialize HyperPay session Future initPaymentSession( BrandType brandType, double amount, ) async { CheckoutSettings _checkoutSettings = CheckoutSettings( brand: brandType, amount: amount, headers: { 'Authorization': 'Bearer $token' }, additionalParams: { 'merchantTransactionId': '#123456', }, ); hyperpay.initSession(checkoutSetting: _checkoutSettings); sessionCheckoutID = await hyperpay.getCheckoutID; }

When I did that I got this response "Empty Html tag " :

==> FormatException: Unexpected character (at character 1) ==> <html></html> ==> ^


Do you mean that the host name should be my own ? even on test Mode? @pr-Mais

pr-Mais commented 2 years ago

Yes even on test mode. You will need to set your backend either ways to accept both testing and production environments.

AbdrahumanFikry commented 2 years ago

Ok thanks a lot , Is this the reason why I get this response :

==> FormatException: Unexpected character (at character 1) ==> <html></html> ==> ^

@pr-Mais

pr-Mais commented 2 years ago

Most probably yes. It's not the response the plugin is expecting.

AbdrahumanFikry commented 2 years ago
String _host = 'karaj-payment.cc';

Uri _checkoutEndpoint = Uri(
  scheme: 'https',
  host: _host,
  path: '/shopper/redirect',
);

Uri _statusEndpoint = Uri(
  scheme: 'https',
  host: _host,
  path: '',
);

Is this Right ?


Now I am getting this error :

HandshakeException: Handshake error in client (OS Error: 
    CERTIFICATE_VERIFY_FAILED: certificate has expired(handshake.cc:393))

@pr-Mais

pr-Mais commented 2 years ago

It's recommended that you use Postman to verify that your server endpoint is working as intended first.