VivaPayments / API

Index of Viva Wallet open source projects on GitHub.
139 stars 162 forks source link

Error Bad request #2432

Closed pascalradelet closed 1 year ago

pascalradelet commented 1 year ago

I repost the code with complete authentification var HTTPClient: TIdHTTP; RequestHeaders: TStringList; RequestParams: TStringList; ResponseContent: string; AuthHeaderValue: string; response: TCustomRESTResponse; SSL: TIdSSLIOHandlerSocketOpenSSL; begin HTTPClient := TIdHTTP.Create(nil); try AuthHeaderValue := TNetEncoding.Base64.Encode('4paytji40509gjvxv7ch51lhv57cn2bwpek2a9t2fl752.apps.vivapayments.com:6p20YtWe07Ts1oWVFZ8H2Mu50t9Q8E'); SSL := TIdSSLIOHandlerSocketOpenSSL.Create(HTTPclient); SSL.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2]; HTTPClient.IOHandler := SSL; HTTPclient.Request.BasicAuthentication := true; httpclient.Request.CustomHeaders.Values['Content-Type'] := 'application/x-www-form-urlencoded'; httpclient.Request.CustomHeaders.Values['Authorization']:='Basic ' + AuthHeaderValue; httpclient.Request.Contenttype := 'application/x-www-form-urlencoded'; RequestParams := TStringList.Create; RequestParams.Add('grant_type=client_credentials');

try
  ResponseContent := HTTPClient.Post('https://demo-accounts.vivapayments.com/connect/token', RequestParams);
  // Handle the response content as needed...
except
  // Handle exceptions...
end;

RequestParams.Free;
RequestHeaders.Free;

finally HTTPClient.Free; end;

This code is the exact conversion in Pascal from the curl code from your documentation

"curl -L -X POST 'https://demo-accounts.vivapayments.com/connect/token' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -H 'Authorization: Basic ZzI0N2NmbnlwYzV3cmszaHAwZnU2cTk3N2YzZzYxY2hnODV1NzJzZmJkb3c3LmFwcHMudml2YXBheW1lbnRzLmNvbTowYk9xOHRkMzhMQVF4b3ptaWVqUDYwUzdzQnJkVkQ=' \ --data-urlencode 'grant_type=client_credentials' "

But i have always an error : 'Bad request' I don't undestand Why

Thanks

VivaWalletCustomerSupport commented 1 year ago

Hello @pascalradelet,

Thank you for your message. Can you please edit the following parameter and try again?

httpclient.Request.CustomHeaders.Values['Authorization']:='Basic + AuthHeaderValue';

Kind regards, Viva Wallet E-commerce Support Team

pascalradelet commented 1 year ago

value : 'NHBheXRqaTQwNTA5Z2p2eHY3Y2g1MWxodjU3Y24yYndwZWsyYTl0MmZsNzUyLmFwcHMudml2YXBh'#$D#$A'eW1lbnRzLmNvbTo2cDIwWXRXZTA3VHMxb1dWRlo4SDJNdTUwdDlROEU='

King regards

------ Message d'origine ------ De "VivaWalletCustomerSupport" @.**@.>> À "VivaPayments/API" @.**@.>> Cc "Pascal Radelet" @.**@.>>; "Mention" @.**@.>> Date 14-08-23 16:25:25 Objet Re: [VivaPayments/API] Error Bad request (Issue #2432)

Hello @pascalradelethttps://github.com/pascalradelet,

Thank you for your message. Can you please edit the following parameter and try again?

httpclient.Request.CustomHeaders.Values['Authorization']:='Basic + AuthHeaderValue';

Kind regards, Viva Wallet E-commerce Support Team

— Reply to this email directly, view it on GitHubhttps://github.com/VivaPayments/API/issues/2432#issuecomment-1677421657, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BB2BOZJIOFTG7KDASVYKFWLXVIYNLANCNFSM6AAAAAA3PMFMTA. You are receiving this because you were mentioned.Message ID: @.***>

VivaWalletCustomerSupport commented 1 year ago

Hello @pascalradelet,

Thank you for the swift response. We kindly suggest replacing the following parameter httpclient.Request.CustomHeaders.Values['Authorization']:='Basic ' + AuthHeaderValue; with httpclient.Request.CustomHeaders.Values['Authorization']:='Basic + AuthHeaderValue';.

Kind regards, Viva Wallet E-commerce Support Team

pascalradelet commented 1 year ago

Hello

Same error

I test with postman and i have the same error @.***

King regards

------ Message d'origine ------ De "VivaWalletCustomerSupport" @.**@.>> À "VivaPayments/API" @.**@.>> Cc "Pascal Radelet" @.**@.>>; "Mention" @.**@.>> Date 15-08-23 15:49:30 Objet Re: [VivaPayments/API] Error Bad request (Issue #2432)

Hello @pascalradelethttps://github.com/pascalradelet,

