GithubHelp home page GithubHelp logo

android-sdk's Introduction

GitHub license Maven Central

BitPay Android SDK

This SDK allows your application to quickly create an invoice, show the user an option to pay you, and track the status of the payment. Accept bitcoins in your app with 10 lines of code!

Quick Start Guide

To get up and running with our Android SDK quickly, see the GUIDE here: https://github.com/bitpay/android-sdk/blob/master/GUIDE.md

More Samples and Documentation

Sample Project

Take a look at this project where an integration with a mock application is shown.

BitPay's API docs

To read more about invoices refer to the BitPay's API documentation

Troubleshooting

Contact support via our official helpdesk or ask the community.

License

Code released under the MIT license.

android-sdk's People

Contributors

braydonf avatar eordano avatar ionux avatar jameswalpole avatar kleetus avatar martindale avatar nachowski avatar philosodad avatar sebaslogen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-sdk's Issues

InvoiceActivity class using reflections to get resources class

first its bad idea and you doing it wrong way :)

why u not using provided context which starts activity to obtain resources class name ?

why not use ? context.getApplicationContext() and use in

public static int getResIdByName(Context context, String name, String type) {
    return context.getResources().getIdentifier(name, type, context.getPackageName());
}

you should address also some other issues:

  1. multidex / used classloader could not be aware of multiple dex files

if you need use reflection try:

  // use space name not android application id  :) - see my last words 
  Class<?>  aClass = classLoader.loadClass(javaPackageName +".R$id");  
  1. differences between package/applicationId and java package for class name R as

    getPackageName()

returns the flavor-specific "package" (applicationId) instead of what you defined in the app's manifest (package field).- be aware of that that

now my app can't use your api as packageName.R doesn't exist in my app :)

you have two choices to correct this:

  1. iterate over all classes until you find expected resource or
  2. get proper package name / space name

Unrecognized field "bitcoinAddress"

Hi,
We are facing the issue using bitpay android sdk from some days ... was working fine some days before , Please resolve this issue ,,, See log cat error

