Re: Error message

elitenel
Helper

Error message

Hey guys can someone please assist me I am getting this error message that says "Method Not Allowed" I am using my Ubuntu Server


ubuntu@e-commerce-2-instance-20240718-0932:~/visa-api-server/certs$ curl -v --cert /home/ubuntu/visa-api-server/certs/your_certificate.crt --key /home/ubuntu/visa-api-server/certs/your_private_key.key --cacert /home/ubuntu/visa-api-server/certs/DigiCertGlobalRootCA.pem --url "https://sandbox.api.visa.com/visadirect/fundstransfer/v1/pushfundstransactions"
* Trying 198.241.195.228:443...
* TCP_NODELAY set
* Connected to sandbox.api.visa.com (198.241.195.228) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /home/ubuntu/visa-api-server/certs/DigiCertGlobalRootCA.pem
CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Request CERT (13):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Certificate (11):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS handshake, CERT verify (15):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: C=US; ST=California; L=Foster City; O=Visa International Service Association; CN=*.api.visa.com
* start date: May 3 00:00:00 2024 GMT
* expire date: May 2 23:59:59 2025 GMT
* subjectAltName: host "sandbox.api.visa.com" matched cert's "*.api.visa.com"
* issuer: C=US; O=DigiCert Inc; CN=DigiCert SHA2 Secure Server CA
* SSL certificate verify ok.
> GET /visadirect/fundstransfer/v1/pushfundstransactions HTTP/1.1
> Host: sandbox.api.visa.com
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 405
< Server: nginx
< Date: Tue, 11 Feb 2025 09:45:38 GMT
< Content-Type: application/json
< Content-Length: 107
< Connection: keep-alive
< X-SERVED-BY: -579f8d9b4x2
< X-CORRELATION-ID: 1739267138_000_1029117346_-579f8d9b4x2_VDP_WS
< X-ERROR-ORIGIN: 9100
< X-APP-STATUS: 405
<
* Connection #0 to host sandbox.api.visa.com left intact
{"responseStatus":{"status":405,"code":"9004","severity":"ERROR","message":"Method Not Allowed","info":""}}ubuntu@e-commerce-2-instance-20240718-0932:~/visa-api-server/certs$
ubuntu@e-commerce-2-instance-20240718-0932:~/visa-api-server/certs$ curl -v --cert /home/ubuntu/visa-api-server/certs/your_certificate.crt --key /home/ubuntu/visa-api-server/certs/your_private_key.key --cacert /home/ubuntu/visa-api-server/certs/DigiCertGlobalRootCA.pem --url "https://sandbox.api.visa.com/visadirect/fundstransfer/v1/pushfundstransactions"
* Trying 198.241.195.228:443...
* TCP_NODELAY set
* Connected to sandbox.api.visa.com (198.241.195.228) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /home/ubuntu/visa-api-server/certs/DigiCertGlobalRootCA.pem
CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Request CERT (13):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Certificate (11):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS handshake, CERT verify (15):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: C=US; ST=California; L=Foster City; O=Visa International Service Association; CN=*.api.visa.com
* start date: May 3 00:00:00 2024 GMT
* expire date: May 2 23:59:59 2025 GMT
* subjectAltName: host "sandbox.api.visa.com" matched cert's "*.api.visa.com"
* issuer: C=US; O=DigiCert Inc; CN=DigiCert SHA2 Secure Server CA
* SSL certificate verify ok.
> GET /visadirect/fundstransfer/v1/pushfundstransactions HTTP/1.1
> Host: sandbox.api.visa.com
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 405
< Server: nginx
< Date: Tue, 11 Feb 2025 09:47:38 GMT
< Content-Type: application/json
< Content-Length: 107
< Connection: keep-alive
< X-SERVED-BY: -579f8d9b4r6
< X-CORRELATION-ID: 1739267258_362_2139464703_-579f8d9b4r6_VDP_WS
< X-ERROR-ORIGIN: 9100
< X-APP-STATUS: 405
<
* Connection #0 to host sandbox.api.visa.com left intact
{"responseStatus":{"status":405,"code":"9004","severity":"ERROR","message":"Method Not Allowed","info":""}}u
2 REPLIES 2
jenn_kh
Community Moderator

Re: Error message

Hi elitenel, Thank you for reaching out! An agent will get back to you as soon. Until then, if any community member knows a solution, feel free to reply in this thread.

DianaVisaPM
Visa Developer Support Specialist

Re: Error message

Hey @elitenel,

 

The "Method Not Allowed" error (HTTP status code 405) indicates that the HTTP method used in your request is not allowed for the specified endpoint. In your case, it appears that you are using the GET method, which is not supported by the Visa Direct Push Funds Transactions API endpoint. The correct method for this endpoint is POST.

 

Here is how you can modify your cURL request to use the POST method:

1. Ensure you have the correct API endpoint.
2. Use the POST method instead of GET.
3. Include the necessary data in the request body as per the API documentation.

Below is an example of how to correctly format your cURL request using the POST method:

 

```sh
curl -v --cert /home/ubuntu/visa-api-server/certs/your_certificate.crt \
--key /home/ubuntu/visa-api-server/certs/your_private_key.key \
--cacert /home/ubuntu/visa-api-server/certs/DigiCertGlobalRootCA.pem \
--url "https://sandbox.api.visa.com/visadirect/fundstransfer/v1/pushfundstransactions" \
--header "Content-Type: application/json" \
--request POST \
--data '{
"acquirerCountryCode": "840",
"acquiringBin": "408999",
"amount": "124.05",
"businessApplicationId": "AA",
"cardAcceptor": {
"address": {
"country": "USA",
"county": "San Mateo",
"state": "CA",
"zipCode": "94404"
},
"idCode": "CA-IDCode-77765",
"name": "Visa Inc. USA-Foster City",
"terminalId": "TID-9999"
},
"localTransactionDateTime": "2020-04-20T22:46:51",
"merchantCategoryCode": "6012",
"recipientPrimaryAccountNumber": "4957030420210496",
"retrievalReferenceNumber": "330000550000",
"senderAccountNumber": "4653459515756154",
"senderName": "John Doe",
"senderReference": "",
"systemsTraceAuditNumber": "451001",
"transactionCurrencyCode": "USD",
"transactionIdentifier": "381228649430015"
}'
```

 

In this example:
- Replace `/home/ubuntu/visa-api-server/certs/your_certificate.crt` with the path to your certificate.
- Replace `/home/ubuntu/visa-api-server/certs/your_private_key.key` with the path to your private key.
- Replace `/home/ubuntu/visa-api-server/certs/DigiCertGlobalRootCA.pem` with the path to your CA certificate.
- Adjust the JSON data in the `--data` parameter to match your actual transaction details.

This should resolve the "Method Not Allowed" error by using the correct HTTP method and including the required data as specified by the Visa Direct Push Funds Transactions API documentation.




Thanks,

Diana



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.