Thank you for the swift response. We kindly suggest replacing the following parameter httpclient.Request.CustomHeaders.Values['Authorization']:='Basic ' + AuthHeaderValue; with httpclient.Request.CustomHeaders.Values['Authorization']:='Basic + AuthHeaderValue';.

Kind regards, Viva Wallet E-commerce Support Team

— Reply to this email directly, view it on GitHubhttps://github.com/VivaPayments/API/issues/2432#issuecomment-1678964183, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BB2BOZKTMHRHWL2VESSW7WLXVN46VANCNFSM6AAAAAA3PMFMTA. You are receiving this because you were mentioned.Message ID: @.***>

VivaWalletCustomerSupport commented 1 year ago

Hello @pascalradelet,

Thank you for the response. We would like to advise you to use our sample code and generate an access token. If our sample code is functional, we kindly suggest checking your implementation for errors.

Kind regards, Viva Wallet E-commerce Support Team

pascalradelet commented 1 year ago

Hello

Ok But what is your simple code

Thanks

------ Message d'origine ------ De "VivaWalletCustomerSupport" @.**@.>> À "VivaPayments/API" @.**@.>> Cc "Pascal Radelet" @.**@.>>; "Mention" @.**@.>> Date 16-08-23 16:13:55 Objet Re: [VivaPayments/API] Error Bad request (Issue #2432)

Hello @pascalradelethttps://github.com/pascalradelet,

Thank you for the response. We would like to advise you to use our sample code and generate an access token. If our sample code is functional, we kindly suggest checking your implementation for errors.

Kind regards, Viva Wallet E-commerce Support Team

— Reply to this email directly, view it on GitHubhttps://github.com/VivaPayments/API/issues/2432#issuecomment-1680698517, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BB2BOZMPVCK4HPXXYV5EBFLXVTISHANCNFSM6AAAAAA3PMFMTA. You are receiving this because you were mentioned.Message ID: @.***>

VivaWalletCustomerSupport commented 1 year ago

Hello @pascalradelet,

Thank you for the reply. The sample code can be found in the link below:

https://developer.vivawallet.com/integration-reference/oauth2-authentication/

Kind regards, Viva Wallet E-commerce Support Team

pascalradelet commented 1 year ago

OK

But why it doesn't work with POSTMAN

------ Message d'origine ------ De "VivaWalletCustomerSupport" @.**@.>> À "VivaPayments/API" @.**@.>> Cc "Pascal Radelet" @.**@.>>; "Mention" @.**@.>> Date 17-08-23 16:03:39 Objet Re: [VivaPayments/API] Error Bad request (Issue #2432)

Hello @pascalradelethttps://github.com/pascalradelet,

Thank you for the reply. The sample code can be found in the link below:

https://developer.vivawallet.com/integration-reference/oauth2-authentication/

Kind regards, Viva Wallet E-commerce Support Team

— Reply to this email directly, view it on GitHubhttps://github.com/VivaPayments/API/issues/2432#issuecomment-1682347107, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BB2BOZM2OYAJQB4KVVEZ4L3XVYQDXANCNFSM6AAAAAA3PMFMTA. You are receiving this because you were mentioned.Message ID: @.***>

VivaWalletCustomerSupport commented 1 year ago

Hello @pascalradelet,

Thank you for the swift response. Our sample code works as expected on POSTMAN. Can you please share with us a screenshot of our sample code from POSTMAN and the response you are getting? Thank you in advance.

Kind regards, Viva Wallet E-commerce Support Team

pascalradelet commented 1 year ago

I test with postman and i have the same error @.***

------ Message d'origine ------ De "VivaWalletCustomerSupport" @.**@.>> À "VivaPayments/API" @.**@.>> Cc "Pascal Radelet" @.**@.>>; "Mention" @.**@.>> Date 18-08-23 15:13:24 Objet Re: [VivaPayments/API] Error Bad request (Issue #2432)

Hello @pascalradelethttps://github.com/pascalradelet,

Thank you for the swift response. Our sample code works as expected on POSTMAN. Can you please share with us a screenshot of our sample code from POSTMAN and the response you are getting? Thank you in advance.

Kind regards, Viva Wallet E-commerce Support Team

— Reply to this email directly, view it on GitHubhttps://github.com/VivaPayments/API/issues/2432#issuecomment-1683902977, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BB2BOZNSKNQKOVTWJIZNC2DXV5S7JANCNFSM6AAAAAA3PMFMTA. You are receiving this because you were mentioned.Message ID: @.***>

VivaWalletCustomerSupport commented 1 year ago

Hello @pascalradelet,

Thank you for the reply. Can you please share with us screenshots of your code and the response you are getting via POSTMAN? Thank you in advance.

Kind regards, Viva Wallet E-commerce Support Team

pascalradelet commented 1 year ago

Hello

Captune joined

