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.
Then, export your API key as an environment variable in your terminal
export PUSH_API_KEY="your api key here"
Finally, verify that your API key is set correctly by making a request to the keys/verify
endpoint.
curl --request POST \
--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 to register a user.
curl --request POST \
--url https://sandbox.pushcash.com/user \
--header 'Authorization: Bearer '$PUSH_API_KEY \
--header 'X-Idempotency-Key: 1234' \
--data '{
"name": {
"first": "Alfred",
"last": "Hitchcock"
},
"email": "alfred@imdb.com",
"address": {
"address_line_1": "1609 10th Ave",
"locality": "Bodega Bay",
"administrative_area": "CA",
"postal_code": "94923",
"country": "US"
},
"date_of_birth": "1899-08-13",
"government_id": {
"type": "passport",
"last4": "7349"
},
"phone_number": "(555) 681-3485",
"tag": "4c8e6b4f",
"identity_verified": true
}'
The response contains the ID for your registered user.
{"id": "user_lVpbPL0K1XIiHx0DxipRbD"}
Create Payment Intent
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
Enter Test Credentials
- In sandbox, use
5555 5555 5555 4444
for your card number. Provide any future date for the expiration and any valid 3-digit number for the CVV.
- To authenticate with your bank the username is
mxuser
and password is password
. Select “checking account” if prompted.
Simulate payment declines in sandbox using 5999 9919 6976 9266
for your card number.
Use 5999 9819 6976 9283
to simulate a decline after the user completes bank authentication.
Confirm Deposit
Click “Deposit” to confirm the payment and display the payment confirmation pane. You should see something like
Finally, click “Back to …” 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.