W/System.err: com.bitpay.sdk.controller.BitPayException: Error - failed to deserialize BitPay server response (Invoice) : Unrecognized field "bitcoinAddress" (class com.bitpay.sdk.model.Invoice), not marked as ignorable (31 known properties: "itemDesc", "notificationURL", "guid", "price", "transactionSpeed", "orderId", "paymentUrls", "refundAddresses", "buyerFields", "currency", "transactions", "physical", "fullNotifications" [truncated]])
W/System.err: at [Source: {"facade":"pos/invoice","data":{"url":"https://bitpay.com/invoice?id=xxxxxxxxx","status":"new","btcPrice":"0.024368","btcDue":"0.024368","price":10,"currency":"USD","exRates":{"USD":410.38000000000005},"invoiceTime":1457440854722,"expirationTime":1457441754722,"currentTime":1457440854786,"guid":"96002893","id":xxxxxxxxxxx","btcPaid":"0.000000","rate":410.38,"exceptionStatus":false,"paymentUrls":{"BIP21":"bitcoin:xxxxxxxxxx?amount=0.024368","BIP72":"bitcoin:xxxxxxxxxx?amount=0.024368&r=https://bitpay.com/i/xxxxxxxxxxxxx","BIP72b":"bitcoin:?r=https://bitpay.com/i/xxxxxxxxxS","BIP73":"https://bitpay.com/i/xxxxxxxx"},"bitcoinAddress":"xxxxxxxxxxxxx","token":"xxxxxxxxxxxxxxxxxxxxxxx"}}; line: 1, column: 748](through reference chain: com.bitpay.sdk.controller.InvoiceWrapper["data"]->com.bitpay.sdk.model.Invoice["bitcoinAddress"])
at com.bitpay.sdk.controller.BitPay.createInvoice(BitPay.java:199)
at com.bitpay.sdk.android.BitPayAndroid$CreateInvoiceTask.doInBackground(BitPayAndroid.java:395)
at com.bitpay.sdk.android.BitPayAndroid$CreateInvoiceTask.doInBackground(BitPayAndroid.java:383)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:831)

Looking forward for your response

api level 23 removal of legacy http classes

Error:(15, 23) error: cannot find symbol class HttpEntity
Error:(16, 23) error: cannot find symbol class HttpResponse
Error:(17, 23) error: cannot find symbol class ParseException

As a dependency of Android itself, org.apache.http.legacy removed the above classes. We should convert to using newer options.

compiling

Error:Execution failed for task ':xxx:dexBitcoinDebugServer'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2

Seems the maven pull isn't working at all - adding the whole project as a module, or just the aar file gives me this error on compile.

typo in readme

hi,
readme instructs to include compile 'com.bitpay:sdk-android:1.0.0@aar'
but the .aar file is named android-sdk
pls fix to avoid future possible loss of time
thanks,

UI Changes requirement as like (Web)

Hi,

I would like to see the Point of Sale Vendor details in Android InvoiceActivity on the invoice like it shows on the web , How can i use add this ?

Looking forward to hear from you soon

Best Regards
Munib Shaukat

INSTALL_FAILED_CPU_ABI_INCOMPATIBLE

On attempt to install to Dell Venue 7 3730 (Android 4.4.2, API 19). Same problem also exists with sample project cited in readme. Sample project has several unresolved comments on open issue for this same problem (bitpay/android-sdk-sample#1). Project builds and runs under emulation, just not on device. Build.gradle below:

`apply plugin: 'com.android.application'

repositories {
mavenCentral()
}

android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.xxxxxxxx.bitpay"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}

}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
compile 'com.google:bitcoinj:0.11.3'
compile 'com.fasterxml.jackson.core:jackson-databind:2.4.2'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.2.3'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
compile 'commons-codec:commons-codec:1.9'
compile 'com.google.zxing:core:2.0'
compile 'com.bitpay:android-sdk:1.0.1-release@aar'
}
`

Your SDK is out of date

I am using 1.0.1 BitPay SDK version and I am getting NullPointerException.

My code:

BitPayAndroid.withToken(BITPAY_TOKEN, "https://test.bitpay.com/").then(new BitpayPromiseCallback() {
            @Override
            public void onSuccess(BitPayAndroid bitPayAndroid) {
                Invoice newInvoice = new Invoice(amount, currency);
                newInvoice.setNotificationURL(BITPAY_WEB_HOOK_URL);
                bitPayAndroid.createNewInvoice(newInvoice).then(new PromiseCallback<Invoice>() {
                    @Override
                    public void onSuccess(Invoice invoice) {
                        Intent invoiceIntent = new Intent(WishDetailActivity.this, InvoiceActivity.class);
                        invoiceIntent.putExtra(InvoiceActivity.INVOICE, invoice);
                        //NPE here, example down below. 
                        //It seems BitPay SDK Invoice model is out of date. 
                        //It wants paymentUrls (which is deprecated field according to the BitPay docs), but
                        //receives paymentCodes
                        startActivity(invoiceIntent); 
                    }

Exception:

java.lang.RuntimeException: Unable to start activity ComponentInfo{cz.cvut.fit.elateme/com.bitpay.sdk.android.InvoiceActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.bitpay.sdk.model.InvoicePaymentUrls.getBIP21()' on a null object reference
                                                                         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
                                                                         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                                         at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                                         at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                         at android.os.Looper.loop(Looper.java:148)
                                                                         at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                         at java.lang.reflect.Method.invoke(Native Method)
                                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                      Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.bitpay.sdk.model.InvoicePaymentUrls.getBIP21()' on a null object reference
                                                                         at com.bitpay.sdk.android.InvoiceActivity.getAddress(InvoiceActivity.java:425)
                                                                         at com.bitpay.sdk.android.InvoiceActivity.onCreate(InvoiceActivity.java:159)
                                                                         at android.app.Activity.performCreate(Activity.java:6237)
                                                                         at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.