×

Discussion Board

Results 1 to 14 of 14

Threaded View

  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    13

    Smile how to solve the error "could not load payment api" in payment api implementation

    i had implemented a simple application using payment api. it is running fine on emulator .But if i launch it on device a message like "Could not load purchasing information". can any one help me in solving this. The manifest file is like this,

    MIDlet-1: t1, t1.png, myMain
    MIDlet-Certificate-1-1: MIICFTCCAX6gAwIBAgIEReVCMTANBgkqhkiG9w0BAQUFAD
    BPMQ4wDAYDVQQIEwVzdGF0ZTENMAsGA1UEBxMEY2l0eTEMMAoGA1UEChMDb3JnMRAwDgY
    DVQQLEwdvcmdVbml0MQ4wDAYDVQQDEwVjTmFtZTAeFw0wNzAyMjgwODQ5NTNaFw0xMjA4
    MjAwODQ5NTNaME8xDjAMBgNVBAgTBXN0YXRlMQ0wCwYDVQQHEwRjaXR5MQwwCgYDVQQKE
    wNvcmcxEDAOBgNVBAsTB29yZ1VuaXQxDjAMBgNVBAMTBWNOYW1lMIGfMA0GCSqGSIb3DQ
    EBAQUAA4GNADCBiQKBgQDOa1faZAW8KdkAMgtVe/0+/hyxjQmhgLFzlI0b3MoccTiloOf
    0awLoyV9mi8C/cL6qNDMLENCu9RHFRhGXbgOGt21KLyphOLblbariYa8x2P63tkHfry3l
    GXvzXTOa8p6vT+Gs5/wX87PI2uaCRiel3B9LfNduLOqwvw2VyDusRQIDAQABMA0GCSqGS
    Ib3DQEBBQUAA4GBAHUCKiCdFDtTdgFGizDrgiZPKVbh2Jzy6Ddy2FMvbqqpMQjSJfepR9
    kHC8a7bs65fh+tXIzfRUQhtY7vcQe7TiUJufsyakAiN9Ag/1cCng9LOapWnx+UVMUaWxB
    T1CxaUbwcmVmXylp1aUOxKGq7kXvwGOpwnneze2wpSTmtKO9m
    MIDlet-Name: t1
    MIDlet-Permissions: javax.microedition.payment.process,javax.wireless.
    messaging.sms.send,javax.microedition.io.Connector.http,javax.microed
    ition.io.Connector.https,javax.microedition.io.Connector.sms
    MIDlet-Vendor: Unknown
    MIDlet-Version: 1.0
    MicroEdition-Configuration: CLDC-1.1
    MicroEdition-Profile: MIDP-2.1
    Pay-AMEX-Info: X-CCARD, EUR, AMEX, https://localhost
    Pay-AMEX-Tag-0: 1.55, 1_life
    Pay-AMEX-Tag-1: 3.05, 3_lives
    Pay-AMEX-Tag-2: 2.25, 1_level
    Pay-AMEX-Tag-3: 4.45, 3_levels
    Pay-DNSDNA-Info: PPSMS, EUR, 380, 77
    Pay-DNSDNA-Tag-0: 1.45, 5550000, 1_LIFE
    Pay-DNSDNA-Tag-1: 2.85, 5550000, 3_LIVES, 2
    Pay-DNSDNA-Tag-2: 2.15, 5550000, 1_LEVEL
    Pay-DNSDNA-Tag-3: 4.25, 5550000, 3_LEVELS, 2
    Pay-Feature-0: 0
    Pay-Feature-1: 1
    Pay-Feature-2: 2
    Pay-Feature-3: 3
    Pay-MASTERCARD-Info: X-CCARD, EUR, MASTERCARD, https://localhost
    Pay-MASTERCARD-Tag-0: 1.45, 1_life
    Pay-MASTERCARD-Tag-1: 2.95, 3_lives
    Pay-MASTERCARD-Tag-2: 2.15, 1_level
    Pay-MASTERCARD-Tag-3: 4.35, 3_levels
    Pay-Providers: SONERA, VISA, RADIOG, DNSDNA, MASTERCARD, AMEX
    Pay-RADIOG-Info: PPSMS, EUR, 747, 88
    Pay-RADIOG-Tag-0: 1.35, 5550000, 1_LIFE
    Pay-RADIOG-Tag-1: 2.75, 5550000, 3_LIVES, 2
    Pay-RADIOG-Tag-2: 2.05, 5550000, 1_LEVEL
    Pay-RADIOG-Tag-3: 4.05, 5550000, 3_LEVELS, 2
    Pay-SONERA-Info: PPSMS, EUR, 928, 99
    Pay-SONERA-Tag-0: 1.40, 5550000, 1_LIFE
    Pay-SONERA-Tag-1: 2.80, 5550000, 3_LIVES, 2
    Pay-SONERA-Tag-2: 2.10, 5550000, 1_LEVEL
    Pay-SONERA-Tag-3: 4.20, 5550000, 3_LEVELS, 2
    Pay-Update-Stamp: 2004-08-12T13:30:00Z
    Pay-Update-URL: [url]http://localhost
    Pay-VISA-Info: X-CCARD, EUR, VISA, https://localhost
    Pay-VISA-Tag-0: 1.50, 1_life
    Pay-VISA-Tag-1: 3.00, 3_lives
    Pay-VISA-Tag-2: 2.20, 1_level
    Pay-VISA-Tag-3: 4.40, 3_levels
    Pay-Version: 1.0




    source code is as follows,


    import java.util.Date;
    import java.io.*;

    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.payment.TransactionListener;
    import javax.microedition.payment.TransactionListenerException;
    import javax.microedition.payment.TransactionModule;
    import javax.microedition.payment.TransactionModuleException;
    import javax.microedition.payment.TransactionRecord;






    public class myMain extends MIDlet implements TransactionListener, CommandListener, Runnable
    {

    private static final String JAR_RESOURCE = "/META-INF/MANIFEST.MF";



    // transaction status
    protected static final int TRAN_SUCCESSFUL = 0x08;
    protected static final int TRAN_REJECTED = 0x10;
    protected static final int TRAN_FAILED = 0x20;

    private Command exit = new Command("Exit", Command.EXIT, 0);
    private Command continueAlert = new Command("Continue", Command.OK, 0);
    private Command exitAlert = new Command("Exit", Command.EXIT, 0);
    private TransactionModule txModule;
    private int feature = 0;
    private boolean enableTranListenerNull = false;
    private String title = "";
    private String description = "";
    private int lastTransState;
    private boolean tran = false;
    Graphics g;
    private boolean p = false;
    private boolean suc = false;

    public myMain() {

    InputStream is = getClass().getResourceAsStream(JAR_RESOURCE);

    if (is != null) {
    try {
    is.close();
    } catch (IOException e) {
    }
    init();
    } else {

    System.out.println("priting*************************");

    String textAlert = "Please execute this application via OTA" ;

    Alert alert = new Alert("JBricks", textAlert, null, AlertType.WARNING);

    Alert alert2 = new Alert("Transaction Failed", textAlert, null, AlertType.WARNING);
    Alert alert3 = new Alert("Transaction rejected", textAlert, null, AlertType.WARNING);
    alert.addCommand(exitAlert);
    alert.addCommand(continueAlert);
    alert.setCommandListener(this);
    Display.getDisplay(this).setCurrent(alert);
    }
    }





    public void startApp() {

    }


    public void pauseApp() {

    }


    public void destroyApp(boolean unconditional) {

    }


    public void commandAction(Command cmd, Displayable dis) {

    if (cmd == continueAlert) {
    init();
    } else if (cmd == exitAlert) {
    destroyApp(true);
    }
    }



    public void processed(TransactionRecord record) {
    switch (record.getState()) {
    case TransactionRecord.TRANSACTION_SUCCESSFUL:
    String t1="Transaction success";
    Alert alert1 = new Alert("Transaction success", t1, null, AlertType.WARNING);
    suc = true;
    String t8 = "EA GAMES";
    Alert a1 = new Alert("Welcome to EA",t8,null,AlertType.WARNING);
    Display.getDisplay(this).setCurrent(alert1);
    if(suc)
    {
    Display.getDisplay(this).setCurrent(a1);
    }

    break;

    case TransactionRecord.TRANSACTION_REJECTED:
    String t2="Transaction REJECTED";
    Alert alert2 = new Alert("Transaction rejected", t2, null, AlertType.WARNING);

    Display.getDisplay(this).setCurrent(alert2);
    break;

    case TransactionRecord.TRANSACTION_FAILED:
    String t3="Transaction failed";
    Alert alert3 = new Alert("Transaction failed", t3, null, AlertType.WARNING);

    Display.getDisplay(this).setCurrent(alert3);
    break;
    }



    }


    public void run() {

    System.out.println("value***********"+p);


    }


    protected void setTransactionListenerNull(boolean b) {
    enableTranListenerNull = b;
    }







    protected int getLastTransactionState() {
    return lastTransState;
    }


    private void restoreBoughtFeatures() {
    TransactionRecord[] record = txModule.getPastTransactions(10);

    if (record != null) {
    for (int i = 0; i < record.length; i++) {
    processed(record[i]);
    }
    }
    }




    private void init() {




    try {
    txModule = new TransactionModule(this);
    txModule.setListener(this);
    txModule.deliverMissedTransactions();
    restoreBoughtFeatures();
    } catch (TransactionListenerException tle) {
    tle.printStackTrace();
    } catch (TransactionModuleException tme) {

    tme.printStackTrace();
    }


    p = true;

    if(p)
    {
    try {


    title = "Buy";
    description = "You are able to view";
    txModule.setListener(this);
    txModule.process(feature, title, description);

    if (enableTranListenerNull) {
    txModule.setListener(null);
    }
    } catch (TransactionListenerException tle) {
    System.err.println("Transaction Listener is not set");
    } catch (Exception e) {
    e.printStackTrace();
    }
    }


    }
    }
    Last edited by gov; 2009-05-11 at 10:36.

Similar Threads

  1. PC Suite error: (Code: Init IMediaControl2) HELP?!
    By chunkyspudmonkey in forum General Development Questions
    Replies: 30
    Last Post: 2014-07-15, 05:44
  2. S60 API Partnering Program
    By Nokia Ron in forum News and Announcements
    Replies: 9
    Last Post: 2008-04-16, 18:28
  3. FPC Bench, Database API and a lot more...
    By sblantipodi in forum Mobile Java Tools & SDKs
    Replies: 4
    Last Post: 2008-03-23, 01:47
  4. load vCalendar file by PIM API
    By timony in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2005-10-14, 12:03

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×