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

Payment Service

Reply
Retired
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10

Re: IAP disappears, & doesn't charge but works in test mode

Yes, please add a new version that can be used to repro, it can stay in DRAFT mode, I am able to load those apps using a test account without them being live.

Garett
@garettBeuk
--
Goodbye everybody!
Developer
slashkyle
Posts: 820
Registered: ‎10-16-2012
My Device: Red Z10

Re: IAP disappears, & doesn't charge but works in test mode

I will have that done with the z10 bar in about 10 minutes, will post to let you know

Developer
slashkyle
Posts: 820
Registered: ‎10-16-2012
My Device: Red Z10

Re: IAP disappears, & doesn't charge but works in test mode

The Z10 bar is uploaded in draft mode, I'm going to put the Q10 bar into payment service test mode so you can see what happens when test mode says its working

Retired
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10

Re: IAP disappears, & doesn't charge but works in test mode

No need to post a working app, those aren't nearly as fun :smileyhappy:

 

It will take a few hours for the DRAFT mode app to be visible, in the mean time could you provide a screenshot of one of the digital goods displayed in your vendor portal showing the SKU and content ID? Please also post the snippet of code being used to initiate the purchase.

Garett
@garettBeuk
--
Goodbye everybody!
Developer
slashkyle
Posts: 820
Registered: ‎10-16-2012
My Device: Red Z10

Re: IAP disappears, & doesn't charge but works in test mode

[ Edited ]
Button {
                id: upgradeButton
                verticalAlignment: VerticalAlignment.Center
                horizontalAlignment: HorizontalAlignment.Center
                
                preferredWidth: 600
                text: qsTr("Upgrade") + Retranslate.onLocaleOrLanguageChanged
                onClicked: {
                    //Go Pro!
                    paymentControl.pid = "33237888"
                    paymentControl.sku = "Kyle-BB10-SCEFP1"
                    paymentControl.name = "Enable More Features"
                    paymentControl.metadata = "Enable More Features"
                    paymentControl.purchase(paymentControl.pid, paymentControl.sku, paymentControl.name, paymentControl.metadata)
                }
            }

//root attached obj
attachedObjects: [
            PaymentServiceControl {
                id: paymentControl
                property string pid
                property string sku
                property string name
                property string metadata
                onPriceResponseSuccess: {
                    // Play price request animation on response
                    console.log("Price - " + price)
                }
                
                // Play receipt animation on purchase response
                onPurchaseResponseSuccess: {
                    upgrade.visible = false;
                    upgradeSettings.enabled = true;
                    upgradeSettings2.enabled = true;
                    cpp.saveValueFor("Upgrade","2");
                    root.upgraded = 2;
                    console.log("purchaseResponse - " + receiptString)
                    upgradeSuccessToast.show();
                }
                onInfoResponseError: {
                    console.log("Purchase Error - " + errorCode + " - " + errorText)
                    //shows toast based on error code
                    root.purchaseResponseCode = errorText;
                    upgradeFailedToast.show();
                }
            }
]

 also I included 

import com.sample.payment 1.0 in main.qml & 2 pages that use it

 

main.cpp

#include <bb/platform/PaymentManager>
#include "PaymentServiceControl.hpp"

using namespace bb::cascades;
using namespace bb::platform;
Q_DECL_EXPORT......{

PaymentManager::setConnectionMode(PaymentConnectionMode::Production);
qmlRegisterType<PaymentServiceControl>("com.sample.payment", 1, 0, "PaymentServiceControl");

.....
}

 using paymentservice control.hpp & .cpp from the github paymentservice project

 

Retired
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10

Re: IAP disappears, & doesn't charge but works in test mode

That all looks good to me. Does the price request work properly?

Garett
@garettBeuk
--
Goodbye everybody!
Developer
slashkyle
Posts: 820
Registered: ‎10-16-2012
My Device: Red Z10

Re: IAP disappears, & doesn't charge but works in test mode

never used it but it shows the price when you click upgrade.  in test mode it shows the purchase reciept & runs the upgrade code.  I uploaded a Q bar in production mode as well because it's targeted to 10.1 and i havent tried to purchase from it

Developer
slashkyle
Posts: 820
Registered: ‎10-16-2012
My Device: Red Z10

Re: IAP disappears, & doesn't charge but works in test mode

I just tested getprice in test mode & this is what was output in the console

paymentControl.getPrice(paymentControl.pid,paymentControl.sku)

 

pushPage : mNavigationStack : ("36", "449")
NavigationPane: NavigationPaneOnFwdTransitionDone: emitting push transition ended for page: 449 client top: 449
Requesting price. ID: "33237888" SKU: "Kyle-BB10-SCEFP1"

Requesting purchase. ID: "33237888" SKU: "Kyle-BB10-SCEFP1" Name: "Enable More Features" Metadata&colon; "Enable More Features"
Purchase response success. "Date: Wed Aug 14 11:41:07 2013
Upgrade Visible - false
paid - 2
purchaseResponse - Date: Wed Aug 14 11:41:07 2013
ID/SKU: 33237888/Kyle-BB10-SCEFP1
PurchaseID/licenseKey: 0000000001/
Metadata&colon; Enable More Features
ItemState/isSubscription?: 0/false

Retired
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10

Re: IAP disappears, & doesn't charge but works in test mode

I tested with the new version and it doesn't appear to do anything when the upgrade button is clicked, no UI changes at all.

Garett
@garettBeuk
--
Goodbye everybody!
Developer
slashkyle
Posts: 820
Registered: ‎10-16-2012
My Device: Red Z10

Re: IAP disappears, & doesn't charge but works in test mode

when you clicked upgrade did the purchase window to pop up with the price and option to purchase?

 

after clicking upgrade it's disappearing on me in realase mode, but in test mode it executes the code i have setup or gives me an error toast i setup if it was an error. in production mode the error toasts aren't even being triggered