Overview

Time to complete: < 10 minutes

This guide walks you through the basic steps to create an API key and process a simulated payment using Push. To learn how to build a complete integration, head over to the Integration Guide.

1. Create an API key

In order to securely access the API, you must first exchange a temporary code for a durable API key. You can request your temporary code in the dedicated slack channel setup for your organization or by reaching out to hello@pushcash.com.

Once you have received your code, exchange it for an API key by making a request to the keys/exchange endpoint.

$ curl --request POST \
	--url https://sandbox.pushcash.com/keys/exchange \
	--data '{"code": "TEMPORARY_CODE"}'

The response should contain your API key which you can use to authenticate your requests to the Push API.

Your API key is: ...

Then, export your API key as an environment variable in your terminal

Finally, verify that your API key is set correctly by making a request to the keys/verify endpoint.

curl --request GET \
	--url https://sandbox.pushcash.com/keys/verify \
 	--header 'Authorization: Bearer '$PUSH_API_KEY

The API will respond with a status code of 200 (OK) and the name of your organization

2. Process a payment

In order to process a payment, you need a registered user. In sandbox, a user has already been registered for you - hit the API using the user/list endpoint and grab their id which should look like user_lVpbPL0K1XIiHx0DxipRbD.

curl --request GET \
	--url https://sandbox.pushcash.com/user/list \
 	--header 'Authorization: Bearer '$PUSH_API_KEY \
	| sed -n 's/.*"id":"\([^"]*\)".*/\1/p'

Now you can submit a request to create a payment intent, replacing “Your user ID” with the id from the previous step.

curl --request POST
	--url https://sandbox.pushcash.com/intent \
 	--header 'Authorization: Bearer '$PUSH_API_KEY \
	--data '{
		"user_id": "Your user ID",
		"amount": 1500,
		"direction": "cash_in",
		"currency": "USD",
		"redirect_url": "https://docs.pushcash.com/quickstart#redirect"
	}' | sed -n 's/.*"url":"\([^"]*\)".*/\1/p' | xargs open

Running the command will open the URL for the payment session in your browser. You should see something like

Click “Authorize Deposit” to confirm the payment and display the payment confirmation pane, then click “Continue” to return here.

Congratulations on completing the quickstart 🎉    To learn how to build a complete integration to the Push platform, head over to the Integration Guide.