Skip to main content

Overview

Time to complete: < 10 minutes This guide walks you through your first sandbox payment end to end: create an API key, register a user, render the Push Widget, tokenize a test card, and authorize the payment.

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.
The steps below use the sandbox host (sandbox.pushcash.com). For production, make the same requests to api.pushcash.com.
The response should contain your API key which you can use to authenticate your requests to the Push API.
Save the key to an environment variable so the requests below can reuse it:

1. Create a user

Register the user you’ll transact on behalf of by calling create-user. Keep the returned id for use in the next step.

2. Render the widget and generate a token

The Push Widget renders a secure card form and exchanges the card details for a short-lived token. Because the widget runs in the browser, you’ll host it in a minimal webpage. First generate a widget URL for the user, then load that URL into a local page. Generate a widget URL by calling create-user-url with the user’s id (from step 1) and the payment direction:
Next, create a folder with the two files below. index.html loads the Push JS SDK and provides a field to paste the widget URL into; app.js renders the widget and tokenizes the card.
index.html
app.js
Then:
  1. Open index.html directly in your browser. You’ll need an internet connection so the SDK can load from the CDN.
  2. Paste the url from the previous step into the Widget URL field and verify the card form appears.
  3. Enter the approved sandbox test card 5555 5555 5555 4444. Use any future date for expiration and any 3-digit value for CVV.
  4. Click Generate token. The page displays a token — copy it for the next step.

3. Authorize the payment

Submit the token to authorize-payment with the payment details to process the transaction:
A 200 OK response confirms the payment was approved:
Congratulations, you’ve processed your first payment 🎉

Next steps

  • Build the production flow (including processing stored credentials, handling step-up authentication, support for withdrawals and refunds) with the Card Payments guide.