|
| Iniciado por guest, 29,ago. 2017 18:52 - 3 respuestas |
| |
| | | |
|
| |
| Publicado el 29,agosto 2017 - 18:52 |
Has anyone used cURL in webdev? I'm trying to make requests by using restRequest and restResponse variables, but without success, the server is responding but it always says that my keys are wrong, which aren't, here is my code: cMyRequest is restRequest cMyRequest..URL = "https://sandbox-api.openpay.mx/v1/{merchant_ID}/charges" cMyRequest..Content = "-u {private_key}" cMyRequest..ContentType = typeMimeJSON cMyRequest..Method = httpPost cMyResponse is restResponse = RESTSend(cMyRequest) IF ErrorOccurred THEN Error(ErrorInfo(errFullDetails)) ELSE Info(cMyResponse..Content) END
The documentation for cURL is as follows: Authentication example curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/charges \ -u sk_e568c42a6c384b7ab02cd47d2e407cab: |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,agosto 2017 - 19:02 |
Hi Luis,
AFAIK, this part: cMyRequest..URL = "{merchant_ID}/charges"
is NOT a valid URL part
So either you need to replace it with something, or it need to be part of the post string
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,agosto 2017 - 19:04 |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,agosto 2017 - 19:25 |
Solved it! Still needs more coding, but could get past the error I was getting thanks to Uncle Pete (Pete Halsted) Here is my code:
vCharge is Variant vCharge.method = "card" vCharge.amount = 100 vCharge.description = "Cargo de prueba" sCharge is string = VariantToJSON(vCharge)
cMyRequest is restRequest cMyRequest..URL = "https://sandbox-api.openpay.mx/v1/***********/charges" //* is the Merchant_ID cMyRequest..User = "*******************" //Private API key cMyRequest..ContentType = typeMimeJSON cMyRequest..Method = httpPost cMyRequest..Content = sCharge cMyResponse is restResponse = RESTSend(cMyRequest) IF ErrorOccurred THEN Error(ErrorInfo(errFullDetails)) ELSE Info(cMyResponse..Content) END |
| |
| |
| | | |
|
| | | | |
| | |
|