# Establishing connectivity

Once you have exchanged keys with Google and have your vendor ID (PIAID), you
are ready to establish connectivity with the Virtual Cards API is to
and complete a successful echo test. We provide
[code samples](https://developers.google.com/pay/virtual-cards-v1/guides/connectivity/establish-connectivity#echo_request_code_samples) to help you perform these tests
using the encryptions keys we exchange to ensure your configuration is correct
and that your infrastructure is properly routing our requests to your host.
Once you have successfully completed `echo` tests using one of our code
samples, you can update your implementation to communicate with our APIs.

### Echo from Partner to Google

Google hosts an `echo` endpoint
which you can call to test your ability to successfully communicate with our
servers. You should use the encryption keys you exchanged with Google when
forming your `echo` request and parsing our response.

> [!NOTE]
> **Note:** Google's `echo` endpoint returns a 404 error if there was an encryption error. You may want to first test `echo` with our [code samples](https://developers.google.com/pay/virtual-cards-v1/guides/connectivity/establish-connectivity#echo_request_code_samples) before testing your own implementation.

#### Using our code samples to echo Google

Once you have one of our [code samples](https://developers.google.com/pay/virtual-cards-v1/guides/connectivity/establish-connectivity#echo_request_code_samples) configured
and running, you can trigger an `echo` request to Google by using `curl` or a
similar tool as follows:

    curl -H "Content-type: text/plain" -X POST -d 'hello' https://{YOUR_HOST}/echo

If your keys are properly set up, you should see a successful echo response.

## Echo request code samples

Debugging errors during initial development to establish connectivity can be
difficult since our API returns 404s for requests with PGP encryption errors.
And, all responses are encrypted and sent as an octet-stream, which can further
complicate initial connectivity work.

There are a number of resources to help you get started:

- [Java implementation](https://github.com/google-pay/gsp-pgp-java) for encryption and decryption
- Sample code showing how to successfully perform bidirectional `echo` tests
- Codelabs that walk through our code samples

### Code sample downloads

The following code samples are fully working examples that can call the Google
hosted `echo` API. Note that the samples also include code for hosting your
own echo endpoint. The Virtual Cards API does not need that
capability so you should focus your attention on the `echo` request to Google's
endpoint.

[Java](https://developers.google.com/static/standard-payments/downloads/bidirectional-echo-sample-java.zip)
[Node.js](https://developers.google.com/static/standard-payments/downloads/bidirectional-echo-sample-nodejs.zip)

### Codelab walkthroughs

The following codelabs walk through our Java and Node.js sample implementations
to help you quickly come up to speed with how they work and the key
configuration settings you need to adjust to get them working.

[Java](https://developers.google.com/standard-payments/codelabs/java-connectivity-codelab)
[Node.js](https://developers.google.com/standard-payments/codelabs/nodejs-connectivity-codelab)