From an old page made in classic asp I am trying to create a payment option via billwerk. In there support they are given a cURL to use, but I have no idea how to use cURL in asp classic.
The cURL look like this:
--url 'https://checkout-api.reepay.com/v1/session/charge'
-u 'cHJpdl8wZTlkNTI0ZTMzMThiZGY4Mz:'
-H 'Accept: application/json'
-H 'Content-Type: application/json'
--data
'{
"configuration": "default",
"locale": "da_DK",
"settle": true,
"accept_url": "https://website.dk/accept.asp",
"cancel_url": "https://website.dk/decline.asp",
"agreement_filter": [
"1f2f47097e2ad78497eaed147b2112ba"
],
"order": {
"handle": "order_test_1726132897405",
"amount": 20000,
"currency": "DKK",
"customer_handle": "cust-0001"
}
}'
Can anybody point me in the right direction?
What I have done now is:
<%
Dim url, xmlhttp, username, password, requestBody
' URL for the request
url = "https://checkout-api.reepay.com/v1/session/charge"
' Prepare the data to send in the request body
requestBody = "{""configuration"": ""default"", " & _
"""locale"": ""da_DK"", " & _
"""accept_url"": ""https://genkende.dk/accept.asp"", " & _
"""cancel_url"": ""https://genkende.dk/decline.asp"", " & _
"""agreement_filter"": [""1f2f47097e2ad78497eaed147b2112ba""], " & _
"""order"": {""handle"": ""order-xxx"", " & _
"""amount"": 350, " & _
"""currency"": ""DKK"", " & _
"""ordertext"": ""Genkende kort"", " & _
"""customer_handle"": ""cust-0001""}}"
' Create an XMLHTTP object
Set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP.6.0")
' Open the HTTP request
xmlhttp.Open "POST", url, False, "cHJpdl8wZTlkNTI0ZTMzMThiZGY4MzM2NmZkNTg0OWIwMTg2ODo=", ""
' Set the request headers
xmlhttp.setRequestHeader "Accept", "application/json"
xmlhttp.setRequestHeader "Content-Type", "application/json"
' Send the request with the body
xmlhttp.Send requestBody
' Check the status code and response
If xmlhttp.Status = 200 Then
Response.Write "Response: " & xmlhttp.responseText
Else
Response.Write "Error: " & xmlhttp.Status & " - " & xmlhttp.statusText
End If
' Clean up
Set xmlhttp = Nothing
%>
But I get this error back:
Error: 403 – Forbidden
6