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 thekeys/exchange endpoint.
The steps below use the sandbox host (
sandbox.pushcash.com). For production, make the same requests to api.pushcash.com.1. Create a user
Register the user you’ll transact on behalf of by calling create-user. Keep the returnedid 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-livedtoken. 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:
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
- Open
index.htmldirectly in your browser. You’ll need an internet connection so the SDK can load from the CDN. - Paste the
urlfrom the previous step into the Widget URL field and verify the card form appears. - Enter the approved sandbox test card
5555 5555 5555 4444. Use any future date for expiration and any 3-digit value for CVV. - Click Generate token. The page displays a
token— copy it for the next step.
3. Authorize the payment
Submit thetoken to authorize-payment with the payment details to process the transaction:
200 OK response confirms the payment was approved:
Next steps
- Build the production flow (including processing stored credentials, handling step-up authentication, support for withdrawals and refunds) with the Card Payments guide.