{"id":22096529,"url":"https://github.com/uphold/uphold-sdk-android","last_synced_at":"2025-07-24T22:32:12.838Z","repository":{"id":28256863,"uuid":"31766565","full_name":"uphold/uphold-sdk-android","owner":"uphold","description":"Uphold Android SDK","archived":false,"fork":false,"pushed_at":"2023-04-09T21:33:18.000Z","size":969,"stargazers_count":33,"open_issues_count":7,"forks_count":22,"subscribers_count":30,"default_branch":"master","last_synced_at":"2024-04-15T02:08:19.319Z","etag":null,"topics":["android","mobile","sdk","upload"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uphold.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-06T11:31:43.000Z","updated_at":"2023-02-25T04:04:22.000Z","dependencies_parsed_at":"2022-08-27T15:12:33.029Z","dependency_job_id":null,"html_url":"https://github.com/uphold/uphold-sdk-android","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uphold%2Fuphold-sdk-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uphold%2Fuphold-sdk-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uphold%2Fuphold-sdk-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uphold%2Fuphold-sdk-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uphold","download_url":"https://codeload.github.com/uphold/uphold-sdk-android/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227482485,"owners_count":17779968,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","mobile","sdk","upload"],"created_at":"2024-12-01T04:11:30.525Z","updated_at":"2024-12-01T04:11:31.491Z","avatar_url":"https://github.com/uphold.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Uphold SDK for Android [![Build Status](https://travis-ci.org/uphold/uphold-sdk-android.svg?branch=master)](https://travis-ci.org/uphold/uphold-sdk-android) [![Release](https://jitpack.io/v/uphold/uphold-sdk-android.svg)](https://jitpack.io/#uphold/uphold-sdk-android)\n\nUphold is a next generation platform that allows anyone to transfer and exchange value for free, instantly and securely.\n\nThe Uphold SDK for Android provides an easy way for developers to integrate Android applications with the [Uphold API](https://uphold.com/en/developer).\n\n## Requirements\n\n* Android Studio\n* Minimum Android SDK Version - 16 (4.1)\n\n## Installation\n\nUsing _gradle_:\n\n```\nrepositories {\n\t// Add the jitpack maven repository url.\n\tmaven {\n\t\turl \"https://jitpack.io\"\n\t}\n}\n\ndependencies {\n\t// Add the classifier `sandboxRelease`, i.e. `'com.github.uphold:uphold-sdk-android:0.16.0:sandboxRelease@aar'`, to use the sandbox environment.\n\tcompile ('com.github.uphold:uphold-sdk-android:0.16.0@aar') {\n\t    transitive = true\n\t}\n}\n```\n\n## Basic usage\n\nIn order to learn more about the Uphold API, please visit the [developer website](https://uphold.com/en/developer).\n\nTo use the SDK you must first register an Application and obtain a unique `client_id` and `client_secret` combination. We recommend your first app be [registered in the Sandbox environment](https://sandbox.uphold.com/dashboard/profile/applications/developer/new), so you can safely play around during development.\n\nFrom the application page in your account you can get the Client ID, Client Secret and configure the redirect URI and the desired Scopes.\n\n### Authenticate User\n\nBefore instantiating the Uphold client to start the OAuth authentication flow, you must first initialize it:\n\n```java\nUpholdClient.initialize(MainActivity.this);\n```\n\nNow we can start the authentication process by calling the `beginAuthorization` method:\n\n```java\nUpholdClient upholdClient = new UpholdClient();\nupholdClient.beginAuthorization(MainActivity.this, CLIENT_ID, scopes, state);\n```\n\nTo receive an intent for the callback URL it is necessary to register an intent filter for one of your Android activities in order for users to be redirected to your app after the authorization process:\n\n```xml\n\u003cintent-filter\u003e\n    \u003caction android:name=\"android.intent.action.VIEW\" /\u003e\n    \u003ccategory android:name=\"android.intent.category.DEFAULT\" /\u003e\n    \u003ccategory android:name=\"android.intent.category.BROWSABLE\" /\u003e\n    \u003cdata\n        android:pathPrefix=\"/connect/uphold\"\n        android:scheme=\"uphold-demo\" /\u003e\n\u003c/intent-filter\u003e\n```\n\nIn the Android activity with the intent filter override the `onNewIntent` method to receive the redirect code:\n\n```java\n@Override\nprotected void onNewIntent(final Intent intent) {\n\tif (intent == null || intent.getAction() == null || !intent.getAction().equals(\"android.intent.action.VIEW\")) {\n\t    return;\n\t}\n\n\tupholdClient.completeAuthorization(intent.getData(), CLIENT_ID, CLIENT_SECRET, \"authorization_code\", state).then(new PromiseAction\u003cAuthenticationResponse\u003e() {\n        @Override\n        public void call(AuthenticationResponse authenticationResponse) {\n            // Get the user bearer token from the authenticationResponse.\n        }\n    }).fail(new PromiseAction\u003cException\u003e() {\n        @Override\n        public void call(Exception e) {\n            // Handle the Error.\n        }\n    });\n}\n```\n\nTo get the current user information, just instantiate the Uphold client with the user bearer token:\n\n```java\nUpholdClient upholdClient = new UpholdClient(bearerToken);\nupholdClient.getUser().then(new PromiseAction\u003cUser\u003e() {\n    @Override\n    public void call(User user) {\n        // The user information is available at the user object.\n    }\n});\n```\n\n### Get user accounts\n\n```java\nUpholdClient upholdClient = new UpholdClient(bearerToken);\nupholdClient.getUser().getAccounts().then(new PromiseAction\u003cList\u003cAccount\u003e\u003e() {\n    @Override\n    public void call(List\u003cAccount\u003e accounts) {\n        // Do something with the list of accounts.\n    }\n});\n```\n\n### Get user cards with chaining\n\n```java\nUpholdClient upholdClient = new UpholdClient(bearerToken);\nupholdClient.getUser().then(new RepromiseFunction\u003cUser, List\u003cCard\u003e\u003e() {\n    @Override\n    public Promise\u003cList\u003cCard\u003e\u003e call(User user) {\n        // Do something with the user.\n        return user.getCards();\n    }\n}).then(new PromiseAction\u003cList\u003cCard\u003e\u003e() {\n    @Override\n    public void call(List\u003cCard\u003e cards) {\n        // Do something with the list of cards.\n    }\n}).fail(new PromiseAction\u003cException\u003e() {\n    @Override\n    public void call(Exception e) {\n        // Do something with the error.\n    }\n});\n```\n\n### Get user cards\n\n```java\nuser.getCards().then(new PromiseAction\u003cList\u003cCard\u003e\u003e() {\n    @Override\n    public void call(List\u003cCard\u003e cards) {\n        // Do something with the list of cards.\n    }\n});\n```\n\n### Create new card\n\n```java\n// You can create a simple card request with just the label and the currency.\nCardRequest cardRequest = new CardRequest(\"label\", \"USD\");\nuser.createCard(cardRequest);\n\n// Or a card request with the label, currency, position and whether it is starred or not.\nCardRequest cardRequest = new CardRequest(\"label\", \"USD\", new Settings(1, true));\nuser.createCard(cardRequest);\n```\n\nHandling the success and error flow:\n\n```java\nuser.createCard(cardRequest).then(new PromiseAction\u003cCard\u003e() {\n    @Override\n    public void call(Card card) {\n\t    // Do something with the card created.\n    }\n}).fail(new PromiseAction\u003cException\u003e() {\n    @Override\n    public void call(Exception e) {\n        // Handle the error.\n    }\n});\n```\n\n### Create new card address\n\n```java\n// In the address request you need to specify the network for the address.\nAddressRequest addressRequest = new AddressRequest(\"bitcoin\");\ncard.createAddress(addressRequest);\n```\n\nHandling the success and error flow:\n\n```java\ncard.createAddress(addressRequest).then(new PromiseAction\u003cAddress\u003e() {\n    @Override\n    public void call(Address address) {\n\t    // Do something with the address created.\n    }\n}).fail(new PromiseAction\u003cException\u003e() {\n    @Override\n    public void call(Exception e) {\n        // Handle the error.\n    }\n});\n```\n\n### Get ticker\n\n```java\n// Instantiate the client. In this case, we don't need an\n// AUTHORIZATION_TOKEN because the Ticker endpoint is public.\nUpholdClient upholdClient = new UpholdClient();\n\n// Get tickers.\nupholdClient.getTicker().then(new PromiseAction\u003cList\u003cRate\u003e\u003e() {\n    @Override\n    public void call(List\u003cRate\u003e rates) {\n        // Do something with the rates list.\n    }\n});\n```\n\nOr you could get a ticker for a specific currency:\n\n```java\n// Get tickers for BTC.\nupholdClient.getTickersByCurrency(\"BTC\").then(new PromiseAction\u003cList\u003cRate\u003e\u003e() {\n    @Override\n    public void call(List\u003cRate\u003e rates) {\n        // Do something with the rates list.\n    }\n});\n```\n\n### Create and commit a new transaction\n\n```java\nTransactionDenominationRequest transactionDenominationRequest = new TransactionDenominationRequest(\"1.0\", \"BTC\");\n\n// A transaction to a destination (card id, crypto address, email, phone number or username).\nTransactionTransferRequest transactionTransferRequest = new TransactionTransferRequest(transactionDenominationRequest, \"foo@bar.com\");\n\ncard.createTransaction(transactionTransferRequest).then(new PromiseAction\u003cTransaction\u003e() {\n    @Override\n    public void call(Transaction transaction) {\n        // Commit the transaction.\n        transaction.commit();\n    }\n});\n\n// A transaction to a destination (card id, crypto address, email, phone number or username) with reference.\nTransactionTransferRequest transactionTransferRequest = new TransactionTransferRequest(transactionDenominationRequest, \"foo@bar.com\", \"12345\");\n\ncard.createTransaction(transactionTransferRequest).then(new PromiseAction\u003cTransaction\u003e() {\n    @Override\n    public void call(Transaction transaction) {\n        // Commit the transaction.\n        transaction.commit();\n    }\n});\n\n// A deposit from an ACH or SEPA account.\nTransactionDepositRequest transactionDepositRequest = new TransactionDepositRequest(transactionDenominationRequest, \"accountId\");\n\ncard.createTransaction(transactionDepositRequest).then(new PromiseAction\u003cTransaction\u003e() {\n    @Override\n    public void call(Transaction transaction) {\n        // Commit the transaction.\n        transaction.commit();\n    }\n});\n\n// A deposit from a credit card.\nTransactionCardDepositRequest transactionCardDepositRequest = new TransactionCardDepositRequest(transactionDenominationRequest, \"creditCardId\", \"1234\");\n\ncard.createTransaction(transactionCardDepositRequest).then(new PromiseAction\u003cTransaction\u003e() {\n    @Override\n    public void call(Transaction transaction) {\n        // Commit the transaction.\n        transaction.commit();\n    }\n});\n```\n\nIf you want to commit the transaction on the creation process, call the `createTransaction` method with the second parameter set to `true`.\n\n```java\ncard.createTransaction(transactionRequest, true);\n```\n\n### Get all public transactions\n\n```java\n// Instantiate the client. In this case, we don't need an\n// AUTHORIZATION_TOKEN because the Ticker endpoint is public.\nUpholdClient upholdClient = new UpholdClient();\n\nPaginator\u003cTransaction\u003e paginator = upholdClient.getReserve().getTransactions();\n\n// Get the list of transactions.\npaginator.getElements().then(new PromiseAction\u003cList\u003cTransaction\u003e\u003e() {\n    @Override\n    public void call(List\u003cTransaction\u003e transactions) {\n        // Do something with the list of transactions.\n    }\n});\n\n// Get the next page of transactions.\npaginator.getNext().then(new PromiseAction\u003cList\u003cTransaction\u003e\u003e() {\n    @Override\n    public void call(List\u003cTransaction\u003e transactions) {\n        // Do something with the list of transactions.\n    }\n});\n```\n\nOr you could get a specific public transaction:\n\n```java\n// Get one public transaction.\nupholdClient.getReserve().getTransactionById(\"a97bb994-6e24-4a89-b653-e0a6d0bcf634\").then(new PromiseAction\u003cTransaction\u003e() {\n    @Override\n    public void call(Transaction transaction) {\n        // Do something with the transaction.\n    }\n});\n```\n\n### Get reserve status\n\n```java\n// Instantiate the client. In this case, we don't need an\n// AUTHORIZATION_TOKEN because the Ticker endpoint is public.\nUpholdClient upholdClient = new UpholdClient();\n\n// Get the reserve summary of all the obligations and assets within it.\nupholdClient.getReserve().getStatistics().then(new PromiseAction\u003cList\u003cReserveStatistics\u003e\u003e() {\n    @Override\n    public void call(List\u003cReserveStatistics\u003e reserveStatisticses) {\n        // Do something with the reserve statistics.\n    }\n});\n```\n\n### Pagination\n\nSome endpoints will return a paginator. Here are some examples on how to handle it:\n\n```java\n// Get public transactions paginator.\nPaginator\u003cTransaction\u003e paginator = upholdClient.getReserve().getTransactions();\n\n// Get the first page of transactions.\npaginator.getElements().then(new PromiseAction\u003cList\u003cTransaction\u003e\u003e() {\n    @Override\n    public void call(List\u003cTransaction\u003e transactions) {\n\t    // Do something with the list of transactions.\n    }\n});\n\n// Check if the paginator has a valid next page.\npaginator.hasNext().then(new PromiseAction\u003cBoolean\u003e() {\n    @Override\n    public void call(Boolean hasNext) {\n\t\t// Do something with the hasNext.\n    }\n});\n\n// Get the number of paginator elements.\npaginator.count().then(new PromiseAction\u003cInteger\u003e() {\n    @Override\n    public void call(Integer count) {\n        // Do something with the count.\n    }\n});\n\n// Get the next page.\npaginator.getNext().then(new PromiseAction\u003cList\u003cTransaction\u003e\u003e() {\n    @Override\n    public void call(List\u003cTransaction\u003e transactions) {\n        // Do something with the list of transactions.\n    }\n});\n\n```\n\n## Uphold SDK sample\n\nCheck the sample application to explore a application using the Uphold Android SDK.\n\n#### Building\n\nTo build the sample application you need the [Android Studio](http://developer.android.com/sdk/installing/studio.html). Steps to build:\n\n1. Clone the repository.\n2. Open Android Studio.\n3. Click 'Import project...'.\n4. Open the `sample/Uphold-android-sdk-demo` directory in the cloned repository.\n5. Build and run the app from inside Android Studio.\n\nThe sample application is configured to use the [sandbox environment](https://sandbox.uphold.com), make sure you use a sandbox account to perform the login.\n\n## Contributing \u0026 Development\n\n#### Contributing\n\nHave you found a bug or want to suggest something? Please search the [issues](https://github.com/uphold/uphold-sdk-android/issues) first and, if it is new, go ahead and [submit it](https://github.com/uphold/uphold-sdk-android/issues/new).\n\n#### Develop\n\nIt will be awesome if you can help us evolve `uphold-sdk-android`. Want to help?\n\n1. [Fork it](https://github.com/uphold/uphold-sdk-android).\n2. Hack away.\n3. Run the tests.\n5. Create a [Pull Request](https://github.com/uphold/uphold-sdk-android/compare).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuphold%2Fuphold-sdk-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuphold%2Fuphold-sdk-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuphold%2Fuphold-sdk-android/lists"}