Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
Posts: 10
Registered: ‎12-01-2011
My Device: Z10 / Bold 9800

Payment API "Error 3: (null)"

Hello,

 

I'm working on a cross platform web app and I'm currently trying to implement Blackberry's in app purchase using the webworks payment API.

 

The code on our side is quite simple:

blackberry.payment.purchase(
	{digitalGoodID: xxx, digitalGoodSKU: "xxxx", metaData: xxx, puchaseAppName: "xxxx", purchaseAppIcon: null}	
, function(purchase){
		//our callback
}, function(errorText, errorId){
	alert('Error #'+errorId+': '+errorText);
});

 When tested in our live application (from the appworld with published digital goods) the error callback is called and alerts the following:

"Error #3: (null)"

 

Checking the device log with ALT-LGLG shows the following:

Uncaught Exception Trace:
Name: NullPointerException
Severity: Severe Error

No detail message
net_rim_bb_appworld_lib-17(511AD1A0)
PurchaseResultsConverter
packSinglePurchaseResultTo
0x544
net_rim_bb_appworld_lib-17(511AD1A0)
PurchaseResultsConverter
packPurchaseResultsTo
0x4DB
net_rim_bb_appworld_lib-17(511AD1A0)
PurchaseResultsConverter
toByteArray
0x48F
net_rim_bb_appworld_lib-6(511AD1A0)
ContentHandlerListener
invocationRequestNotify
0x3EE1
net_rim_cldc-2(4CC9D9BF)
ContentHandlerServerImpl$1
run
0x1D6A
........ trace becomes more generic.

From looking at the documentation, error 3 is "General Payment System Error" which along with a null error text, tells me nothing.

 

Does anyone have any idea what I'm doing wrong? I'm pretty close to the actual webworks example.

 

If it's relevant, we're using digital goods with a dynamic licensing model.

Retired
Posts: 245
Registered: ‎09-21-2012
My Device: Q10

Re: Payment API "Error 3: (null)"

I've seen some payment code, but usually the callback is as follows:

 

 

function onError(error) {
 alert("Error occurred: " + error.errorText + ", " + error.errorID);
}
Perhaps that is the misnomer?
@erikjohnzon
erjohnson@blackberry.com
Contributor
Posts: 10
Registered: ‎12-01-2011
My Device: Z10 / Bold 9800

Re: Payment API "Error 3: (null)"

This is a blackberry 5+ app, not Blackberry 10, my apologies for not mentioning that.

 

There are two definitions on the Blackberry documentation site. The one you have used is present under a supported platform list of Blackberry 10+.

 

The pattern that is listed as supporting Blackberry 5+ is as follows:

<script type="text/javascript">
  function purchase() {
      try {
          blackberry.payment.purchase({
              "digitalGoodID":"123",
              "digitalGoodSKU":"someSKU",
              "digitalGoodName":"SomeName",
              "metaData":"metadata",
              "purchaseAppName":"WebWorks APP",
              "purchaseAppIcon":null
           },
           success, failure);
      } catch (e) {
         alert ("Error" + e);
      }
  }

  function success(purchase) {
      var purchasedItem = JSON.parse(purchase);
      var transId = purchasedItem.transactionID;
      var sku = purchasedItem.digitalGoodSKU;
      var dgId = purchasedItem.digitalGoodID;
      alert("Purchased Item: " + transId + "," + sku + "," + dgId);
  }

  function failure(errorText, errorId) {
      alert("Error occured: " + errorText + ", " + errorId);
  }
</script>

This is almost exactly what I'm using. (Note that I'm getting an error ID passed to me which is alerted, and if it was an object being passed it would say object object in the alert rather than null.)

Retired
Posts: 245
Registered: ‎09-21-2012
My Device: Q10

Re: Payment API "Error 3: (null)"

My apologies....you are correct good sir.

@erikjohnzon
erjohnson@blackberry.com
Contributor
Posts: 10
Registered: ‎12-01-2011
My Device: Z10 / Bold 9800

Re: Payment API "Error 3: (null)"

Is there anywhere I can get support for this, or any additional steps I can take to try to retrieve the actual error causing my problem?