-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74d1ea4
commit 29b11c3
Showing
7 changed files
with
83 additions
and
487 deletions.
There are no files selected for viewing
9 changes: 3 additions & 6 deletions
9
rest-api/javascript/transaction/client-create-transaction/.env.example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
# Base Url endpoint | ||
BASE_URL='https://api-sandbox.uphold.com' | ||
BASE_URL = 'https://api-sandbox.uphold.com' | ||
|
||
TOKEN ='' | ||
DESTINATION_EMAIL_ACCOUNT='' | ||
|
||
SOURCE_CARD_ID='' | ||
SOURCE_CARD_SECURITY_CODE='' | ||
ACCESS_TOKEN = '' | ||
DESTINATION_EMAIL_ACCOUNT = '[email protected]' |
2 changes: 2 additions & 0 deletions
2
rest-api/javascript/transaction/client-create-transaction/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.env | ||
node_modules/ |
38 changes: 29 additions & 9 deletions
38
rest-api/javascript/transaction/client-create-transaction/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,40 @@ | ||
# Client transaction | ||
# User-to-user transaction | ||
|
||
This sample project demonstrates how to perform a transaction between 2 different accounts. For further background, please refer to the [API documentation](https://uphold.com/en/developer/api/documentation) | ||
This sample project demonstrates how to perform a transaction from one Uphold user to another, | ||
with the latter identified by their email address. | ||
For further background, please refer to the [API documentation](https://uphold.com/en/developer/api/documentation). | ||
|
||
## Summary | ||
This example uses a previous created `Bearer Token` (please look at authentication examples) and moves funds between 2 different accounts. | ||
|
||
This sample project performs the following actions: | ||
- Executes a transaction + commit operation in a single request | ||
- List last transaction performed | ||
|
||
- Create and commit a transaction | ||
- Display the data about the transaction | ||
|
||
## Requirements | ||
- `node` v13.14.0 + | ||
|
||
- Node.js v13.14.0 or later | ||
- An account at <https://sandbox.uphold.com> with at least $1 USD of available funds | ||
- An access token from that account, to perform authenticated requests to the Uphold API | ||
(see the [authentication](../../authentication) examples for how to obtain one) | ||
|
||
## Setup | ||
- run `npm install` (or `yarn install`) | ||
- create a `.env` file based on the `.env.example` file, and populate it with the required data | ||
|
||
- Run `npm install` (or `yarn install`) | ||
- Create a `.env` file based on the `.env.example` file, and populate it with the required data. | ||
|
||
## Run | ||
- run `node index.js` | ||
|
||
Run `node index.js`. | ||
|
||
The code will locate a card with nonzero balance in the source account, and prepare a $1 USD transaction | ||
from that card to the account identified by the email in the `.env` file. | ||
|
||
The result will depend on the status of the destination email: | ||
|
||
- If it is already associated with an existing Sandbox account, the transaction will be completed immediately | ||
and the funds will become available in the recipient's account. | ||
- If no Sandbox account exists with that email, an "invite"-type transaction will be created, | ||
which will be executed when the associated account is created. | ||
This invite can be cancelled by the sender while the recipient hasn't registered | ||
(which is useful if you use a dummy email address for this). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.