------ Message d'origine ------ De "VivaWalletCustomerSupport" @.**@.>> À "VivaPayments/API" @.**@.>> Cc "Pascal Radelet" @.**@.>>; "Mention" @.**@.>> Date 21-08-23 10:15:13 Objet Re: [VivaPayments/API] Error Bad request (Issue #2432)

Hello @pascalradelethttps://github.com/pascalradelet,

Thank you for the reply. Can you please share with us screenshots of your code and the response you are getting via POSTMAN? Thank you in advance.

Kind regards, Viva Wallet E-commerce Support Team

— Reply to this email directly, view it on GitHubhttps://github.com/VivaPayments/API/issues/2432#issuecomment-1685865398, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BB2BOZMTTEPZHSD5C3WQNCDXWMKJDANCNFSM6AAAAAA3PMFMTA. You are receiving this because you were mentioned.Message ID: @.***>

VivaWalletCustomerSupport commented 1 year ago

Hello @pascalradelet,

Thank you for the reply. We cannot locate the screenshot on your previous message. If you are not able to send the screenshot here, you can e-mail the screenshots via e-mail to support@vivawallet.com or contact us via live chat.

Kind regards, Viva Wallet E-commerce Support Team

pascalradelet commented 1 year ago

@.**@.

------ Message d'origine ------ De "VivaWalletCustomerSupport" @.**@.>> À "VivaPayments/API" @.**@.>> Cc "Pascal Radelet" @.**@.>>; "Mention" @.**@.>> Date 21-08-23 14:52:23 Objet Re: [VivaPayments/API] Error Bad request (Issue #2432)

Hello @pascalradelethttps://github.com/pascalradelet,

Thank you for the reply. We cannot locate the screenshot on your previous message. If you are not able to send the screenshot here, you can e-mail the screenshots via e-mail to @.**@.> or contact us via live chat.

Kind regards, Viva Wallet E-commerce Support Team

— Reply to this email directly, view it on GitHubhttps://github.com/VivaPayments/API/issues/2432#issuecomment-1686271670, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BB2BOZJTR3TNYRXCHH4EQ23XWNKYPANCNFSM6AAAAAA3PMFMTA. You are receiving this because you were mentioned.Message ID: @.***>

VivaWalletCustomerSupport commented 1 year ago

Hello @pascalradelet,

Thank you for your response. We would like to inform you that when you answer via e-mail and you attach a screenshot, we are not able to see it on the channel. We kindly advise you to contact us via live chat or e-mail to support@vivawallet.com.

Kind regards, Viva Wallet E-commerce Support Team

VivaWalletCustomerSupport commented 1 year ago

Hello @pascalradelet,

We just wanted to follow up on the reply we sent. We were simply wondering if you read our response.

In any case this ticket will remain active for at least 24 hours, so that you can come back if you wish.

However, if you have any questions, please don't hesitate to reply here and we'd be happy to help!

Kind regards, Viva Wallet E-commerce Support Team

pascalradelet commented 1 year ago

Hello

I just want to send to you the capture

------ Message d'origine ------ De "VivaWalletCustomerSupport" @.**@.>> À "VivaPayments/API" @.**@.>> Cc "Pascal Radelet" @.**@.>>; "Mention" @.**@.>> Date 24-08-23 10:06:04 Objet Re: [VivaPayments/API] Error Bad request (Issue #2432)

Hello @pascalradelethttps://github.com/pascalradelet,

We just wanted to follow up on the reply we sent. We were simply wondering if you read our response.

In any case this ticket will remain active for at least 24 hours, so that you can come back if you wish.

However, if you have any questions, please don't hesitate to reply here and we'd be happy to help!

Kind regards, Viva Wallet E-commerce Support Team

— Reply to this email directly, view it on GitHubhttps://github.com/VivaPayments/API/issues/2432#issuecomment-1691207689, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BB2BOZI6U4S5XQTHOKMMXELXW4DOZANCNFSM6AAAAAA3PMFMTA. You are receiving this because you were mentioned.Message ID: @.***>

VivaWalletCustomerSupport commented 1 year ago

Hello @pascalradelet,

Thank you for your message. Please contact us directly via live chat or e-mail at support@vivawallet.com.

Kind regards, Viva Wallet E-commerce Support Team

VivaWalletCustomerSupport commented 1 year ago

Hello @pascalradelet,

We just wanted to follow up on the reply we sent. We were simply wondering if you read our response.

In any case this ticket will remain active for at least 24 hours, so that you can come back if you wish.

However, if you have any questions, please don't hesitate to reply here and we'd be happy to help!

Kind regards, Viva Wallet E-commerce Support Team

VivaWalletCustomerSupport commented 1 year ago

Hello @pascalradelet,

This ticket will close for now. Please don't hesitate to raise a new ticket if you need further assistance.

Kind regards, Viva Wallet E-commerce Support Team